예제 #1
0
 function run()
 {
     if (!FX::endsWith('/', $this->srcDir)) {
         $this->srcDir .= '/';
     }
     if (!FX::endsWith('/', $this->dstDir)) {
         $this->dstDir .= '/';
     }
     if (!FX::endsWith('/', $this->archiveDir)) {
         $this->archiveDir .= '/';
     }
     if (!FX::endsWith('/', $this->delDir)) {
         $this->delDir .= '/';
     }
     if (!$this->checkFileSystems()) {
         return FALSE;
     }
     clearstatcache();
     // enter recursion:
     $this->backup_dir($this->srcDir, "copy");
     $totalCopyChecks = $this->totalChecks;
     // reverse check backup'ed files for deletion:
     $this->backup_dir($this->dstDir, "reverseCheck");
     // check DB entries, whether they are excluded now (archived and deleted files):
     $this->checkDatabase();
     $msg = "Insgesamt " . number_format($this->totalBytes, 0, ";", ".") . " Bytes in " . $this->totalFiles . " Dateien gesichert, " . $totalCopyChecks . " Dateien überprüft.";
     $e = new FileCopyMessage($msg, 'ADMIN');
     echo $msg . "\n";
     $msg = "Insgesamt " . number_format($this->totalDelBytes, 0, ";", ".") . " Bytes in " . $this->totalDelFiles . " Dateien wurden gelöscht / verschoben.";
     $e = new FileCopyMessage($msg, 'ADMIN');
     echo $msg . "\n";
     return TRUE;
 }
예제 #2
0
 function findByName($fpath, $fname)
 {
     global $LNK;
     $fileid = FALSE;
     if (FX::endsWith('/', $fpath)) {
         $fpath = substr($fpath, 0, -1);
     }
     $sql = "SELECT fileid FROM files WHERE path LIKE '" . mysqli_escape_string($LNK, $fpath) . "' AND fname LIKE '" . mysqli_escape_string($LNK, $fname) . "';";
     $result = @mysqli_query($LNK, $sql);
     if (!$result) {
         $e = new FileCopyMessage(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
     }
     if ($row = mysqli_fetch_assoc($result)) {
         $fileid = $row["fileid"];
     }
     return $fileid;
 }