Completed
Pull Request — master (#3385)
by Christoph
18:07
created
apps/systemtags/lib/Controller/LastUsedController.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@
 block discarded – undo
30 30
 
31 31
 class LastUsedController extends Controller {
32 32
 
33
-	/** @var IConfig */
34
-	protected $config;
35
-
36
-	/** @var IUserSession */
37
-	protected $userSession;
38
-
39
-	/**
40
-	 * @param string $appName
41
-	 * @param IRequest $request
42
-	 * @param IConfig $config
43
-	 * @param IUserSession $userSession
44
-	 */
45
-	public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession) {
46
-		parent::__construct($appName, $request);
47
-		$this->config = $config;
48
-		$this->userSession = $userSession;
49
-	}
50
-
51
-	/**
52
-	 * @NoAdminRequired
53
-	 */
54
-	public function getLastUsedTagIds() {
55
-		$lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]');
56
-		$tagIds = json_decode($lastUsed, true);
57
-		return new DataResponse(array_map(function($id) { return (string) $id; }, $tagIds));
58
-	}
33
+    /** @var IConfig */
34
+    protected $config;
35
+
36
+    /** @var IUserSession */
37
+    protected $userSession;
38
+
39
+    /**
40
+     * @param string $appName
41
+     * @param IRequest $request
42
+     * @param IConfig $config
43
+     * @param IUserSession $userSession
44
+     */
45
+    public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession) {
46
+        parent::__construct($appName, $request);
47
+        $this->config = $config;
48
+        $this->userSession = $userSession;
49
+    }
50
+
51
+    /**
52
+     * @NoAdminRequired
53
+     */
54
+    public function getLastUsedTagIds() {
55
+        $lastUsed = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'systemtags', 'last_used', '[]');
56
+        $tagIds = json_decode($lastUsed, true);
57
+        return new DataResponse(array_map(function($id) { return (string) $id; }, $tagIds));
58
+    }
59 59
 }
Please login to merge, or discard this patch.
apps/systemtags/lib/Settings/Admin.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@
 block discarded – undo
28 28
 
29 29
 class Admin implements ISettings {
30 30
 
31
-	/**
32
-	 * @return TemplateResponse
33
-	 */
34
-	public function getForm() {
35
-		return new TemplateResponse('systemtags', 'admin', [], '');
36
-	}
31
+    /**
32
+     * @return TemplateResponse
33
+     */
34
+    public function getForm() {
35
+        return new TemplateResponse('systemtags', 'admin', [], '');
36
+    }
37 37
 
38
-	/**
39
-	 * @return string the section ID, e.g. 'sharing'
40
-	 */
41
-	public function getSection() {
42
-		return 'workflow';
43
-	}
38
+    /**
39
+     * @return string the section ID, e.g. 'sharing'
40
+     */
41
+    public function getSection() {
42
+        return 'workflow';
43
+    }
44 44
 
45
-	/**
46
-	 * @return int whether the form should be rather on the top or bottom of
47
-	 * the admin section. The forms are arranged in ascending order of the
48
-	 * priority values. It is required to return a value between 0 and 100.
49
-	 *
50
-	 * E.g.: 70
51
-	 */
52
-	public function getPriority() {
53
-		return 70;
54
-	}
45
+    /**
46
+     * @return int whether the form should be rather on the top or bottom of
47
+     * the admin section. The forms are arranged in ascending order of the
48
+     * priority values. It is required to return a value between 0 and 100.
49
+     *
50
+     * E.g.: 70
51
+     */
52
+    public function getPriority() {
53
+        return 70;
54
+    }
55 55
 
56 56
 }
Please login to merge, or discard this patch.
apps/systemtags/appinfo/routes.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  */
23 23
 
24 24
 return [
25
-	'routes' => [
26
-		['name' => 'LastUsed#getLastUsedTagIds', 'url' => '/lastused', 'verb' => 'GET'],
27
-	]
25
+    'routes' => [
26
+        ['name' => 'LastUsed#getLastUsedTagIds', 'url' => '/lastused', 'verb' => 'GET'],
27
+    ]
28 28
 ];
