[!!!][TASK] Show folder modification date in file list 17/37017/13
authorSteffen Ritter <info@rs-websystems.de>
Fri, 17 Jul 2015 19:35:52 +0000 (21:35 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 11 Jan 2016 09:43:38 +0000 (10:43 +0100)
Show the modification date of folders in the "Last Modified" column in
filelist again, which has been removed with the introduction of FAL.

Resolves: #65165
Releases: master
Change-Id: Ie8f615eaa1eaed27f2a869e55ca220668ce94663
Reviewed-on: https://review.typo3.org/37017
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Resource/Folder.php
typo3/sysext/core/Classes/Resource/FolderInterface.php
typo3/sysext/core/Classes/Resource/InaccessibleFolder.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-65165-AdditionalMethodsInFolderInterface.rst [new file with mode: 0644]
typo3/sysext/filelist/Classes/FileList.php

index 26ab2f4..b771b19 100644 (file)
@@ -288,9 +288,12 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
                 1314516810
             );
         }
+        $absolutePath = $this->getAbsolutePath($folderIdentifier);
         return array(
             'identifier' => $folderIdentifier,
             'name' => PathUtility::basename($folderIdentifier),
+            'mtime' => filemtime($absolutePath),
+            'ctime' => filectime($absolutePath),
             'storage' => $this->storageUid
         );
     }
index a1a7b89..8714c0d 100644 (file)
@@ -512,4 +512,24 @@ class Folder implements FolderInterface
     {
         return $this->getStorage()->getFolder($this->getStorage()->getFolderIdentifierFromFileIdentifier($this->getIdentifier()));
     }
+
+    /**
+     * Returns the modification time of the file as Unix timestamp
+     *
+     * @return int
+     */
+    public function getModificationTime()
+    {
+        return $this->storage->getFolderInfo($this)['mtime'];
+    }
+
+    /**
+     * Returns the creation time of the file as Unix timestamp
+     *
+     * @return int
+     */
+    public function getCreationTime()
+    {
+        return $this->storage->getFolderInfo($this)['ctime'];
+    }
 }
index a1e242c..547eae2 100644 (file)
@@ -76,4 +76,18 @@ interface FolderInterface extends ResourceInterface
      * @return bool TRUE if deletion succeeded
      */
     public function delete();
+
+    /**
+     * Returns the modification time of the folder as Unix timestamp
+     *
+     * @return int
+     */
+    public function getModificationTime();
+
+    /**
+     * Returns the creation time of the folder as Unix timestamp
+     *
+     * @return int
+     */
+    public function getCreationTime();
 }
index cd5b504..4f17ed4 100644 (file)
@@ -265,4 +265,20 @@ class InaccessibleFolder extends Folder
     {
         $this->throwInaccessibleException();
     }
+
+    /**
+     * @return int
+     */
+    public function getModificationTime()
+    {
+        return 0;
+    }
+
+    /**
+     * @return int
+     */
+    public function getCreationTime()
+    {
+        return 0;
+    }
 }
index 2527c93..3a53889 100644 (file)
@@ -2294,6 +2294,17 @@ class ResourceStorage implements ResourceStorageInterface
     }
 
     /**
+     * Retrieves information about a folder
+     *
+     * @param Folder $folder
+     * @return array
+     */
+    public function getFolderInfo(Folder $folder)
+    {
+        return $this->driver->getFolderInfoByIdentifier($folder->getIdentifier());
+    }
+
+    /**
      * Returns the default folder where new files are stored if no other folder is given.
      *
      * @return Folder
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-65165-AdditionalMethodsInFolderInterface.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65165-AdditionalMethodsInFolderInterface.rst
new file mode 100644 (file)
index 0000000..c56366b
--- /dev/null
@@ -0,0 +1,30 @@
+=====================================================
+Breaking: #65165 - AdditionalMethodsInFolderInterface
+=====================================================
+
+Description
+===========
+
+The interface ``AdditionalMethodsInFolderInterface`` has received two additional methods. Classes that implement
+``FolderInterface`` have to implement those methods as well. The new methods are:
+
+* ``getModificationTime()`` - Returns the modification time of the folder as Unix timestamp.
+* ``getCreationTime()`` - Returns the creation time of the folder as Unix timestamp.
+
+
+Impact
+======
+
+Classes implementing the ``FolderInterface`` no longer fulfill the requirements of the interface.
+
+
+Affected Installations
+======================
+
+Installations that use custom implementations of the ``FolderInterface``.
+
+
+Migration
+=========
+
+Implement the two new methods in custom implementations of the ``FolderInterface``.
index bfecd1c..81794f9 100644 (file)
@@ -503,8 +503,8 @@ class FileList extends AbstractRecordList
                             $theData[$field] = $this->getLanguageService()->getLL('folder', true);
                             break;
                         case 'tstamp':
-                            // @todo: FAL: how to get the mtime info -- $theData[$field] = \TYPO3\CMS\Backend\Utility\BackendUtility::date($theFile['tstamp']);
-                            $theData[$field] = '-';
+                            $tstamp = $folderObject->getModificationTime();
+                            $theData[$field] = $tstamp ? BackendUtility::date($tstamp) : '-';
                             break;
                         case 'file':
                             $theData[$field] = $this->linkWrapDir($displayName, $folderObject);