diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index eb6a5c0906..a0d0f8ad2b 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -664,7 +664,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper /** * due to problems with recursive directory creation, we have our own here */ - private static function mkdir_recursive($pathname, $mode, $depth=0) + protected static function mkdir_recursive($pathname, $mode, $depth=0) { $maxdepth=10; $depth2propagate = (int)$depth + 1; diff --git a/phpgwapi/inc/class.sqlfs_utils.inc.php b/phpgwapi/inc/class.sqlfs_utils.inc.php index 16911912a6..a09299dfbb 100644 --- a/phpgwapi/inc/class.sqlfs_utils.inc.php +++ b/phpgwapi/inc/class.sqlfs_utils.inc.php @@ -31,18 +31,20 @@ class sqlfs_utils extends sqlfs_stream_wrapper self::_pdo(); } $query = 'SELECT fs_id,fs_name,fs_size,fs_content'. - ' FROM '.self::TABLE.' WHERE fs_content IS NOT NULL'; + ' FROM '.self::TABLE.' WHERE fs_content IS NOT NULL'. + ' ORDER BY fs_id LIMIT 5 OFFSET :offset'; $fs_id = $fs_name = $fs_size = $fs_content = null; + $n = 0; $stmt = self::$pdo->prepare($query); $stmt->bindColumn(1,$fs_id); $stmt->bindColumn(2,$fs_name); $stmt->bindColumn(3,$fs_size); $stmt->bindColumn(4,$fs_content,PDO::PARAM_LOB); + $stmt->bindValue(':offset', $n, PDO::PARAM_INT); - if ($stmt->execute()) + while ($stmt->execute()) { - $n = 0; foreach($stmt as $row) { // hack to work around a current php bug (http://bugs.php.net/bug.php?id=40913) @@ -82,16 +84,17 @@ class sqlfs_utils extends sqlfs_stream_wrapper fclose($content); unset($content); ++$n; - unset($row); // not used, as we access bound variables } - unset($stmt); + if (!$n) break; // just in case nothing is found, statement will execute just fine + } + unset($row); // not used, as we access bound variables + unset($stmt); - 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'; - $stmt = self::$pdo->prepare($query); - $stmt->execute(); - } + 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'; + $stmt = self::$pdo->prepare($query); + $stmt->execute(); } return $n; }