diff options
Diffstat (limited to 'lib/private/Files/Cache')
-rw-r--r-- | lib/private/Files/Cache/HomeCache.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 32 | ||||
-rw-r--r-- | lib/private/Files/Cache/Storage.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/Updater.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Cache/Watcher.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheWrapper.php | 8 |
7 files changed, 30 insertions, 30 deletions
diff --git a/lib/private/Files/Cache/HomeCache.php b/lib/private/Files/Cache/HomeCache.php index ec3c8df519d..0691c1d1e44 100644 --- a/lib/private/Files/Cache/HomeCache.php +++ b/lib/private/Files/Cache/HomeCache.php @@ -54,14 +54,14 @@ class HomeCache extends Cache { $sql = 'SELECT SUM(`size`) AS f1 ' . 'FROM `*PREFIX*filecache` ' . 'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0'; - $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); + $result = \OC_DB::executeAudited($sql, [$id, $this->getNumericStorageId()]); if ($row = $result->fetchRow()) { $result->closeCursor(); list($sum) = array_values($row); $totalSize = 0 + $sum; $entry['size'] += 0; if ($entry['size'] !== $totalSize) { - $this->update($id, array('size' => $totalSize)); + $this->update($id, ['size' => $totalSize]); } } } diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 30688a8da3e..b481a9918b9 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -164,8 +164,8 @@ class Scanner extends BasicEmitter implements IScanner { // pre-emit only if it was a file. By that we avoid counting/treating folders as files if ($data['mimetype'] !== 'httpd/unix-directory') { - $this->emit('\OC\Files\Cache\Scanner', 'scanFile', array($file, $this->storageId)); - \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); + $this->emit('\OC\Files\Cache\Scanner', 'scanFile', [$file, $this->storageId]); + \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', ['path' => $file, 'storage' => $this->storageId]); } $parent = dirname($file); @@ -233,8 +233,8 @@ class Scanner extends BasicEmitter implements IScanner { // post-emit only if it was a file. By that we avoid counting/treating folders as files if ($data['mimetype'] !== 'httpd/unix-directory') { - $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId)); - \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId)); + $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', [$file, $this->storageId]); + \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', ['path' => $file, 'storage' => $this->storageId]); } } else { @@ -266,8 +266,8 @@ class Scanner extends BasicEmitter implements IScanner { } protected function removeFromCache($path) { - \OC_Hook::emit('Scanner', 'removeFromCache', array('file' => $path)); - $this->emit('\OC\Files\Cache\Scanner', 'removeFromCache', array($path)); + \OC_Hook::emit('Scanner', 'removeFromCache', ['file' => $path]); + $this->emit('\OC\Files\Cache\Scanner', 'removeFromCache', [$path]); if ($this->cacheActive) { $this->cache->remove($path); } @@ -283,8 +283,8 @@ class Scanner extends BasicEmitter implements IScanner { if (isset($data['scan_permissions'])) { $data['permissions'] = $data['scan_permissions']; } - \OC_Hook::emit('Scanner', 'addToCache', array('file' => $path, 'data' => $data)); - $this->emit('\OC\Files\Cache\Scanner', 'addToCache', array($path, $this->storageId, $data)); + \OC_Hook::emit('Scanner', 'addToCache', ['file' => $path, 'data' => $data]); + $this->emit('\OC\Files\Cache\Scanner', 'addToCache', [$path, $this->storageId, $data]); if ($this->cacheActive) { if ($fileId !== -1) { $this->cache->update($fileId, $data); @@ -303,8 +303,8 @@ class Scanner extends BasicEmitter implements IScanner { * @param int $fileId */ protected function updateCache($path, $data, $fileId = -1) { - \OC_Hook::emit('Scanner', 'addToCache', array('file' => $path, 'data' => $data)); - $this->emit('\OC\Files\Cache\Scanner', 'updateCache', array($path, $this->storageId, $data)); + \OC_Hook::emit('Scanner', 'addToCache', ['file' => $path, 'data' => $data]); + $this->emit('\OC\Files\Cache\Scanner', 'updateCache', [$path, $this->storageId, $data]); if ($this->cacheActive) { if ($fileId !== -1) { $this->cache->update($fileId, $data); @@ -357,7 +357,7 @@ class Scanner extends BasicEmitter implements IScanner { * @return array[] */ protected function getExistingChildren($folderId) { - $existingChildren = array(); + $existingChildren = []; $children = $this->cache->getFolderContentsById($folderId); foreach ($children as $child) { $existingChildren[$child['name']] = $child; @@ -372,7 +372,7 @@ class Scanner extends BasicEmitter implements IScanner { * @return string[] */ protected function getNewChildren($folder) { - $children = array(); + $children = []; if ($dh = $this->storage->opendir($folder)) { if (is_resource($dh)) { while (($file = readdir($dh)) !== false) { @@ -399,7 +399,7 @@ class Scanner extends BasicEmitter implements IScanner { if ($reuse === -1) { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; } - $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId)); + $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', [$path, $this->storageId]); $size = 0; if (!is_null($folderId)) { $folderId = $this->cache->getId($path); @@ -415,9 +415,9 @@ class Scanner extends BasicEmitter implements IScanner { } } if ($this->cacheActive) { - $this->cache->update($folderId, array('size' => $size)); + $this->cache->update($folderId, ['size' => $size]); } - $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', array($path, $this->storageId)); + $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', [$path, $this->storageId]); return $size; } @@ -531,7 +531,7 @@ class Scanner extends BasicEmitter implements IScanner { private function runBackgroundScanJob(callable $callback, $path) { try { $callback(); - \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path)); + \OC_Hook::emit('Scanner', 'correctFolderSize', ['path' => $path]); if ($this->cacheActive && $this->cache instanceof Cache) { $this->cache->correctFolderSize($path, null, true); } diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 13af41acfea..439ed30890c 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -127,7 +127,7 @@ class Storage { public static function getStorageId($numericId) { $sql = 'SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?'; - $result = \OC_DB::executeAudited($sql, array($numericId)); + $result = \OC_DB::executeAudited($sql, [$numericId]); if ($row = $result->fetchRow()) { return $row['id']; } else { @@ -194,11 +194,11 @@ class Storage { $storageId = self::adjustStorageId($storageId); $numericId = self::getNumericStorageId($storageId); $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?'; - \OC_DB::executeAudited($sql, array($storageId)); + \OC_DB::executeAudited($sql, [$storageId]); if (!is_null($numericId)) { $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?'; - \OC_DB::executeAudited($sql, array($numericId)); + \OC_DB::executeAudited($sql, [$numericId]); } } } diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index 59cff9b3a41..b093b591d4e 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -247,7 +247,7 @@ class Updater implements IUpdater { if ($parentId != -1) { $mtime = $this->storage->filemtime($parent); if ($mtime !== false) { - $this->cache->update($parentId, array('storage_mtime' => $mtime)); + $this->cache->update($parentId, ['storage_mtime' => $mtime]); } } } diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index beb49ff2d65..884054c9a02 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -35,7 +35,7 @@ class Watcher implements IWatcher { protected $watchPolicy = self::CHECK_ONCE; - protected $checkedPaths = array(); + protected $checkedPaths = []; /** * @var \OC\Files\Storage\Storage $storage diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 92601e38d13..e2ed62b4444 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -209,9 +209,9 @@ class CacheJail extends CacheWrapper { } private function formatSearchResults($results) { - $results = array_filter($results, array($this, 'filterCacheEntry')); + $results = array_filter($results, [$this, 'filterCacheEntry']); $results = array_values($results); - return array_map(array($this, 'formatCacheEntry'), $results); + return array_map([$this, 'formatCacheEntry'], $results); } /** @@ -282,7 +282,7 @@ class CacheJail extends CacheWrapper { */ public function getAll() { // not supported - return array(); + return []; } /** diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php index 40bac888673..27aa203655b 100644 --- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php +++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php @@ -96,7 +96,7 @@ class CacheWrapper extends Cache { */ public function getFolderContentsById($fileId) { $results = $this->getCache()->getFolderContentsById($fileId); - return array_map(array($this, 'formatCacheEntry'), $results); + return array_map([$this, 'formatCacheEntry'], $results); } /** @@ -223,7 +223,7 @@ class CacheWrapper extends Cache { */ public function search($pattern) { $results = $this->getCache()->search($pattern); - return array_map(array($this, 'formatCacheEntry'), $results); + return array_map([$this, 'formatCacheEntry'], $results); } /** @@ -234,12 +234,12 @@ class CacheWrapper extends Cache { */ public function searchByMime($mimetype) { $results = $this->getCache()->searchByMime($mimetype); - return array_map(array($this, 'formatCacheEntry'), $results); + return array_map([$this, 'formatCacheEntry'], $results); } public function searchQuery(ISearchQuery $query) { $results = $this->getCache()->searchQuery($query); - return array_map(array($this, 'formatCacheEntry'), $results); + return array_map([$this, 'formatCacheEntry'], $results); } /** |