Server IP : 172.67.158.161 / Your IP : 3.147.46.181 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/self/root/home/giankuin/sieuthiweb.com.vn/dup-installer/lib/dup_archive/classes/util/ |
Upload File : |
<?php if (!defined("ABSPATH") && !defined("DUPXABSPATH")) die(""); /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ require_once(dirname(__FILE__).'/class.duparchive.u.json.php'); if(!class_exists('DupArchiveScanUtil')) { /** * Description of class * * @author Robert */ class DupArchiveScanUtil { public static function getScan($scanFilepath) //put your code here private function get_scan() { DupArchiveUtil::tlog("Getting scen"); $scan_handle = fopen($scanFilepath, 'r'); if ($scan_handle === false) { throw new Exception("Can't open {$scanFilepath}"); } $scan_file = fread($scan_handle, filesize($scanFilepath)); if ($scan_file === false) { throw new Exception("Can't read from {$scanFilepath}"); } // $scan = json_decode($scan_file); $scan = DupArchiveJsonU::decode($scan_file); if ($scan == null) { throw new Exception("Error decoding scan file"); } fclose($scan_handle); return $scan; } public static function createScanObject($sourceDirectory) { $scan = new stdClass(); $scan->Dirs = DupArchiveUtil::expandDirectories($sourceDirectory, true); $scan->Files = DupArchiveUtil::expandFiles($sourceDirectory, true); return $scan; } public static function createScan($scanFilepath, $sourceDirectory) { DupArchiveUtil::tlog("Creating scan"); // $scan = new stdClass(); // // $scan->Dirs = DupArchiveUtil::expandDirectories($sourceDirectory, true); // $scan->Files = DupArchiveUtil::expandFiles($sourceDirectory, true); ////$scan->Files = array(); $scan = self::createScanObject($sourceDirectory); $scan_handle = fopen($scanFilepath, 'w'); if ($scan_handle === false) { echo "Couldn't create scan file"; die(); } $jsn = DupArchiveJsonU::customEncode($scan); fwrite($scan_handle, $jsn); // DupArchiveUtil::tlogObject('jsn', $jsn); return $scan; } } }