Exemplo n.º 1
0
 /**
  * Updates file info in DB (width/height/size/date_modified) and performs additional actions for image files
  * @param Assets_base_file $file
  * @param string $file_path file location
  * @return int
  */
 public function update_file_info(Assets_base_file $file, $file_path = '')
 {
     $unlink_path = FALSE;
     if (empty($file_path)) {
         $file_path = $file->get_local_copy();
         $unlink_path = TRUE;
     }
     if ($file->kind() == 'image') {
         $this->post_upload_image_actions($file->file_id(), $file_path);
     }
     $time_modified = $file->date_modified(TRUE);
     $data = array('date_modified' => $time_modified, 'date' => $time_modified, 'size' => $file->size('', TRUE));
     $this->EE->db->update('assets_files', $data, array('file_id' => $file->file_id()));
     if ($unlink_path) {
         @unlink($file_path);
     }
     return $file->file_id();
 }