Please login to merge, or discard this patch.
apps/systemtags/appinfo/app.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
 
27 27
 $eventDispatcher = \OC::$server->getEventDispatcher();
28 28
 $eventDispatcher->addListener(
29
-	'OCA\Files::loadAdditionalScripts',
30
-	function() {
31
-		// FIXME: no public API for these ?
32
-		\OCP\Util::addScript('oc-backbone-webdav');
33
-		\OCP\Util::addScript('systemtags/systemtags');
34
-		\OCP\Util::addScript('systemtags/systemtagmodel');
35
-		\OCP\Util::addScript('systemtags/systemtagsmappingcollection');
36
-		\OCP\Util::addScript('systemtags/systemtagscollection');
37
-		\OCP\Util::addScript('systemtags/systemtagsinputfield');
38
-		\OCP\Util::addScript('systemtags', 'app');
39
-		\OCP\Util::addScript('systemtags', 'systemtagsfilelist');
40
-		\OCP\Util::addScript('systemtags', 'filesplugin');
41
-		\OCP\Util::addScript('systemtags', 'systemtagsinfoview');
42
-		\OCP\Util::addStyle('systemtags');
43
-		\OCP\Util::addStyle('systemtags', 'systemtagsfilelist');
44
-	}
29
+    'OCA\Files::loadAdditionalScripts',
30
+    function() {
31
+        // FIXME: no public API for these ?
32
+        \OCP\Util::addScript('oc-backbone-webdav');
33
+        \OCP\Util::addScript('systemtags/systemtags');
34
+        \OCP\Util::addScript('systemtags/systemtagmodel');
35
+        \OCP\Util::addScript('systemtags/systemtagsmappingcollection');
36
+        \OCP\Util::addScript('systemtags/systemtagscollection');
37
+        \OCP\Util::addScript('systemtags/systemtagsinputfield');
38
+        \OCP\Util::addScript('systemtags', 'app');
39
+        \OCP\Util::addScript('systemtags', 'systemtagsfilelist');
40
+        \OCP\Util::addScript('systemtags', 'filesplugin');
41
+        \OCP\Util::addScript('systemtags', 'systemtagsinfoview');
42
+        \OCP\Util::addStyle('systemtags');
43
+        \OCP\Util::addStyle('systemtags', 'systemtagsfilelist');
44
+    }
45 45
 );
46 46
 
47 47
 $managerListener = function(ManagerEvent $event) {
48
-	$application = new \OCP\AppFramework\App('systemtags');
49
-	/** @var \OCA\SystemTags\Activity\Listener $listener */
50
-	$listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener');
51
-	$listener->event($event);
48
+    $application = new \OCP\AppFramework\App('systemtags');
49
+    /** @var \OCA\SystemTags\Activity\Listener $listener */
50
+    $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener');
51
+    $listener->event($event);
52 52
 };
53 53
 
54 54
 $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener);
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener);
57 57
 
58 58
 $mapperListener = function(MapperEvent $event) {
59
-	$application = new \OCP\AppFramework\App('systemtags');
60
-	/** @var \OCA\SystemTags\Activity\Listener $listener */
61
-	$listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener');
62
-	$listener->mapperEvent($event);
59
+    $application = new \OCP\AppFramework\App('systemtags');
60
+    /** @var \OCA\SystemTags\Activity\Listener $listener */
61
+    $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener');
62
+    $listener->mapperEvent($event);
63 63
 };
64 64
 
65 65
 $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener);
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 $l = \OC::$server->getL10N('systemtags');
69 69
 
70 70
 \OCA\Files\App::getNavigationManager()->add(
71
-	array(
72
-		'id' => 'systemtagsfilter',
73
-		'appname' => 'systemtags',
74
-		'script' => 'list.php',
75
-		'order' => 25,
76
-		'name' => $l->t('Tags')
77
-	)
71
+    array(
72
+        'id' => 'systemtagsfilter',
73
+        'appname' => 'systemtags',
74
+        'script' => 'list.php',
75
+        'order' => 25,
76
+        'name' => $l->t('Tags')
77
+    )
78 78
 );
