summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorEduardo Morales <emoral435@gmail.com>2024-03-11 08:11:53 -0500
committerEduardo Morales <emoral435@gmail.com>2024-03-11 15:57:12 -0500
commita8844d408b2b48ecfac40d33d1582e24bf5b48a4 (patch)
treecb5ec1bbc3df6247d446078843b15797ff202285 /apps/files_versions
parent4cf4fdc2785d2ed634e0e23697847f9e58fa99d5 (diff)
downloadnextcloud-server-a8844d408b2b48ecfac40d33d1582e24bf5b48a4.tar.gz
nextcloud-server-a8844d408b2b48ecfac40d33d1582e24bf5b48a4.zip
fix(files_version): deprecated INameableVersion
Signed-off-by: Eduardo Morales <emoral435@gmail.com>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/AppInfo/Application.php3
-rw-r--r--apps/files_versions/lib/Db/VersionEntity.php4
-rw-r--r--apps/files_versions/lib/Sabre/Plugin.php2
-rw-r--r--apps/files_versions/lib/Sabre/VersionFile.php6
-rw-r--r--apps/files_versions/lib/Versions/IMetadataVersion.php2
-rw-r--r--apps/files_versions/lib/Versions/INameableVersion.php3
-rw-r--r--apps/files_versions/lib/Versions/INameableVersionBackend.php3
-rw-r--r--apps/files_versions/lib/Versions/Version.php6
8 files changed, 16 insertions, 13 deletions
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php
index 36d7ec8e2a0..7e1960da1eb 100644
--- a/apps/files_versions/lib/AppInfo/Application.php
+++ b/apps/files_versions/lib/AppInfo/Application.php
@@ -114,13 +114,14 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(NodeTouchedEvent::class, FileEventsListener::class);
$context->registerEventListener(BeforeNodeWrittenEvent::class, FileEventsListener::class);
$context->registerEventListener(NodeWrittenEvent::class, FileEventsListener::class);
- $context->registerEventListener(NodeWrittenEvent::class, MetadataFileEvents::class);
$context->registerEventListener(BeforeNodeDeletedEvent::class, FileEventsListener::class);
$context->registerEventListener(NodeDeletedEvent::class, FileEventsListener::class);
$context->registerEventListener(NodeRenamedEvent::class, FileEventsListener::class);
$context->registerEventListener(NodeCopiedEvent::class, FileEventsListener::class);
$context->registerEventListener(BeforeNodeRenamedEvent::class, FileEventsListener::class);
$context->registerEventListener(BeforeNodeCopiedEvent::class, FileEventsListener::class);
+
+ $context->registerEventListener(NodeWrittenEvent::class, MetadataFileEvents::class);
}
public function boot(IBootContext $context): void {
diff --git a/apps/files_versions/lib/Db/VersionEntity.php b/apps/files_versions/lib/Db/VersionEntity.php
index 1e1eca86886..4be57f8b097 100644
--- a/apps/files_versions/lib/Db/VersionEntity.php
+++ b/apps/files_versions/lib/Db/VersionEntity.php
@@ -84,8 +84,8 @@ class VersionEntity extends Entity implements JsonSerializable {
* if nothing is found, we return an empty string
* @param string $key key associated with the value
*/
- public function getMetadataValue(string $key): string {
- return $this->metadata[$key] ?? '';
+ public function getMetadataValue(string $key): ?string {
+ return $this->metadata[$key] ?? null;
}
/**
diff --git a/apps/files_versions/lib/Sabre/Plugin.php b/apps/files_versions/lib/Sabre/Plugin.php
index 04065bde4cc..b70b97b7485 100644
--- a/apps/files_versions/lib/Sabre/Plugin.php
+++ b/apps/files_versions/lib/Sabre/Plugin.php
@@ -95,7 +95,7 @@ class Plugin extends ServerPlugin {
public function propFind(PropFind $propFind, INode $node): void {
if ($node instanceof VersionFile) {
$propFind->handle(self::VERSION_LABEL, fn () => $node->getLabel());
- $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataAuthor());
+ $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/Sabre/VersionFile.php b/apps/files_versions/lib/Sabre/VersionFile.php
index ec98d24dd06..061cf285907 100644
--- a/apps/files_versions/lib/Sabre/VersionFile.php
+++ b/apps/files_versions/lib/Sabre/VersionFile.php
@@ -110,11 +110,11 @@ class VersionFile implements IFile {
}
}
- public function getMetadataAuthor(): string {
+ public function getMetadataValue(string $key): ?string {
if ($this->version instanceof IMetadataVersion) {
- return $this->version->getMetadataValue("author");
+ return $this->version->getMetadataValue($key);
}
- return '';
+ return null;
}
public function getLastModified(): int {
diff --git a/apps/files_versions/lib/Versions/IMetadataVersion.php b/apps/files_versions/lib/Versions/IMetadataVersion.php
index c11ec57f7d0..0fdfa96bfd9 100644
--- a/apps/files_versions/lib/Versions/IMetadataVersion.php
+++ b/apps/files_versions/lib/Versions/IMetadataVersion.php
@@ -34,5 +34,5 @@ interface IMetadataVersion {
* @param string $key the key for the json value of the metadata column
* @since 29.0.0
*/
- public function getMetadataValue(string $key): string;
+ public function getMetadataValue(string $key): ?string;
}
diff --git a/apps/files_versions/lib/Versions/INameableVersion.php b/apps/files_versions/lib/Versions/INameableVersion.php
index b6ddb951e25..7752247c791 100644
--- a/apps/files_versions/lib/Versions/INameableVersion.php
+++ b/apps/files_versions/lib/Versions/INameableVersion.php
@@ -24,12 +24,13 @@ declare(strict_types=1);
namespace OCA\Files_Versions\Versions;
/**
+ * @deprecated 29.0.0
* @since 26.0.0
*/
interface INameableVersion {
/**
* Get the user created label
- *
+ * @deprecated 29.0.0
* @return string
* @since 26.0.0
*/
diff --git a/apps/files_versions/lib/Versions/INameableVersionBackend.php b/apps/files_versions/lib/Versions/INameableVersionBackend.php
index 4a8c094cf18..5df2ce57865 100644
--- a/apps/files_versions/lib/Versions/INameableVersionBackend.php
+++ b/apps/files_versions/lib/Versions/INameableVersionBackend.php
@@ -24,12 +24,13 @@ declare(strict_types=1);
namespace OCA\Files_Versions\Versions;
/**
+ * @deprecated 29.0.0
* @since 26.0.0
*/
interface INameableVersionBackend {
/**
* Set the label for a version.
- *
+ * @deprecated 29.0.0
* @since 26.0.0
*/
public function setVersionLabel(IVersion $version, string $label): void;
diff --git a/apps/files_versions/lib/Versions/Version.php b/apps/files_versions/lib/Versions/Version.php
index 0e5417783e4..b3b06812f75 100644
--- a/apps/files_versions/lib/Versions/Version.php
+++ b/apps/files_versions/lib/Versions/Version.php
@@ -123,10 +123,10 @@ class Version implements IVersion, INameableVersion, IMetadataVersion {
return $this->user;
}
- public function getMetadataValue(string $key): string {
+ public function getMetadataValue(string $key): ?string {
if ($this->backend instanceof IMetadataVersionBackend && $this->sourceFileInfo instanceof Node) {
- return $this->backend->getMetadataValue($this->sourceFileInfo, "author") ?? '';
+ return $this->backend->getMetadataValue($this->sourceFileInfo, "author");
}
- return '';
+ return null;
}
}