diff options
author | Georg Ehrke <developer@georgehrke.com> | 2014-09-21 17:16:21 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2014-09-21 17:16:21 +0200 |
commit | ab2554e013107880ff92130b7cef6dd0ad3af762 (patch) | |
tree | d78dc53d12bdbcdaaff245eb29a199047b958d5e /lib/repair | |
parent | 69726d951e805e8692907c99b24edbc3099b29d4 (diff) | |
download | nextcloud-server-ab2554e013107880ff92130b7cef6dd0ad3af762.tar.gz nextcloud-server-ab2554e013107880ff92130b7cef6dd0ad3af762.zip |
delete old previews
Diffstat (limited to 'lib/repair')
-rw-r--r-- | lib/repair/preview.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/repair/preview.php b/lib/repair/preview.php new file mode 100644 index 00000000000..1216b3fe68a --- /dev/null +++ b/lib/repair/preview.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright (c) 2014 Georg Ehrke <georg@ownCloud.com> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +namespace OC\Repair; + +use OC\Files\View; +use OC\Hooks\BasicEmitter; + +class Preview extends BasicEmitter implements \OC\RepairStep { + + public function getName() { + return 'Cleaning-up broken previews'; + } + + public function run() { + $view = new View('/'); + $children = $view->getDirectoryContent('/'); + + foreach ($children as $child) { + if ($view->is_dir($child->getPath())) { + $thumbnailsFolder = $child->getPath() . '/thumbnails'; + if ($view->is_dir($thumbnailsFolder)) { + $view->rmdir($thumbnailsFolder); + } + } + } + } +}
\ No newline at end of file |