Please login to merge, or discard this patch.
apps/files_sharing/templates/list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
 		<tr>
16 16
 			<th id='headerName' class="hidden column-name">
17 17
 				<div id="headerName-container">
18
-					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
18
+					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a>
19 19
 				</div>
20 20
 			</th>
21 21
 			<th id="headerDate" class="hidden column-mtime">
22
-				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Share time' )); ?></span><span class="sort-indicator"></span></a>
22
+				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Share time')); ?></span><span class="sort-indicator"></span></a>
23 23
 			</th>
24 24
 			<th class="hidden column-expiration">
25
-				<a class="columntitle"><span><?php p($l->t( 'Expiration date' )); ?></span></a>
25
+				<a class="columntitle"><span><?php p($l->t('Expiration date')); ?></span></a>
26 26
 			</th>
27 27
 		</tr>
28 28
 	</thead>
Please login to merge, or discard this patch.
apps/files_sharing/templates/public.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
 		<div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div>
49 49
 		<div id="header-right">
50 50
 			<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) {
51
-				if ($_['server2serversharing']) {
52
-					?>
51
+                if ($_['server2serversharing']) {
52
+                    ?>
53 53
 					<span id="save" data-protected="<?php p($_['protected']) ?>"
54 54
 						  data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>">
55 55
 					<button id="save-button"><?php p($l->t('Add to your Nextcloud')) ?></button>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,17 +72,23 @@
 block discarded – undo
72 72
 	<div id="preview">
73 73
 			<?php if (isset($_['folder'])): ?>
74 74
 				<?php print_unescaped($_['folder']); ?>
75
-			<?php else: ?>
75
+			<?php else {
76
+    : ?>
76 77
 				<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
77 78
 					<div id="imgframe">
78
-						<video tabindex="0" controls="" preload="none" style="max-width: <?php p($_['previewMaxX']); ?>px; max-height: <?php p($_['previewMaxY']); ?>px">
79
+						<video tabindex="0" controls="" preload="none" style="max-width: <?php p($_['previewMaxX']);
80
+}
81
+?>px; max-height: <?php p($_['previewMaxY']); ?>px">
79 82
 							<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
80 83
 						</video>
81 84
 					</div>
82
-				<?php else: ?>
85
+				<?php else {
86
+    : ?>
83 87
 					<!-- Preview frame is filled via JS to support SVG images for modern browsers -->
84 88
 					<div id="imgframe"></div>
85
-				<?php endif; ?>
89
+				<?php endif;
90
+}
91
+?>
86 92
 				<div class="directDownload">
87 93
 					<a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button primary">
88 94
 						<span class="icon icon-download"></span>
Please login to merge, or discard this patch.
apps/files_sharing/templates/authenticate.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2
-	/** @var $_ array */
3
-	/** @var $l \OCP\IL10N */
4
-	style('files_sharing', 'authenticate');
5
-	script('files_sharing', 'authenticate'); 
2
+    /** @var $_ array */
3
+    /** @var $l \OCP\IL10N */
4
+    style('files_sharing', 'authenticate');
5
+    script('files_sharing', 'authenticate'); 
6 6
 ?>
7 7
 <form method="post">
8 8
 	<fieldset>
Please login to merge, or discard this patch.
apps/files_sharing/ajax/shareinfo.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 OCP\JSON::checkAppEnabled('files_sharing');
31 31
 
32 32
 if (!isset($_GET['t'])) {
33
-	\OC_Response::setStatus(400); //400 Bad Request
34
-	exit;
33
+    \OC_Response::setStatus(400); //400 Bad Request
34
+    exit;
35 35
 }
36 36
 
37 37
 $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application();
38 38
 $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
39 39
 
40 40
 if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false) {
41
-	\OC_Response::setStatus(404); // 404 not found
42
-	exit;
41
+    \OC_Response::setStatus(404); // 404 not found
42
+    exit;
43 43
 }
44 44
 
45 45
 $token = $_GET['t'];
46 46
 
47 47
 $password = null;
48 48
 if (isset($_POST['password'])) {
49
-	$password = $_POST['password'];
49
+    $password = $_POST['password'];
50 50
 }
51 51
 
52 52
 $relativePath = null;
53 53
 if (isset($_GET['dir'])) {
54
-	$relativePath = $_GET['dir'];
54
+    $relativePath = $_GET['dir'];
55 55
 }
56 56
 
57 57
 $data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password);
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 
64 64
 $isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
65 65
 if (!$isWritable) {
66
-	// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
67
-	$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
68
-	\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
69
-		return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
70
-	});
71
-	\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
66
+    // FIXME: should not add storage wrappers outside of preSetup, need to find a better way
67
+    $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
68
+    \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
69
+        return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
70
+    });
71
+    \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
72 72
 }
