Files
thetool/application/File/File.php
2021-07-30 18:24:51 +02:00

31 lines
708 B
PHP

<?php
class File extends mfBaseModel {
public function delete() {
if($this->id) {
$id = $this->id;
// delete file in store
$path = MFUPLOAD_FILE_SAVE_PATH."/documents/".$this->store_filename;
if(!unlink($path)) {
$this->log->warn(__CLASS__."::delete(): Error unlinking file ($path)");
}
$where = "id=$id";
if($this->fieldprefix && !strstr($field,"_")) {
$where = $this->fieldprefix."_id=$id";
}
if($this->db->delete($this->table,$where)) {
if(method_exists($this, "afterDelete")) {
$this->afterDelete();
}
$this->data = new stdClass();
$this->id = "";
return true;
}
}
return false;
}
}