예제 #1
0
 public function delete($id)
 {
     // Queue template for publish
     CI()->load->model('publish_queue_model');
     CI()->publish_queue_model->delete($this->table, $id);
     return parent::delete($id);
 }
 public function deleteQueue($id)
 {
     return parent::delete($id);
 }
예제 #3
0
 public function delete($one, $two = NULL)
 {
     $id = $one;
     if (!($id > 1)) {
         show_error(__METHOD__ . ' Invalid id: ' . $id);
     }
     $item = CI()->file_model->first()->getById($id);
     if (parent::delete($id)) {
         if (!empty($item[$this->id_field])) {
             // Queue file for delete
             CI()->load->model('publish_queue_model');
             CI()->publish_queue_model->delete($this->table, $id);
             $children = $this->get(array('parent_id' => $id));
             if (count($children)) {
                 foreach ($children as $child) {
                     $this->delete($child[$this->id_field]);
                 }
             }
             // Only perform the following if this is a file
             if ($item['type'] == 'file' && !empty($item['base_path'])) {
                 // TODO: Should we add checks to make sure base_path starts with doc_root?
                 // TODO: Should we check to make sure id_field is valid?
                 $rm_result = shell_exec('rm -fv ' . $item['base_path'] . '*' . $item['ext']);
                 log_message('debug', 'Deleting file ' . $item[$this->id_field] . ' (' . $rm_result . ')');
             }
         }
     }
     return true;
 }