Welcome to mirror list, hosted at ThFree Co, Russian Federation.

preview.php « repair « lib - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1216b3fe68acaca09ee161edfec05a9d2ec90c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
				}
			}
		}
	}
}