function delete() { $result = parent::delete(); //delete the file from the server $project = new Project($this->project_id); if ($project->is_valid()) { $paths = $project->file_paths(); if (isset($paths) && file_exists($paths['upload_path'] . $this->name)) { $file = $paths['upload_path'] . $this->name; unlink($file); } } ActivityManager::file_deleted($this); return $result; }