Fix comparisons in the versions app

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-05-10 14:05:14 +02:00 committed by Morris Jobke
parent 89238164e1
commit 1e2de86c3a
2 changed files with 12 additions and 12 deletions

View File

@ -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');
}
}

View File

@ -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)) {