use error_log instead of echo to give constant feedback (echo uses output buffering) and set fs_content in all rows to NULL, as it is a lot quicker

This commit is contained in:
Ralf Becker 2015-02-17 07:55:11 +00:00
parent 7e8f2716e6
commit 9686d8ff5b

View File

@ -30,7 +30,7 @@ class Utils extends StreamWrapper
* *
* @param boolean $debug true to echo a message for each copied file * @param boolean $debug true to echo a message for each copied file
*/ */
static function migrate_db2fs($debug=false) static function migrate_db2fs($debug=true)
{ {
if (!is_object(self::$pdo)) if (!is_object(self::$pdo))
{ {
@ -84,7 +84,7 @@ class Utils extends StreamWrapper
{ {
throw new egw_exception_assertion_failed(__METHOD__."(): fs_id=$fs_id ($fs_name) $bytes bytes copied != size of $fs_size bytes!"); throw new egw_exception_assertion_failed(__METHOD__."(): fs_id=$fs_id ($fs_name) $bytes bytes copied != size of $fs_size bytes!");
} }
if ($debug) echo "$fs_id: $fs_name: $bytes bytes copied to fs\n"; if ($debug) error_log("$fs_id: $fs_name: $bytes bytes copied to fs");
fclose($dest); fclose($dest);
fclose($content); unset($content); fclose($content); unset($content);
@ -99,7 +99,7 @@ class Utils extends StreamWrapper
if ($n) // delete all content in DB, if there was some AND no error (exception thrown!) if ($n) // delete all content in DB, if there was some AND no error (exception thrown!)
{ {
$query = 'UPDATE '.self::TABLE.' SET fs_content=NULL WHERE fs_content IS NOT NULL'; $query = 'UPDATE '.self::TABLE.' SET fs_content=NULL';
$stmt = self::$pdo->prepare($query); $stmt = self::$pdo->prepare($query);
$stmt->execute(); $stmt->execute();
} }