From 1e2de86c3ada8599cf6999abc1b1223d2d886430 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 May 2017 14:05:14 +0200 Subject: [PATCH] Fix comparisons in the versions app Signed-off-by: Joas Schilling --- apps/files_versions/lib/Hooks.php | 10 +++++----- apps/files_versions/lib/Storage.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php index 3753d8b501..a9ebb153ef 100644 --- a/apps/files_versions/lib/Hooks.php +++ b/apps/files_versions/lib/Hooks.php @@ -57,7 +57,7 @@ class Hooks { if (\OCP\App::isEnabled('files_versions')) { $path = $params[\OC\Files\Filesystem::signal_param_path]; - if($path<>'') { + if($path !== '') { Storage::store($path); } } @@ -75,7 +75,7 @@ class Hooks { if (\OCP\App::isEnabled('files_versions')) { $path = $params[\OC\Files\Filesystem::signal_param_path]; - if($path<>'') { + if($path !== '') { Storage::delete($path); } } @@ -87,7 +87,7 @@ class Hooks { */ public static function pre_remove_hook($params) { $path = $params[\OC\Files\Filesystem::signal_param_path]; - if($path<>'') { + if($path !== '') { Storage::markDeletedFile($path); } } @@ -104,7 +104,7 @@ class Hooks { if (\OCP\App::isEnabled('files_versions')) { $oldpath = $params['oldpath']; $newpath = $params['newpath']; - if($oldpath<>'' && $newpath<>'') { + if($oldpath !== '' && $newpath !== '') { Storage::renameOrCopy($oldpath, $newpath, 'rename'); } } @@ -122,7 +122,7 @@ class Hooks { if (\OCP\App::isEnabled('files_versions')) { $oldpath = $params['oldpath']; $newpath = $params['newpath']; - if($oldpath<>'' && $newpath<>'') { + if($oldpath !== '' && $newpath !== '') { Storage::renameOrCopy($oldpath, $newpath, 'copy'); } } diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 6e6b6aebb6..ff73b81f57 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -102,7 +102,7 @@ class Storage { $uid = User::getUser(); } Filesystem::initMountPoints($uid); - if ( $uid != User::getUser() ) { + if ( $uid !== User::getUser() ) { $info = Filesystem::getFileInfo($filename); $ownerView = new View('/'.$uid.'/files'); try { @@ -161,7 +161,7 @@ class Storage { * store a new version of a file. */ public static function store($filename) { - if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED) === 'true') { // if the file gets streamed we need to remove the .part extension // to get the right target @@ -320,7 +320,7 @@ class Storage { */ public static function rollback($file, $revision) { - if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') { + if(\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED) === 'true') { // add expected leading slash $file = '/' . ltrim($file, '/'); list($uid, $filename) = self::getUidAndFilename($file); @@ -629,7 +629,7 @@ class Storage { $interval = 1; $step = Storage::$max_versions_per_interval[$interval]['step']; - if (Storage::$max_versions_per_interval[$interval]['intervalEndsAfter'] == -1) { + if (Storage::$max_versions_per_interval[$interval]['intervalEndsAfter'] === -1) { $nextInterval = -1; } else { $nextInterval = $time - Storage::$max_versions_per_interval[$interval]['intervalEndsAfter']; @@ -644,7 +644,7 @@ class Storage { foreach ($versions as $key => $version) { $newInterval = true; while ($newInterval) { - if ($nextInterval == -1 || $prevTimestamp > $nextInterval) { + if ($nextInterval === -1 || $prevTimestamp > $nextInterval) { if ($version['version'] > $nextVersion) { //distance between two version too small, mark to delete $toDelete[$key] = $version['path'] . '.v' . $version['version']; @@ -659,7 +659,7 @@ class Storage { $interval++; $step = Storage::$max_versions_per_interval[$interval]['step']; $nextVersion = $prevTimestamp - $step; - if (Storage::$max_versions_per_interval[$interval]['intervalEndsAfter'] == -1) { + if (Storage::$max_versions_per_interval[$interval]['intervalEndsAfter'] === -1) { $nextInterval = -1; } else { $nextInterval = $time - Storage::$max_versions_per_interval[$interval]['intervalEndsAfter']; @@ -701,7 +701,7 @@ class Storage { $config = \OC::$server->getConfig(); $expiration = self::getExpiration(); - if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' && $expiration->isEnabled()) { + if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED) === 'true' && $expiration->isEnabled()) { // get available disk space for user $user = \OC::$server->getUserManager()->get($uid); if (is_null($user)) {