Import 2.0.0 from TER
authorstephenking <stephenking@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 25 Jan 2010 15:40:40 +0000 (15:40 +0000)
committerstephenking <stephenking@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 25 Jan 2010 15:40:40 +0000 (15:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/stg_clearcache/trunk@29306 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog [new file with mode: 0755]
README.txt [new file with mode: 0755]
class.tx_stgclearcache.php [new file with mode: 0755]
ext_emconf.php [new file with mode: 0755]
ext_icon.gif [new file with mode: 0755]
ext_localconf.php [new file with mode: 0755]
locallang.xml [new file with mode: 0755]

diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..6cf27a6
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,3 @@
+2009-10-02 Steffen Gebert  <steffen@steffen-gebert.de>
+
+       * initial release 2.0.0 in TER
diff --git a/README.txt b/README.txt
new file mode 100755 (executable)
index 0000000..2b9aebe
--- /dev/null
@@ -0,0 +1,2 @@
+
+Feel free to add some documentation or simply add a link to the online manual.
diff --git a/class.tx_stgclearcache.php b/class.tx_stgclearcache.php
new file mode 100755 (executable)
index 0000000..e2c8b6e
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2009 Steffen Gebert (steffen@steffen-gebert.de)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ *
+ *
+ *   36: class tx_stgclearcache
+ *   53:     function clearCachePostProc (&$params, &$pObj)
+ *
+ * TOTAL FUNCTIONS: 1
+ * (This index is automatically created/updated by the extension "extdeveval")
+ *
+ */
+class tx_stgclearcache {
+       var $extKey = 'stg_clearcache';
+
+       /* @var $queryGeneratorInstance t3lib_queryGenerator */
+       var $queryGeneratorInstance;
+
+       /* @var $tceMainInstance t3lib_TCEmain */
+       var $tceMainInstance;
+
+       /**
+        * Clear cache post processor.
+        * The same structure as t3lib_TCEmain::clear_cache
+        *
+        * @param       object          $_params: parameter array
+        * @param       object          $pObj: partent object
+        * @return      void
+        */
+       function clearCachePostProc (&$params, &$pObj) {
+               if ($params['cacheCmd'] && t3lib_div::testInt($params['cacheCmd'])) {
+
+                       if ($this->queryGeneratorInstance == null) {
+                               $this->queryGeneratorInstance = t3lib_div::makeInstance('t3lib_queryGenerator');
+                       }
+                       if ($this->tceMainInstance == null) {
+                               $this->tceMainInstance = t3lib_div::makeInstance('t3lib_TCEmain');
+                       }
+
+                       if ($GLOBALS['BE_USER']->user['admin']) {
+                               $perms_clause = '1=1';
+                       }
+                       else {
+                               $perms_clause = 'perms_userid=' . intval($GLOBALS['BE_USER']->user["uid"]);
+                       }
+
+                       // read out all pages below this one
+                       // it's not possible, to directly get ALL pages below, because this function is also
+                       // called for each below (so each level would delete caches for all its underlying pages)
+
+                       // function getTreeList($id, $depth, $begin=0, $perms_clause)
+                       // $depth: 1    see note above
+                       // $begin: 0    actual ID is returned, which has to be removed later
+                       //              if it would be 1, the first sublevel would be skipped
+                       $pageList = $this->queryGeneratorInstance->getTreeList($params['cacheCmd'], 1, 0, $perms_clause);
+
+                       $pages = explode(',', $pageList);
+
+                       // call clear_cacheCmd for every page below
+                       foreach ($pages as $page) {
+                               // we know $params['cacheCmd'] is returned from getTreeList again, but we
+                               // don't want to end in recursive loop
+                               if ($page != $params['cacheCmd']) {
+                                       $this->tceMainInstance->clear_cacheCmd($page);
+                               }
+                       }
+               }
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/stg_clearcache/class.tx_stgclearcache.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/stg_clearcache/class.tx_stgclearcache.php']);
+}
+?>
\ No newline at end of file
diff --git a/ext_emconf.php b/ext_emconf.php
new file mode 100755 (executable)
index 0000000..5f102d2
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+
+########################################################################
+# Extension Manager/Repository config file for ext "stg_clearcache".
+#
+# Auto generated 25-01-2010 16:33
+#
+# Manual updates:
+# Only the data in the array - everything else is removed by next
+# writing. "version" and "dependencies" must not be touched!
+########################################################################
+
+$EM_CONF[$_EXTKEY] = array(
+       'title' => 'Clear cache recursive',
+       'description' => '"Clear cache for this page" now also affects child pages, if user owns them. Is helpful in bigger installations, where each user has it\'s own branch and can\'t be allowed to clear the cache of the whole server.',
+       'category' => 'be',
+       'shy' => 0,
+       'version' => '2.0.0',
+       'dependencies' => '',
+       'conflicts' => '',
+       'priority' => '',
+       'loadOrder' => '',
+       'module' => '',
+       'state' => 'stable',
+       'uploadfolder' => 0,
+       'createDirs' => '',
+       'modify_tables' => '',
+       'clearcacheonload' => 0,
+       'lockType' => '',
+       'author' => 'Steffen Gebert',
+       'author_email' => 'steffen@steffen-gebert.de',
+       'author_company' => 'Webteam der Freien Wähler Bayern',
+       'CGLcompliance' => '',
+       'CGLcompliance_note' => '',
+       'constraints' => array(
+               'depends' => array(
+               ),
+               'conflicts' => array(
+               ),
+               'suggests' => array(
+               ),
+       ),
+       '_md5_values_when_last_written' => 'a:6:{s:9:"ChangeLog";s:4:"630e";s:10:"README.txt";s:4:"ee2d";s:26:"class.tx_stgclearcache.php";s:4:"db94";s:12:"ext_icon.gif";s:4:"934f";s:17:"ext_localconf.php";s:4:"890b";s:13:"locallang.xml";s:4:"310c";}',
+);
+
+?>
\ No newline at end of file
diff --git a/ext_icon.gif b/ext_icon.gif
new file mode 100755 (executable)
index 0000000..861fa99
Binary files /dev/null and b/ext_icon.gif differ
diff --git a/ext_localconf.php b/ext_localconf.php
new file mode 100755 (executable)
index 0000000..d3e5d23
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+if(!defined('TYPO3_MODE'))   die('Access denied.');
+
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] = 'EXT:stg_clearcache/class.tx_stgclearcache.php:&tx_stgclearcache->clearCachePostProc';
+
+// override clear_cache label
+$TYPO3_CONF_VARS['BE']['XLLfile']['EXT:lang/locallang_core.php'] = t3lib_extMgm::extPath($_EXTKEY) . 'locallang.xml';
+
+?>
\ No newline at end of file
diff --git a/locallang.xml b/locallang.xml
new file mode 100755 (executable)
index 0000000..2c3c253
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="labels.clear_cache">Clear cache of this page and all underlying pages</label>
+               </languageKey>
+               <languageKey index="de" type="array">
+                       <label index="labels.clear_cache">Cache dieser und aller darunterliegenden Seiten leeren</label>
+               </languageKey>
+       </data>
+</T3locallang>