aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r--apps/files_versions/lib/Command/CleanUp.php2
-rw-r--r--apps/files_versions/lib/Command/ExpireVersions.php2
-rw-r--r--apps/files_versions/lib/Db/VersionsMapper.php22
-rw-r--r--apps/files_versions/lib/Listener/VersionStorageMoveListener.php2
-rw-r--r--apps/files_versions/lib/Migration/Version1020Date20221114144058.php4
-rw-r--r--apps/files_versions/lib/Sabre/Plugin.php2
-rw-r--r--apps/files_versions/lib/Storage.php26
-rw-r--r--apps/files_versions/lib/Versions/LegacyVersionsBackend.php8
-rw-r--r--apps/files_versions/lib/Versions/VersionManager.php4
9 files changed, 36 insertions, 36 deletions
diff --git a/apps/files_versions/lib/Command/CleanUp.php b/apps/files_versions/lib/Command/CleanUp.php
index bf6dc6a7687..1cd3dccc4dd 100644
--- a/apps/files_versions/lib/Command/CleanUp.php
+++ b/apps/files_versions/lib/Command/CleanUp.php
@@ -49,7 +49,7 @@ class CleanUp extends Command {
$path = $input->getOption('path');
if ($path) {
if (!preg_match('#^/([^/]+)/files(/.*)?$#', $path, $pathMatches)) {
- $output->writeln("<error>Invalid path given</error>");
+ $output->writeln('<error>Invalid path given</error>');
return self::FAILURE;
}
diff --git a/apps/files_versions/lib/Command/ExpireVersions.php b/apps/files_versions/lib/Command/ExpireVersions.php
index 9492d0fbe7d..f8f4e7ce952 100644
--- a/apps/files_versions/lib/Command/ExpireVersions.php
+++ b/apps/files_versions/lib/Command/ExpireVersions.php
@@ -38,7 +38,7 @@ class ExpireVersions extends Command {
protected function execute(InputInterface $input, OutputInterface $output): int {
$maxAge = $this->expiration->getMaxAgeAsTimestamp();
if (!$maxAge) {
- $output->writeln("Auto expiration is configured - expiration will be handled automatically according to the expiration patterns detailed at the following link https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html.");
+ $output->writeln('Auto expiration is configured - expiration will be handled automatically according to the expiration patterns detailed at the following link https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html.');
return self::FAILURE;
}
diff --git a/apps/files_versions/lib/Db/VersionsMapper.php b/apps/files_versions/lib/Db/VersionsMapper.php
index 289e5ce7b7e..318dd8f0d82 100644
--- a/apps/files_versions/lib/Db/VersionsMapper.php
+++ b/apps/files_versions/lib/Db/VersionsMapper.php
@@ -28,8 +28,8 @@ class VersionsMapper extends QBMapper {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
- ->from($this->getTableName())
- ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)));
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)));
return $this->findEntities($qb);
}
@@ -41,10 +41,10 @@ class VersionsMapper extends QBMapper {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
- ->from($this->getTableName())
- ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
- ->orderBy('timestamp', 'DESC')
- ->setMaxResults(1);
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
+ ->orderBy('timestamp', 'DESC')
+ ->setMaxResults(1);
return $this->findEntity($qb);
}
@@ -53,9 +53,9 @@ class VersionsMapper extends QBMapper {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
- ->from($this->getTableName())
- ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
- ->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp)));
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
+ ->andWhere($qb->expr()->eq('timestamp', $qb->createNamedParameter($timestamp)));
return $this->findEntity($qb);
}
@@ -64,8 +64,8 @@ class VersionsMapper extends QBMapper {
$qb = $this->db->getQueryBuilder();
return $qb->delete($this->getTableName())
- ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
- ->executeStatement();
+ ->where($qb->expr()->eq('file_id', $qb->createNamedParameter($fileId)))
+ ->executeStatement();
}
public function deleteAllVersionsForUser(int $storageId, ?string $path = null): void {
diff --git a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php
index b4b00108e43..0f7dad29fe2 100644
--- a/apps/files_versions/lib/Listener/VersionStorageMoveListener.php
+++ b/apps/files_versions/lib/Listener/VersionStorageMoveListener.php
@@ -64,7 +64,7 @@ class VersionStorageMoveListener implements IEventListener {
$user = $this->userSession->getUser() ?? $source->getOwner();
if ($user === null) {
- throw new Exception("Cannot move versions across storages without a user.");
+ throw new Exception('Cannot move versions across storages without a user.');
}
if ($event instanceof BeforeNodeRenamedEvent) {
diff --git a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php
index 71bfeab0a02..77c8c2201f3 100644
--- a/apps/files_versions/lib/Migration/Version1020Date20221114144058.php
+++ b/apps/files_versions/lib/Migration/Version1020Date20221114144058.php
@@ -29,11 +29,11 @@ class Version1020Date20221114144058 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
- if ($schema->hasTable("files_versions")) {
+ if ($schema->hasTable('files_versions')) {
return null;
}
- $table = $schema->createTable("files_versions");
+ $table = $schema->createTable('files_versions');
$table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
diff --git a/apps/files_versions/lib/Sabre/Plugin.php b/apps/files_versions/lib/Sabre/Plugin.php
index c2ffcdebe47..10a1896773d 100644
--- a/apps/files_versions/lib/Sabre/Plugin.php
+++ b/apps/files_versions/lib/Sabre/Plugin.php
@@ -77,7 +77,7 @@ class Plugin extends ServerPlugin {
public function propFind(PropFind $propFind, INode $node): void {
if ($node instanceof VersionFile) {
$propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue('label'));
- $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue("author"));
+ $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue('author'));
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType()));
}
}
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index d3e080b9dd2..41f04b5a1d1 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -276,9 +276,9 @@ class Storage {
* Rename or copy versions of a file of the given paths
*
* @param string $sourcePath source path of the file to move, relative to
- * the currently logged in user's "files" folder
+ * the currently logged in user's "files" folder
* @param string $targetPath target path of the file to move, relative to
- * the currently logged in user's "files" folder
+ * the currently logged in user's "files" folder
* @param string $operation can be 'copy' or 'rename'
*/
public static function renameOrCopy($sourcePath, $targetPath, $operation) {
@@ -572,7 +572,7 @@ class Storage {
} catch (NotFoundException $e) {
// Original node not found, delete the version
return true;
- } catch (StorageNotAvailableException | StorageInvalidException $e) {
+ } catch (StorageNotAvailableException|StorageInvalidException $e) {
// Storage can't be used, but it might only be temporary so we can't always delete the version
// since we can't determine if the version is named we take the safe route and don't expire
return false;
@@ -613,19 +613,19 @@ class Storage {
$diff = time() - $timestamp;
if ($diff < 60) { // first minute
- return $diff . " seconds ago";
+ return $diff . ' seconds ago';
} elseif ($diff < 3600) { //first hour
- return round($diff / 60) . " minutes ago";
+ return round($diff / 60) . ' minutes ago';
} elseif ($diff < 86400) { // first day
- return round($diff / 3600) . " hours ago";
+ return round($diff / 3600) . ' hours ago';
} elseif ($diff < 604800) { //first week
- return round($diff / 86400) . " days ago";
+ return round($diff / 86400) . ' days ago';
} elseif ($diff < 2419200) { //first month
- return round($diff / 604800) . " weeks ago";
+ return round($diff / 604800) . ' weeks ago';
} elseif ($diff < 29030400) { // first year
- return round($diff / 2419200) . " months ago";
+ return round($diff / 2419200) . ' months ago';
} else {
- return round($diff / 29030400) . " years ago";
+ return round($diff / 29030400) . ' years ago';
}
}
@@ -753,7 +753,7 @@ class Storage {
//distance between two version too small, mark to delete
$toDelete[$key] = $version['path'] . '.v' . $version['version'];
$size += $version['size'];
- \OC::$server->get(LoggerInterface::class)->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']);
+ \OC::$server->get(LoggerInterface::class)->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . ' or smaller. (prevTimestamp: ' . $prevTimestamp . '; step: ' . $step, ['app' => 'files_versions']);
} else {
$nextVersion = $version['version'] - $step;
$prevTimestamp = $version['version'];
@@ -946,13 +946,13 @@ class Storage {
* that match the given path to a file.
*
* @param string $filename $path to a file, relative to the user's
- * "files" folder
+ * "files" folder
* @param View $view view on data/user/
*/
public static function createMissingDirectories($filename, $view) {
$dirname = Filesystem::normalizePath(dirname($filename));
$dirParts = explode('/', $dirname);
- $dir = "/files_versions";
+ $dir = '/files_versions';
foreach ($dirParts as $part) {
$dir = $dir . '/' . $part;
if (!$view->file_exists($dir)) {
diff --git a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
index 90e521abfb4..fc37ecead95 100644
--- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
+++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php
@@ -65,7 +65,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
$file = $userFolder->getFirstNodeById($fileId);
if (!$file) {
- throw new NotFoundException("version file not found for share owner");
+ throw new NotFoundException('version file not found for share owner');
}
} else {
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
@@ -276,7 +276,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
$currentUserId = $this->userSession->getUser()?->getUID();
if ($currentUserId === null) {
- throw new NotFoundException("No user logged in");
+ throw new NotFoundException('No user logged in');
}
if ($sourceFile->getOwner()?->getUID() === $currentUserId) {
@@ -286,7 +286,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
$nodes = $this->rootFolder->getUserFolder($currentUserId)->getById($sourceFile->getId());
if (count($nodes) === 0) {
- throw new NotFoundException("Version file not accessible by current user");
+ throw new NotFoundException('Version file not accessible by current user');
}
foreach ($nodes as $node) {
@@ -366,7 +366,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
$relativePath = $userFolder->getRelativePath($source->getPath());
if ($relativePath === null) {
- throw new Exception("Relative path not found for node with path: " . $source->getPath());
+ throw new Exception('Relative path not found for node with path: ' . $source->getPath());
}
$versions = Storage::getVersions($user->getUID(), $relativePath);
diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php
index c666192f3c0..0b8e066baeb 100644
--- a/apps/files_versions/lib/Versions/VersionManager.php
+++ b/apps/files_versions/lib/Versions/VersionManager.php
@@ -167,8 +167,8 @@ class VersionManager implements IVersionManager, IDeletableVersionBackend, INeed
try {
return $callback();
} catch (ManuallyLockedException $e) {
- $owner = (string) $e->getOwner();
- $appsThatHandleUpdates = ["text", "richdocuments"];
+ $owner = (string)$e->getOwner();
+ $appsThatHandleUpdates = ['text', 'richdocuments'];
if (!in_array($owner, $appsThatHandleUpdates)) {
throw $e;
}