Exemple #1
0
 public static function Insert($md)
 {
     // save some work by checking if filepath is given right away
     if (!isset($md['MDATA_KEY_FILEPATH'])) {
         return null;
     }
     $file = new CcFiles();
     $now = new DateTime("now", new DateTimeZone("UTC"));
     $file->setDbUtime($now);
     $file->setDbMtime($now);
     $storedFile = new Application_Model_StoredFile();
     $storedFile->_file = $file;
     // removed "//" in the path. Always use '/' for path separator
     // TODO : it might be better to just call OsPath::normpath on the file
     // path. Also note that mediamonitor normalizes the paths anyway
     // before passing them to php so it's not necessary to do this at all
     $filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']);
     $res = $storedFile->setFilePath($filepath);
     if ($res === -1) {
         return null;
     }
     $storedFile->setMetadata($md);
     return $storedFile;
 }