diff options
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r-- | lib/private/Files/View.php | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 8ea94626a2a..abfde63be5a 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -266,7 +266,7 @@ class View { * for \OC\Files\Storage\Storage via basicOperation(). */ public function mkdir($path) { - return $this->basicOperation('mkdir', $path, array('create', 'write')); + return $this->basicOperation('mkdir', $path, ['create', 'write']); } /** @@ -284,7 +284,7 @@ class View { $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); \OC_Hook::emit( Filesystem::CLASSNAME, "umount", - array(Filesystem::signal_param_path => $relPath) + [Filesystem::signal_param_path => $relPath] ); $this->changeLock($relPath, ILockingProvider::LOCK_EXCLUSIVE, true); $result = $mount->removeMount(); @@ -292,7 +292,7 @@ class View { if ($result) { \OC_Hook::emit( Filesystem::CLASSNAME, "post_umount", - array(Filesystem::signal_param_path => $relPath) + [Filesystem::signal_param_path => $relPath] ); } $this->unlockFile($relPath, ILockingProvider::LOCK_SHARED, true); @@ -345,7 +345,7 @@ class View { return $this->removeMount($mount, $absolutePath); } if ($this->is_dir($path)) { - $result = $this->basicOperation('rmdir', $path, array('delete')); + $result = $this->basicOperation('rmdir', $path, ['delete']); } else { $result = false; } @@ -363,7 +363,7 @@ class View { * @return resource */ public function opendir($path) { - return $this->basicOperation('opendir', $path, array('read')); + return $this->basicOperation('opendir', $path, ['read']); } /** @@ -559,7 +559,7 @@ class View { $mtime = strtotime($mtime); } - $hooks = array('touch'); + $hooks = ['touch']; if (!$this->file_exists($path)) { $hooks[] = 'create'; @@ -581,7 +581,7 @@ class View { $mtime = time(); } //if native touch fails, we emulate it by changing the mtime in the cache - $this->putFileInfo($path, array('mtime' => floor($mtime))); + $this->putFileInfo($path, ['mtime' => floor($mtime)]); } return true; } @@ -592,7 +592,7 @@ class View { * @throws LockedException */ public function file_get_contents($path) { - return $this->basicOperation('file_get_contents', $path, array('read')); + return $this->basicOperation('file_get_contents', $path, ['read']); } /** @@ -602,20 +602,20 @@ class View { */ protected function emit_file_hooks_pre($exists, $path, &$run) { if (!$exists) { - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_create, [ Filesystem::signal_param_path => $this->getHookPath($path), Filesystem::signal_param_run => &$run, - )); + ]); } else { - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_update, [ Filesystem::signal_param_path => $this->getHookPath($path), Filesystem::signal_param_run => &$run, - )); + ]); } - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_write, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_write, [ Filesystem::signal_param_path => $this->getHookPath($path), Filesystem::signal_param_run => &$run, - )); + ]); } /** @@ -624,17 +624,17 @@ class View { */ protected function emit_file_hooks_post($exists, $path) { if (!$exists) { - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_create, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_create, [ Filesystem::signal_param_path => $this->getHookPath($path), - )); + ]); } else { - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_update, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_update, [ Filesystem::signal_param_path => $this->getHookPath($path), - )); + ]); } - \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_write, array( + \OC_Hook::emit(Filesystem::CLASSNAME, Filesystem::signal_post_write, [ Filesystem::signal_param_path => $this->getHookPath($path), - )); + ]); } /** @@ -690,7 +690,7 @@ class View { return false; } } else { - $hooks = $this->file_exists($path) ? array('update', 'write') : array('create', 'write'); + $hooks = $this->file_exists($path) ? ['update', 'write'] : ['create', 'write']; return $this->basicOperation('file_put_contents', $path, $hooks, $data); } } @@ -770,11 +770,11 @@ class View { } elseif ($this->shouldEmitHooks($path1)) { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_rename, - array( + [ Filesystem::signal_param_oldpath => $this->getHookPath($path1), Filesystem::signal_param_newpath => $this->getHookPath($path2), Filesystem::signal_param_run => &$run - ) + ] ); } if ($run) { @@ -844,10 +844,10 @@ class View { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_rename, - array( + [ Filesystem::signal_param_oldpath => $this->getHookPath($path1), Filesystem::signal_param_newpath => $this->getHookPath($path2) - ) + ] ); } } @@ -900,11 +900,11 @@ class View { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_copy, - array( + [ Filesystem::signal_param_oldpath => $this->getHookPath($path1), Filesystem::signal_param_newpath => $this->getHookPath($path2), Filesystem::signal_param_run => &$run - ) + ] ); $this->emit_file_hooks_pre($exists, $path2, $run); } @@ -938,10 +938,10 @@ class View { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_copy, - array( + [ Filesystem::signal_param_oldpath => $this->getHookPath($path1), Filesystem::signal_param_newpath => $this->getHookPath($path2) - ) + ] ); $this->emit_file_hooks_post($exists, $path2); } @@ -968,7 +968,7 @@ class View { */ public function fopen($path, $mode) { $mode = str_replace('b', '', $mode); // the binary flag is a windows only feature which we do not support - $hooks = array(); + $hooks = []; switch ($mode) { case 'r': $hooks[] = 'read'; @@ -1087,7 +1087,7 @@ class View { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_read, - array(Filesystem::signal_param_path => $this->getHookPath($path)) + [Filesystem::signal_param_path => $this->getHookPath($path)] ); } list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); @@ -1270,18 +1270,18 @@ class View { \OC_Hook::emit( Filesystem::CLASSNAME, $prefix . $hook, - array( + [ Filesystem::signal_param_run => &$run, Filesystem::signal_param_path => $path - ) + ] ); } elseif (!$post) { \OC_Hook::emit( Filesystem::CLASSNAME, $prefix . $hook, - array( + [ Filesystem::signal_param_path => $path - ) + ] ); } } @@ -1297,7 +1297,7 @@ class View { * @return bool */ public function hasUpdated($path, $time) { - return $this->basicOperation('hasUpdated', $path, array(), $time); + return $this->basicOperation('hasUpdated', $path, [], $time); } /** @@ -1591,7 +1591,7 @@ class View { * @return FileInfo[] */ public function search($query) { - return $this->searchCommon('search', array('%' . $query . '%')); + return $this->searchCommon('search', ['%' . $query . '%']); } /** @@ -1601,7 +1601,7 @@ class View { * @return FileInfo[] */ public function searchRaw($query) { - return $this->searchCommon('search', array($query)); + return $this->searchCommon('search', [$query]); } /** @@ -1611,7 +1611,7 @@ class View { * @return FileInfo[] */ public function searchByMime($mimetype) { - return $this->searchCommon('searchByMime', array($mimetype)); + return $this->searchCommon('searchByMime', [$mimetype]); } /** @@ -1622,7 +1622,7 @@ class View { * @return FileInfo[] */ public function searchByTag($tag, $userId) { - return $this->searchCommon('searchByTag', array($tag, $userId)); + return $this->searchCommon('searchByTag', [$tag, $userId]); } /** @@ -1631,7 +1631,7 @@ class View { * @return FileInfo[] */ private function searchCommon($method, $args) { - $files = array(); + $files = []; $rootLength = strlen($this->fakeRoot); $mount = $this->getMount(''); @@ -1640,7 +1640,7 @@ class View { if ($storage) { $cache = $storage->getCache(''); - $results = call_user_func_array(array($cache, $method), $args); + $results = call_user_func_array([$cache, $method], $args); foreach ($results as $result) { if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { $internalPath = $result['path']; @@ -1659,7 +1659,7 @@ class View { $cache = $storage->getCache(''); $relativeMountPoint = substr($mountPoint, $rootLength); - $results = call_user_func_array(array($cache, $method), $args); + $results = call_user_func_array([$cache, $method], $args); if ($results) { foreach ($results as $result) { $internalPath = $result['path']; @@ -1881,7 +1881,7 @@ class View { // remove the single file array_pop($parts); - $result = array('/'); + $result = ['/']; $resultPath = ''; foreach ($parts as $part) { if ($part) { |