diff --git a/Yuba.php b/Yuba.php index e81a743..04850bf 100755 --- a/Yuba.php +++ b/Yuba.php @@ -475,7 +475,7 @@ echo ProgressBar::finish($wopt_clear); // Thow permissions error if (count($noread)) { - echo msg("Current user (".posix_getuid().") does not have read access to the following files:\n").implode("\n",$noread); + echo msg("Current user (".posix_getuid().") does not have read access to the following files:\n").implode("\n",$noread)."\n"; if ($p['readability']) { echo msg("Exiting..."); die; @@ -723,54 +723,6 @@ if ($p['thumbs']) { } -// Contents -////////////////////////////////////////// - -if ($p['contents']) { - - // should be rewritten to check against filemtimes - - echo ProgressBar::start(count($fx),"Gathering contents (".stepString().")"); - - foreach ($fx as $array) { - $fid = $array[0]; - $pathname = $array[1]; - $ext = pathinfo($pathname,PATHINFO_EXTENSION); - $cpath = $bpath."/contents/".substr($fid, 0, 2); - $cfile = $cpath."/".$fid.".zip"; - if (in_array($ext, $p['c_files'])) { - if (!is_dir($cpath)) { mkdir($cpath); } - $max_size = $p['contents_limit'] * 1000; - 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(); - $zip->open($cfile, ZipArchive::CREATE); - $zip->addfile($pathname,basename($pathname)); - $zip->close(); - - $stmt = $dbp->prepare("INSERT INTO contents VALUES (:fid, :created, :relative_path)"); - $stmt->BindValue(":fid",$fid); - $stmt->BindValue(":created",time()); - $stmt->BindValue(":relative_path",substr($cfile, strlen($bpath))); - $stmt->execute(); - - } - } - echo ProgressBar::next(true); - } - - echo ProgressBar::finish($wopt_clear); - - } - // External metadata ////////////////////////////////////////// @@ -869,6 +821,54 @@ if ($p['hash']) { } +// Contents +////////////////////////////////////////// + +if ($p['contents']) { + + // should be rewritten to check against filemtimes + + echo ProgressBar::start(count($fx),"Gathering contents (".stepString().")"); + + foreach ($fx as $array) { + $fid = $array[0]; + $pathname = $array[1]; + $ext = pathinfo($pathname,PATHINFO_EXTENSION); + $cpath = $bpath."/contents/".substr($fid, 0, 2); + $cfile = $cpath."/".$fid.".zip"; + if (in_array($ext, $p['c_files'])) { + if (!is_dir($cpath)) { mkdir($cpath); } + $max_size = $p['contents_limit'] * 1000; + 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(); + $zip->open($cfile, ZipArchive::CREATE); + $zip->addfile($pathname,basename($pathname)); + $zip->close(); + + $stmt = $dbp->prepare("INSERT INTO contents VALUES (:fid, :created, :relative_path)"); + $stmt->BindValue(":fid",$fid); + $stmt->BindValue(":created",time()); + $stmt->BindValue(":relative_path",substr($cfile, strlen($bpath))); + $stmt->execute(); + + } + } + echo ProgressBar::next(true); + } + + echo ProgressBar::finish($wopt_clear); + + } + // Pool Indices //////////////////////////////////////////