Compare commits

...

1 Commits

Author SHA1 Message Date
Git'Fellow a1654ae274 refactor: use strict operator 2026-01-29 11:32:56 +01:00
14 changed files with 26 additions and 26 deletions
+4 -4
View File
@@ -117,8 +117,8 @@ class OC {
if (substr($scriptName, -1) == '/') {
$scriptName .= 'index.php';
//make sure suburi follows the same rules as scriptName
if (substr(OC::$SUBURI, -9) != 'index.php') {
if (substr(OC::$SUBURI, -1) != '/') {
if (substr(OC::$SUBURI, -9) !== 'index.php') {
if (substr(OC::$SUBURI, -1) !== '/') {
OC::$SUBURI = OC::$SUBURI . '/';
}
OC::$SUBURI = OC::$SUBURI . 'index.php';
@@ -131,7 +131,7 @@ class OC {
if (substr($scriptName, 0 - strlen(OC::$SUBURI)) === OC::$SUBURI) {
OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
if (OC::$WEBROOT !== '' && OC::$WEBROOT[0] !== '/') {
OC::$WEBROOT = '/' . OC::$WEBROOT;
}
} else {
@@ -236,7 +236,7 @@ class OC {
public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): void {
// Allow ajax update script to execute without being stopped
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') {
if (((bool)$systemConfig->getValue('maintenance', false)) && OC::$SUBURI !== '/core/ajax/update.php') {
// send http status 503
http_response_code(503);
header('X-Nextcloud-Maintenance-Mode: 1');
+3 -3
View File
@@ -195,7 +195,7 @@ class AppManager implements IAppManager {
if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
if (
$file[0] != '.'
$file[0] !== '.'
&& is_dir($apps_dir['path'] . '/' . $file)
&& is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')
) {
@@ -711,7 +711,7 @@ class AppManager implements IAppManager {
return __DIR__ . '/../../../core';
}
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) != false) {
if (($dir = $this->findAppInDirectories($appId, $ignoreCache)) !== false) {
return $dir['path'] . '/' . $appId;
}
throw new AppPathNotFoundException('Could not find path for ' . $appId);
@@ -723,7 +723,7 @@ class AppManager implements IAppManager {
* @throws AppPathNotFoundException if app path can't be found
*/
public function getAppWebPath(string $appId): string {
if (($dir = $this->findAppInDirectories($appId)) != false) {
if (($dir = $this->findAppInDirectories($appId)) !== false) {
return \OC::$WEBROOT . $dir['url'] . '/' . $appId;
}
throw new AppPathNotFoundException('Could not find web path for ' . $appId);
@@ -183,7 +183,7 @@ class ContactsStore implements IContactsStore {
$decodedExcludeGroups = json_decode($excludedGroups, true);
$excludeGroupsList = $decodedExcludeGroups ?? [];
if ($excludeGroups != 'allow') {
if ($excludeGroups !== 'allow') {
if (count($selfGroups) > 0 && count(array_diff($selfGroups, $excludeGroupsList)) === 0) {
// all the groups of the current user are excluded -> filter all local users
$skipLocal = true;
+1 -1
View File
@@ -533,7 +533,7 @@ class Cache implements ICache {
* @return bool
*/
public function inCache($file) {
return $this->getId($file) != -1;
return $this->getId($file) !== -1;
}
/**
+1 -1
View File
@@ -275,7 +275,7 @@ class Updater implements IUpdater {
private function correctParentStorageMtime($internalPath) {
$parentId = $this->cache->getParentId($internalPath);
$parent = dirname($internalPath);
if ($parentId != -1) {
if ($parentId !== -1) {
$mtime = $this->storage->filemtime($parent);
if ($mtime !== false) {
try {
+1 -1
View File
@@ -236,7 +236,7 @@ class MountPoint implements IMountPoint {
public function wrapStorage($wrapper) {
$storage = $this->getStorage();
// storage can be null if it couldn't be initialized
if ($storage != null) {
if ($storage !== null) {
$this->storage = $wrapper($this->mountPoint, $storage, $this);
}
}
@@ -161,7 +161,7 @@ trait S3ObjectTrait {
$totalWritten += $command['ContentLength'];
},
'before_complete' => function ($_command) use (&$totalWritten, $size, &$uploader, &$attempts) {
if ($size !== null && $totalWritten != $size) {
if ($size !== null && $totalWritten !== $size) {
$e = new \Exception('Incomplete multi part upload, expected ' . $size . ' bytes, wrote ' . $totalWritten);
throw new MultipartUploadException($uploader->getState(), $e);
}
+1 -1
View File
@@ -631,7 +631,7 @@ class Installer {
}
$files = scandir($src);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
$this->copyRecursive("$src/$file", "$dest/$file");
}
}
+2 -2
View File
@@ -51,7 +51,7 @@ class File extends LogDetails implements IWriter, IFileBased {
public function write(string $app, $message, int $level): void {
$entry = $this->logDetailsAsJSON($app, $message, $level);
$handle = @fopen($this->logFile, 'a');
if ($this->logFileMode > 0 && is_file($this->logFile) && (fileperms($this->logFile) & 0777) != $this->logFileMode) {
if ($this->logFileMode > 0 && is_file($this->logFile) && (fileperms($this->logFile) & 0777) !== $this->logFileMode) {
@chmod($this->logFile, $this->logFileMode);
}
if ($handle) {
@@ -87,7 +87,7 @@ class File extends LogDetails implements IWriter, IFileBased {
fseek($handle, $pos);
$ch = fgetc($handle);
if ($ch == "\n" || $pos == 0) {
if ($line != '') {
if ($line !== '') {
// Add the first character if at the start of the file,
// because it doesn't hit the else in the loop
if ($pos == 0) {
+1 -1
View File
@@ -49,7 +49,7 @@ class CertificateManager implements ICertificateManager {
return [];
}
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
try {
$content = $this->view->file_get_contents($path . $file);
if ($content !== false) {
+4 -4
View File
@@ -780,7 +780,7 @@ class Manager implements IManager {
if ($share->getShareType() === IShare::TYPE_USER) {
$this->userCreateChecks($share);
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
if ($share->getExpirationDate() !== $originalShare->getExpirationDate()) {
// Verify the expiration date
$this->validateExpirationDateInternal($share);
$expirationDateUpdated = true;
@@ -788,7 +788,7 @@ class Manager implements IManager {
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$this->groupCreateChecks($share);
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
if ($share->getExpirationDate() !== $originalShare->getExpirationDate()) {
// Verify the expiration date
$this->validateExpirationDateInternal($share);
$expirationDateUpdated = true;
@@ -824,13 +824,13 @@ class Manager implements IManager {
}
}
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
if ($share->getExpirationDate() !== $originalShare->getExpirationDate()) {
// Verify the expiration date
$this->validateExpirationDateLink($share);
$expirationDateUpdated = true;
}
} elseif ($share->getShareType() === IShare::TYPE_REMOTE || $share->getShareType() === IShare::TYPE_REMOTE_GROUP) {
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
if ($share->getExpirationDate() !== $originalShare->getExpirationDate()) {
// Verify the expiration date
$this->validateExpirationDateInternal($share);
$expirationDateUpdated = true;
+1 -1
View File
@@ -217,7 +217,7 @@ class TemplateLayout {
// Add the js files
$jsFiles = $this->findJavascriptFiles(Util::getScripts());
$page->assign('jsfiles', []);
if ($this->config->getSystemValueBool('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) {
if ($this->config->getSystemValueBool('installed', false) && $renderAs !== TemplateResponse::RENDER_AS_ERROR) {
// this is on purpose outside of the if statement below so that the initial state is prefilled (done in the getConfig() call)
// see https://github.com/nextcloud/server/pull/22636 for details
$jsConfigHelper = new JSConfigHelper(
+2 -2
View File
@@ -53,7 +53,7 @@ class OC_Helper {
}
$files = scandir($src);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
self::copyr("$src/$file", "$dest/$file");
}
}
@@ -87,7 +87,7 @@ class OC_Helper {
$dirs = explode(PATH_SEPARATOR, (string)$path);
// WARNING : We have to check if open_basedir is enabled :
$obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir');
if ($obd != 'none') {
if ($obd !== 'none') {
$obd_values = explode(PATH_SEPARATOR, $obd);
if (count($obd_values) > 0 && $obd_values[0]) {
// open_basedir is in effect !
+3 -3
View File
@@ -263,7 +263,7 @@ class Util {
$urlGenerator = \OCP\Server::get(IURLGenerator::class);
$remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service;
return $urlGenerator->getAbsoluteURL(
$remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '')
$remoteBase . (($service[strlen($service) - 1] !== '/') ? '/' : '')
);
}
@@ -276,7 +276,7 @@ class Util {
$host_name = \OCP\Server::get(IRequest::class)->getServerHost();
// strip away port number (if existing)
$colon_pos = strpos($host_name, ':');
if ($colon_pos != false) {
if ($colon_pos !== false) {
$host_name = substr($host_name, 0, $colon_pos);
}
return $host_name;
@@ -491,7 +491,7 @@ class Util {
* @since 4.5.0
*/
public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
$case = ($case != MB_CASE_UPPER) ? MB_CASE_LOWER : MB_CASE_UPPER;
$case = ($case !== MB_CASE_UPPER) ? MB_CASE_LOWER : MB_CASE_UPPER;
$ret = [];
foreach ($input as $k => $v) {
$ret[mb_convert_case($k, $case, $encoding)] = $v;