73 73
 
74 74
 $rootInfo = \OC\Files\Filesystem::getFileInfo($path);
75 75
 $rootView = new \OC\Files\View('');
76 76
 
77 77
 if($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
78
-	OCP\JSON::error(array('data' => 'Share is not readable.'));
79
-	exit();
78
+    OCP\JSON::error(array('data' => 'Share is not readable.'));
79
+    exit();
80 80
 }
81 81
 
82 82
 /**
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
  * @return array
86 86
  */
87 87
 function getChildInfo($dir, $view, $sharePermissions) {
88
-	$children = $view->getDirectoryContent($dir->getPath());
89
-	$result = array();
90
-	foreach ($children as $child) {
91
-		$formatted = \OCA\Files\Helper::formatFileInfo($child);
92
-		if ($child->getType() === 'dir') {
93
-			$formatted['children'] = getChildInfo($child, $view, $sharePermissions);
94
-		}
95
-		$formatted['mtime'] = $formatted['mtime'] / 1000;
96
-		$formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
97
-		$result[] = $formatted;
98
-	}
99
-	return $result;
88
+    $children = $view->getDirectoryContent($dir->getPath());
89
+    $result = array();
90
+    foreach ($children as $child) {
91
+        $formatted = \OCA\Files\Helper::formatFileInfo($child);
92
+        if ($child->getType() === 'dir') {
93
+            $formatted['children'] = getChildInfo($child, $view, $sharePermissions);
94
+        }
95
+        $formatted['mtime'] = $formatted['mtime'] / 1000;
96
+        $formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
97
+        $result[] = $formatted;
98
+    }
99
+    return $result;
100 100
 }
101 101
 
102 102
 $result = \OCA\Files\Helper::formatFileInfo($rootInfo);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 if ($rootInfo->getType() === 'dir') {
108
-	$result['children'] = getChildInfo($rootInfo, $rootView, $share->getPermissions());
108
+    $result['children'] = getChildInfo($rootInfo, $rootView, $share->getPermissions());
109 109
 }
110 110
 
111 111
 OCP\JSON::success(array('data' => $result));
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 if (!$isWritable) {
66 66
 	// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
67 67
 	$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
68
-	\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
68
+	\OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, $storage) {
69 69
 		return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE));
70 70
 	});
71 71
 	\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 $rootInfo = \OC\Files\Filesystem::getFileInfo($path);
75 75
 $rootView = new \OC\Files\View('');
76 76
 
77
-if($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
77
+if ($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
78 78
 	OCP\JSON::error(array('data' => 'Share is not readable.'));
79 79
 	exit();
80 80
 }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$formatted['children'] = getChildInfo($child, $view, $sharePermissions);
94 94
 		}
95 95
 		$formatted['mtime'] = $formatted['mtime'] / 1000;
96
-		$formatted['permissions'] = $sharePermissions & (int)$formatted['permissions'];
96
+		$formatted['permissions'] = $sharePermissions & (int) $formatted['permissions'];
97 97
 		$result[] = $formatted;
