aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/Local.php
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-11-21 08:38:50 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-11-21 10:02:00 +0100
commit60d956f39f6226dcd66e800844834dc9f3614ce7 (patch)
treef3d7daf0d33f94a2065768a20355681ae35ed165 /lib/private/Files/Storage/Local.php
parentcbb937fa3260c6a445e5027fee288bd01380ddd1 (diff)
downloadnextcloud-server-refactSmallAdjust.tar.gz
nextcloud-server-refactSmallAdjust.zip
refactor(storage): Code adjustements and simplificationsrefactSmallAdjust
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'lib/private/Files/Storage/Local.php')
-rw-r--r--lib/private/Files/Storage/Local.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index f06e409cd8f..260f9218a88 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -17,6 +17,7 @@ use OCP\Files\IMimeTypeDetector;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IConfig;
+use OCP\Server;
use OCP\Util;
use Psr\Log\LoggerInterface;
@@ -56,8 +57,8 @@ class Local extends \OC\Files\Storage\Common {
$this->datadir .= '/';
}
$this->dataDirLength = strlen($this->realDataDir);
- $this->config = \OC::$server->get(IConfig::class);
- $this->mimeTypeDetector = \OC::$server->get(IMimeTypeDetector::class);
+ $this->config = Server::get(IConfig::class);
+ $this->mimeTypeDetector = Server::get(IMimeTypeDetector::class);
$this->defUMask = $this->config->getSystemValue('localstorage.umask', 0022);
$this->caseInsensitive = $this->config->getSystemValueBool('localstorage.case_insensitive', false);
@@ -272,7 +273,7 @@ class Local extends \OC\Files\Storage\Common {
// sets the modification time of the file to the given value.
// If mtime is nil the current time is set.
// note that the access time of the file always changes to the current time.
- if ($this->file_exists($path) and !$this->isUpdatable($path)) {
+ if ($this->file_exists($path) && !$this->isUpdatable($path)) {
return false;
}
$oldMask = umask($this->defUMask);
@@ -328,17 +329,17 @@ class Local extends \OC\Files\Storage\Common {
$dstParent = dirname($target);
if (!$this->isUpdatable($srcParent)) {
- \OC::$server->get(LoggerInterface::class)->error('unable to rename, source directory is not writable : ' . $srcParent, ['app' => 'core']);
+ Server::get(LoggerInterface::class)->error('unable to rename, source directory is not writable : ' . $srcParent, ['app' => 'core']);
return false;
}
if (!$this->isUpdatable($dstParent)) {
- \OC::$server->get(LoggerInterface::class)->error('unable to rename, destination directory is not writable : ' . $dstParent, ['app' => 'core']);
+ Server::get(LoggerInterface::class)->error('unable to rename, destination directory is not writable : ' . $dstParent, ['app' => 'core']);
return false;
}
if (!$this->file_exists($source)) {
- \OC::$server->get(LoggerInterface::class)->error('unable to rename, file does not exists : ' . $source, ['app' => 'core']);
+ Server::get(LoggerInterface::class)->error('unable to rename, file does not exists : ' . $source, ['app' => 'core']);
return false;
}
@@ -487,7 +488,7 @@ class Local extends \OC\Files\Storage\Common {
return $fullPath;
}
- \OC::$server->get(LoggerInterface::class)->error("Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", ['app' => 'core']);
+ Server::get(LoggerInterface::class)->error("Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", ['app' => 'core']);
throw new ForbiddenException('Following symlinks is not allowed', false);
}