diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-01-15 19:11:12 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-01-15 19:11:12 +0100 |
commit | 7debfac0dc8f602168d8db480cfd4757b4d612b0 (patch) | |
tree | 98398af95bc5c6b93793e6bc80ad8dba5deea237 /lib/files/cache/upgrade.php | |
parent | 94068e5d08cba776e410d925e26037d442b5bc62 (diff) | |
download | nextcloud-server-7debfac0dc8f602168d8db480cfd4757b4d612b0.tar.gz nextcloud-server-7debfac0dc8f602168d8db480cfd4757b4d612b0.zip |
Cache: more efficient upgrading
Diffstat (limited to 'lib/files/cache/upgrade.php')
-rw-r--r-- | lib/files/cache/upgrade.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/files/cache/upgrade.php b/lib/files/cache/upgrade.php index 1032e0a844c..cd9a9e91a8c 100644 --- a/lib/files/cache/upgrade.php +++ b/lib/files/cache/upgrade.php @@ -43,15 +43,21 @@ class Upgrade { $data = $this->getNewData($row); $this->insert($data); - $children = $this->legacy->getChildren($data['id']); - foreach ($children as $child) { - if ($mode == Scanner::SCAN_SHALLOW) { - $childData = $this->getNewData($child); - \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $child['path']); - $this->insert($childData); - } else { - $this->upgradePath($child['path']); - } + $this->upgradeChilds($data['id'], $mode); + } + } + + /** + * @param int $id + */ + function upgradeChilds($id, $mode = Scanner::SCAN_RECURSIVE) { + $children = $this->legacy->getChildren($id); + foreach ($children as $child) { + $childData = $this->getNewData($child); + \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $child['path']); + $this->insert($childData); + if ($mode == Scanner::SCAN_RECURSIVE) { + $this->upgradeChilds($child['id']); } } } |