From a1fa82a0c980400eb7cdf7c66fb4eae42e6e47d1 Mon Sep 17 00:00:00 2001 From: profiteroles Date: Wed, 12 Jun 2019 22:13:56 -0700 Subject: [PATCH] Save .DS_Store files if contents is enabled --- Yuba.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Yuba.php b/Yuba.php index fae48c0..f9bcc38 100755 --- a/Yuba.php +++ b/Yuba.php @@ -21,8 +21,6 @@ if (!file_exists($prefs_file)) { } $p = unserialize(file_get_contents($prefs_file)); -$p['phpbin'] = "/usr/bin/php"; - require("functions.php"); require("filetypes.php"); @@ -37,7 +35,7 @@ $parser = new plistParser(); // Preferences if (@$argv[1] == "Preferences...") { - exec($p['phpbin']." ".__DIR__."/YubaPrefs.php 2>&1"); + exec($bin_php." ".__DIR__."/YubaPrefs.php 2>&1"); die; } @@ -403,7 +401,7 @@ $i = 0; $family = array(); $fids = array(); $noread = array(); -$fx = new SplFixedArray($passed_file); // splFixedArray for performance (?) +$fx = new SplFixedArray($passed_file); $splcount = 0; echo ProgressBar::start($passed_total,"Prescan (".stepString().")"); @@ -437,17 +435,16 @@ foreach ($files as $splFileInfo) { } // capture stat before values change - - /* + if ($splFileInfo->getType() != "link") { $stx[$i] = array( $splFileInfo->getATime(), $splFileInfo->getMTime(), $splFileInfo->getCTime() ); } - */ + + $sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1")); //$sty[$i] = "bypass"; - $sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1")); // Check file can be read @@ -485,7 +482,7 @@ $message .= $passed_dir." dirs, "; $message .= $nodescended." bundles, "; $message .= $passed_link." links, "; $message .= $ignored." ignored, "; -//$message .= ($dupecount ? $dupecount : 0)." dupes"; +//$message .= (@$dupecount ? $dupecount : 0)." dupes"; echo ProgressBar::start(count($family),$message); @@ -537,7 +534,7 @@ $stmt .= "passed_link=".$passed_link.", "; $stmt .= "passed_total=".$passed_total.", "; $stmt .= "nodescended=".$nodescended.", "; $stmt .= "ignored=".$ignored.", "; -$stmt .= "dupes=".($dupecount ? $dupecount : 0); +$stmt .= "dupes=".(@$dupecount ? $dupecount : 0); $dbo->exec($stmt); $wopt_currstep++; @@ -573,7 +570,7 @@ if ($p['icons']) { foreach ($fx as $count => $array) { $fid = $array[0]; $pathname = $array[1]; - $icmd = $p['phpbin']." ".$helper." icons ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; echo ".ProgressBar::next(); + $icmd = $bin_php." ".$helper." icons ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; echo ".ProgressBar::next(); msg($icmd); $line[] = $icmd; } @@ -737,8 +734,14 @@ if ($p['contents']) { if (in_array($ext, $p['c_files'])) { if (!is_dir($cpath)) { mkdir($cpath); } $max_size = $p['contents_limit'] * 1000; - if (!file_exists($cfile) && filesize($pathname) < $max_size) { - + if ($ext == ".DS_Store") { + // store all DS_Store files no matter how big + $my_size = 1; + } else { + $my_size = filesize($pathname); + } + if (!file_exists($cfile) && $my_size < $max_size) { + msg("Zipping ".$pathname); $zip = new ZipArchive();