Added feature #16365: htmlArea RTE: Delete compressed files when clearing RTE cache
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 12 Nov 2010 15:34:58 +0000 (15:34 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 12 Nov 2010 15:34:58 +0000 (15:34 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9344 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php

index 9bdcfe5..351460d 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-12  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #16365: htmlArea RTE: Delete compressed files when clearing RTE cache
+
 2010-11-11  Steffen Kamper  <steffen@typo3.org>
 
        * Fixed bug #16361: Javascript returns 'FALSE' instead of 'false' in class.tslib_content.php (Thanks to Krystian Szymukowicz)
index 8e2d41c..6c45922 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-12  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #16365: htmlArea RTE: Delete compressed files when clearing RTE cache
+
 2010-11-11  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16314: Incorrect use of is_dir in class.tx_rtehtmlarea_clearrtecache.php (Thanks to Juergen Deisenroth)
index ca6a455..d5423d6 100644 (file)
@@ -32,6 +32,7 @@
  */
 class tx_rtehtmlarea_clearrtecache {
        public static function clearTempDir() {
+                       // Delete all files in typo3temp/rtehtmlarea
                $tempPath = t3lib_div::resolveBackPath(PATH_typo3.'../typo3temp/rtehtmlarea/');
                $handle = @opendir($tempPath);
                if ($handle !== FALSE) {
@@ -45,6 +46,22 @@ class tx_rtehtmlarea_clearrtecache {
                        }
                        closedir($handle);
                }
+                       // Delete all files in typo3temp/compressor with names that start with "htmlarea"
+               $tempPath = t3lib_div::resolveBackPath(PATH_typo3.'../typo3temp/compressor/');
+               $handle = @opendir($tempPath);
+               if ($handle !== FALSE) {
+                       while (($file = readdir($handle)) !== FALSE) {
+                               if (substr($file, 0, 8) === 'htmlarea') {
+                                       $tempFile = $tempPath . $file;
+                                       if (is_file($tempFile)) {
+                                               unlink($tempFile);
+                                       }
+                               }
+                       }
+                       closedir($handle);
+               }
+                       // Log the action
+               $GLOBALS['BE_USER']->writelog(3, 1, 0, 0, 'htmlArea RTE: User %s has cleared the RTE cache', array($GLOBALS['BE_USER']->user['username']));
        }
 }
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php']) {