diff --git a/apps/files_trashbin/lib/Trash/TrashItem.php b/apps/files_trashbin/lib/Trash/TrashItem.php index b41a7ee3575..eb4f5ee8a4d 100644 --- a/apps/files_trashbin/lib/Trash/TrashItem.php +++ b/apps/files_trashbin/lib/Trash/TrashItem.php @@ -153,6 +153,10 @@ class TrashItem implements ITrashItem { return $this->fileInfo->getUploadTime(); } + public function getLastActivity(): int { + return $this->fileInfo->getLastActivity(); + } + public function getParentId(): int { return $this->fileInfo->getParentId(); } diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 967d404b8a4..6892069a383 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -379,6 +379,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { return (int)$this->data['upload_time']; } + public function getLastActivity(): int { + return max($this->getUploadTime(), $this->getMTime()); + } + public function getParentId(): int { return $this->data['parent'] ?? -1; } diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php index 017b2a361e0..db7f97b0efc 100644 --- a/lib/private/Files/Node/LazyFolder.php +++ b/lib/private/Files/Node/LazyFolder.php @@ -540,6 +540,13 @@ class LazyFolder implements Folder { return $this->__call(__FUNCTION__, func_get_args()); } + /** + * @inheritDoc + */ + public function getLastActivity(): int { + return $this->__call(__FUNCTION__, func_get_args()); + } + public function getRelativePath($path) { return PathHelper::getRelativePath($this->getPath(), $path); } diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index fa0c7eea767..9f0e14462d9 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -475,6 +475,10 @@ class Node implements INode { return $this->getFileInfo()->getUploadTime(); } + public function getLastActivity(): int { + return $this->getFileInfo()->getLastActivity(); + } + public function getParentId(): int { return $this->fileInfo->getParentId(); } diff --git a/lib/public/Files/FileInfo.php b/lib/public/Files/FileInfo.php index 6e174b0bb6a..148dc36d15a 100644 --- a/lib/public/Files/FileInfo.php +++ b/lib/public/Files/FileInfo.php @@ -280,6 +280,16 @@ interface FileInfo { */ public function getUploadTime(): int; + /** + * Get the last activity date as unix timestamp + * + * Last activity is the more recent of the upload time and the modification time + * + * @return int + * @since 34.0.0 + */ + public function getLastActivity(): int; + /** * Get the fileid or the parent folder * or -1 if this item has no parent folder (because it is the root)