Esempio n. 1
0
 /**
  * Notifies the DAM about (external) changes to names and movements about files or folders.
  * This will update all related meta data
  *
  * @param	string		$src File/folder name with path of the source that was changed.
  * @param	string		$dest File/folder name with path of the destination which is a new name or/and a new location.
  * @return	void
  */
 function notify_fileMoved($src, $dest)
 {
     if (@is_file($dest)) {
         if ($meta = tx_dam::meta_getDataForFile($src, 'uid,file_name,file_dl_name', true)) {
             $fileInfo = tx_dam::file_compileInfo($dest);
             $values = array();
             $values['uid'] = $meta['uid'];
             $values['deleted'] = '0';
             $values['file_name'] = $fileInfo['file_name'];
             $values['file_path'] = $fileInfo['file_path'];
             $values['file_mtime'] = $fileInfo['file_mtime'];
             if ($meta['file_dl_name'] == $meta['file_name']) {
                 $values['file_dl_name'] = $fileInfo['file_name'];
             }
             tx_dam_db::insertUpdateData($values);
         } else {
             // file is not yet indexed
             tx_dam::index_autoProcess($dest);
         }
         // the item is a folder
     } elseif (@is_dir($dest)) {
         tx_dam_db::updateFilePath($src, $dest);
     }
     // else unknown
 }