Beispiel #1
0
 private static function _set_meta($data, $id, $mfolder, $ntlm)
 {
     $w = new Java("jcifs.smb.SmbFile", "smb://" . $id, $ntlm);
     $lastmodified = $w->getLastModified() / 1000;
     $sourcefile = sys_cache_get_file("cifs", $id . $lastmodified, "--" . modify::basename($id . ".meta"), true);
     if (file_exists($sourcefile)) {
         $data = sys_build_meta(file_get_contents($sourcefile), $data);
     }
     $drop = array("filedata", "folder", "created", "lastmodified", "handler", "mfolder", "dsize", "id");
     $data = sys_build_meta_str($data, array_diff(array_keys($data), $drop));
     if ($data == "") {
         $w = new Java("jcifs.smb.SmbFile", "smb://" . $id . ".meta", $ntlm);
         if ($w->exists()) {
             $w->delete();
         }
     } else {
         file_put_contents($sourcefile, $data, LOCK_EX);
         $in = new Java("java.io.FileInputStream", modify::realfilename($sourcefile, false));
         $w = new Java("jcifs.smb.SmbFile", "smb://" . $id . ".meta", $ntlm);
         $w->load($in);
     }
 }