98 98
 	}
99 99
 	return $result;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 $result = \OCA\Files\Helper::formatFileInfo($rootInfo);
103 103
 $result['mtime'] = $result['mtime'] / 1000;
104
-$result['permissions'] = (int)$result['permissions'] & $share->getPermissions();
104
+$result['permissions'] = (int) $result['permissions'] & $share->getPermissions();
105 105
 
106 106
 
107 107
 if ($rootInfo->getType() === 'dir') {
Please login to merge, or discard this patch.
apps/files_sharing/lib/Scanner.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -31,52 +31,52 @@
 block discarded – undo
31 31
  * Scanner for SharedStorage
32 32
  */
33 33
 class Scanner extends \OC\Files\Cache\Scanner {
34
-	/**
35
-	 * @var \OCA\Files_Sharing\SharedStorage $storage
36
-	 */
37
-	protected $storage;
34
+    /**
35
+     * @var \OCA\Files_Sharing\SharedStorage $storage
36
+     */
37
+    protected $storage;
38 38
 
39
-	private $sourceScanner;
39
+    private $sourceScanner;
40 40
 
41
-	/**
42
-	 * Returns metadata from the shared storage, but
43
-	 * with permissions from the source storage.
44
-	 *
45
-	 * @param string $path path of the file for which to retrieve metadata
46
-	 *
47
-	 * @return array an array of metadata of the file
48
-	 */
49
-	public function getData($path) {
50
-		$data = parent::getData($path);
51
-		if ($data === null) {
52
-			return null;
53
-		}
54
-		$internalPath = $this->storage->getSourcePath($path);
55
-		$data['permissions'] = $this->storage->getSourceStorage()->getPermissions($internalPath);
56
-		return $data;
57
-	}
41
+    /**
42
+     * Returns metadata from the shared storage, but
43
+     * with permissions from the source storage.
44
+     *
45
+     * @param string $path path of the file for which to retrieve metadata
46
+     *
47
+     * @return array an array of metadata of the file
48
+     */
49
+    public function getData($path) {
50
+        $data = parent::getData($path);
51
+        if ($data === null) {
52
+            return null;
53
+        }
54
+        $internalPath = $this->storage->getSourcePath($path);
55
+        $data['permissions'] = $this->storage->getSourceStorage()->getPermissions($internalPath);
56
+        return $data;
57
+    }
58 58
 
59
-	private function getSourceScanner() {
60
-		if ($this->sourceScanner) {
61
-			return $this->sourceScanner;
62
-		}
63
-		if ($this->storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
64
-			/** @var \OC\Files\Storage\Storage $storage */
65
-			list($storage) = $this->storage->resolvePath('');
66
-			$this->sourceScanner = $storage->getScanner();
67
-			return $this->sourceScanner;
68
-		} else {
69
-			return null;
70
-		}
71
-	}
59
+    private function getSourceScanner() {
60
+        if ($this->sourceScanner) {
61
+            return $this->sourceScanner;
62
+        }
63
+        if ($this->storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) {
64
+            /** @var \OC\Files\Storage\Storage $storage */
65
+            list($storage) = $this->storage->resolvePath('');
66
+            $this->sourceScanner = $storage->getScanner();
67
+            return $this->sourceScanner;
68
+        } else {
69
+            return null;
70
+        }
71
+    }
72 72
 
73
-	public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) {
74
-		$sourceScanner = $this->getSourceScanner();
75
-		if ($sourceScanner instanceof NoopScanner) {
76
-			return [];
77
-		} else {
78
-			return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock);
79
-		}
80
-	}
73
+    public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) {
74
+        $sourceScanner = $this->getSourceScanner();
75
+        if ($sourceScanner instanceof NoopScanner) {
76
+            return [];
77
+        } else {
78
+            return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock);
79
+        }
80
+    }
81 81
 }
82 82
 
Please login to merge, or discard this patch.