Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public static function initPaths(): void {
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';
Expand All @@ -131,7 +131,7 @@ public static function initPaths(): void {
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 {
Expand Down Expand Up @@ -236,7 +236,7 @@ public static function checkInstalled(\OC\SystemConfig $systemConfig): void {

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');
Expand Down
6 changes: 3 additions & 3 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function getAllAppsInAppsFolders(): array {
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')
) {
Expand Down Expand Up @@ -711,7 +711,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
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);
Expand All @@ -723,7 +723,7 @@ public function getAppPath(string $appId, bool $ignoreCache = false): string {
* @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);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Contacts/ContactsMenu/ContactsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private function filterContacts(
$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;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ private function getParentPath($path) {
* @return bool
*/
public function inCache($file) {
return $this->getId($file) != -1;
return $this->getId($file) !== -1;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function updateStorageMTimeOnly($internalPath) {
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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function formatPath($path) {
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, array $m
$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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ private function copyRecursive(string $src, string $dest): void {
}
$files = scandir($src);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
$this->copyRecursive("$src/$file", "$dest/$file");
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Log/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
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) {
Expand Down Expand Up @@ -87,7 +87,7 @@ public function getEntries(int $limit = 50, int $offset = 0): array {
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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Security/CertificateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function listCertificates(): array {
return [];
}
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
try {
$content = $this->view->file_get_contents($path . $file);
if ($content !== false) {
Expand Down
8 changes: 4 additions & 4 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,15 @@ public function updateShare(IShare $share, bool $onlyValid = true): IShare {
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;
}
} 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;
Expand Down Expand Up @@ -824,13 +824,13 @@ public function updateShare(IShare $share, bool $onlyValid = true): IShare {
}
}

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;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function getPageTemplate(string $renderAs, string $appId): ITemplate {
// 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(
Expand Down
4 changes: 2 additions & 2 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function copyr($src, $dest) {
}
$files = scandir($src);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
self::copyr("$src/$file", "$dest/$file");
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ public static function canExecute($name, $path = false) {
$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 !
Expand Down
6 changes: 3 additions & 3 deletions lib/public/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public static function linkToRemote($service) {
$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] !== '/') ? '/' : '')
);
}

Expand All @@ -276,7 +276,7 @@ public static function getServerHostName() {
$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;
Expand Down Expand Up @@ -491,7 +491,7 @@ public static function encodePath($component) {
* @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;
Expand Down
Loading