From ca7a7a8a583531b912505e4aca92c0a6589528e8 Mon Sep 17 00:00:00 2001 From: profiteroles Date: Wed, 5 Sep 2018 00:26:26 -0700 Subject: [PATCH] 0.7.5 --- Yuba.php | 25 +++++--- functions.php | 9 ++- web/lib/debug.php | 2 +- web/rtc.php | 153 ++++++++++++++++++++++++++++++++++++---------- 4 files changed, 147 insertions(+), 42 deletions(-) diff --git a/Yuba.php b/Yuba.php index e99d531..93c87ea 100755 --- a/Yuba.php +++ b/Yuba.php @@ -3,7 +3,7 @@ // Yuba // // ////////////////////////////////////////// -$version = "0.7.4"; +$version = "0.7.5"; ini_set('memory_limit', '4096M'); date_default_timezone_set("America/Los_Angeles"); @@ -213,6 +213,7 @@ $dbo->exec("CREATE TABLE files ( Filename TEXT, Extension TEXT, Type TEXT, + Size INTEGER, Inode INTEGER, Perms INTEGER, Owner TEXT, @@ -227,7 +228,6 @@ $dbo->exec("CREATE TABLE files ( gfi_type TEXT, gfi_attr TEXT, gfi_created TEXT, - Size INTEGER, has_exif INTEGER, has_mediainfo INTEGER, has_hash INTEGER, @@ -833,6 +833,7 @@ foreach ($files as $splFileInfo) { $stmt->BindValue(":Filename",$filename); $stmt->BindValue(":Extension",$extension); + //stat $stmt->BindValue(":stat",$sty[$j]); if ($type == "link") { @@ -864,8 +865,6 @@ foreach ($files as $splFileInfo) { if ($type == "file") { $fid = md5($splFileInfo->getSize().$splFileInfo->getMtime().$splFileInfo->getBasename()); $stmt->BindValue(":fid",$fid); - } else { - $stmt->BindValue(":fid",null); } // Size @@ -886,8 +885,6 @@ foreach ($files as $splFileInfo) { if ($type == "dir" || $type == "bundle" ) { $items = chop(@shell_exec("find ".$shellpath." \( ! -regex '.*/\..*' \) | wc -l 2>&1"))-1; $stmt->BindValue(":items",@$items); - } else { - $items = null; } // ------------------------------------------------ // @@ -897,8 +894,6 @@ foreach ($files as $splFileInfo) { if ($type == "dir") { $newest = @filemtime(chop(shell_exec("find ".$shellpath." -type f -not -path '*/\.*' -print0 | xargs -0 stat -f \"%m %N\" | sort -rn 2>&1 | head -1 | cut -f2- -d\" \""))); $stmt->BindValue(":newest",@$newest); - } else { - $newest = null; } // ------------------------------------------------ // @@ -1027,6 +1022,20 @@ if (file_exists($error_log_file)) { echo file_get_contents($error_log_file); } $seconds = floor($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"]); $dbo->exec("UPDATE _skim SET status='completed_in_".$seconds."'"); + +// rsync + +if ($p['rsync_dest']) { + echo "\nrsync...\n"; + $command = "rsync -avv -e ssh ".$bpath." ".$p['rsync_dest']; + $count = trim(shell_exec("find ".escapeshellarg($bpath)." | wc -l")); + echo ProgressBar::start($count,"rsync"); + $pipe = popen($command, "r"); + while(fgets($pipe, 2048)) { echo ProgressBar::next(); } + pclose($pipe); + echo ProgressBar::finish(); + } + echo "Finished in ".$seconds." seconds\n\n"; unset($dbo, $dbp, $files, $family, $fx); diff --git a/functions.php b/functions.php index b51a95f..fdedac5 100755 --- a/functions.php +++ b/functions.php @@ -9,7 +9,7 @@ class ProgressBar { protected static $total = 0; public static function display($message = null) { - $string = "PROGRESS:".round((self::$done/self::$total)*100,2); + $string = "PROGRESS:".floor((self::$done/self::$total)*100); if ($message) { return "\n".$string."\n".$message; } elseif (!strpos(__FILE__,".app")) { @@ -50,6 +50,10 @@ function getParents($zpath, $pathname) { } */ +function stringPrint($string) { + echo $string.@str_repeat(" ", (10-strlen($string))); + } + function shortlabel($pathname, $max = 99, $pad = false) { $basename = basename($pathname); $suffix = "(...).".pathinfo($basename,PATHINFO_EXTENSION); @@ -58,6 +62,9 @@ function shortlabel($pathname, $max = 99, $pad = false) { } else { $return = $basename; } + if ($pad) { + $return = $return.@str_repeat(" ", ($max-strlen($return))); + } return $return; } diff --git a/web/lib/debug.php b/web/lib/debug.php index 4597274..e9000b6 100644 --- a/web/lib/debug.php +++ b/web/lib/debug.php @@ -185,7 +185,7 @@ else { $collapse = !($level+1<=1 || $title===true || (is_string($title) && substr($title,0,1)=='*')); - $collapse = false; // hack + $collapse = false; $result .= "\n
\n
".($collapse?'+':'-')."
"; } $result .= debug ($value, $title, $plain, $limit, $level+1); diff --git a/web/rtc.php b/web/rtc.php index 733cf7e..70313c9 100644 --- a/web/rtc.php +++ b/web/rtc.php @@ -1,9 +1,10 @@