Save .DS_Store files if contents is enabled

This commit is contained in:
2019-06-12 22:13:56 -07:00
parent eba7476d3c
commit a1fa82a0c9

View File

@@ -21,8 +21,6 @@ if (!file_exists($prefs_file)) {
} }
$p = unserialize(file_get_contents($prefs_file)); $p = unserialize(file_get_contents($prefs_file));
$p['phpbin'] = "/usr/bin/php";
require("functions.php"); require("functions.php");
require("filetypes.php"); require("filetypes.php");
@@ -37,7 +35,7 @@ $parser = new plistParser();
// Preferences // Preferences
if (@$argv[1] == "Preferences...") { if (@$argv[1] == "Preferences...") {
exec($p['phpbin']." ".__DIR__."/YubaPrefs.php 2>&1"); exec($bin_php." ".__DIR__."/YubaPrefs.php 2>&1");
die; die;
} }
@@ -403,7 +401,7 @@ $i = 0;
$family = array(); $family = array();
$fids = array(); $fids = array();
$noread = array(); $noread = array();
$fx = new SplFixedArray($passed_file); // splFixedArray for performance (?) $fx = new SplFixedArray($passed_file);
$splcount = 0; $splcount = 0;
echo ProgressBar::start($passed_total,"Prescan (".stepString().")"); echo ProgressBar::start($passed_total,"Prescan (".stepString().")");
@@ -437,17 +435,16 @@ foreach ($files as $splFileInfo) {
} }
// capture stat before values change // capture stat before values change
/*
if ($splFileInfo->getType() != "link") { if ($splFileInfo->getType() != "link") {
$stx[$i] = array( $splFileInfo->getATime(), $stx[$i] = array( $splFileInfo->getATime(),
$splFileInfo->getMTime(), $splFileInfo->getMTime(),
$splFileInfo->getCTime() ); $splFileInfo->getCTime() );
} }
*/
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
//$sty[$i] = "bypass"; //$sty[$i] = "bypass";
$sty[$i] = statToArray(shell_exec("stat -s ".$shellpath." 2>&1"));
// Check file can be read // Check file can be read
@@ -485,7 +482,7 @@ $message .= $passed_dir." dirs, ";
$message .= $nodescended." bundles, "; $message .= $nodescended." bundles, ";
$message .= $passed_link." links, "; $message .= $passed_link." links, ";
$message .= $ignored." ignored, "; $message .= $ignored." ignored, ";
//$message .= ($dupecount ? $dupecount : 0)." dupes"; //$message .= (@$dupecount ? $dupecount : 0)." dupes";
echo ProgressBar::start(count($family),$message); echo ProgressBar::start(count($family),$message);
@@ -537,7 +534,7 @@ $stmt .= "passed_link=".$passed_link.", ";
$stmt .= "passed_total=".$passed_total.", "; $stmt .= "passed_total=".$passed_total.", ";
$stmt .= "nodescended=".$nodescended.", "; $stmt .= "nodescended=".$nodescended.", ";
$stmt .= "ignored=".$ignored.", "; $stmt .= "ignored=".$ignored.", ";
$stmt .= "dupes=".($dupecount ? $dupecount : 0); $stmt .= "dupes=".(@$dupecount ? $dupecount : 0);
$dbo->exec($stmt); $dbo->exec($stmt);
$wopt_currstep++; $wopt_currstep++;
@@ -573,7 +570,7 @@ if ($p['icons']) {
foreach ($fx as $count => $array) { foreach ($fx as $count => $array) {
$fid = $array[0]; $fid = $array[0];
$pathname = $array[1]; $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); msg($icmd);
$line[] = $icmd; $line[] = $icmd;
} }
@@ -737,8 +734,14 @@ if ($p['contents']) {
if (in_array($ext, $p['c_files'])) { if (in_array($ext, $p['c_files'])) {
if (!is_dir($cpath)) { mkdir($cpath); } if (!is_dir($cpath)) { mkdir($cpath); }
$max_size = $p['contents_limit'] * 1000; $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); msg("Zipping ".$pathname);
$zip = new ZipArchive(); $zip = new ZipArchive();