Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CI-4 Clear Cache now with admin priviledges

  • Loading branch information...
commit 15ca0d93821f60c53972288656da2b3e7170d039 1 parent 5c74198
@svparijs authored
View
29 classes/class.tx_t3deploy_abstract.php
@@ -0,0 +1,29 @@
+<?php
+/***************************************************************
+* Copyright notice
+*
+* (c) 2012 Tryweb V.O.F <support@tryweb.nl>
+* All rights reserved
+*
+* This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Controller that handles database actions of the t3deploy process inside TYPO3.
+ *
+ * @package t3deploy
+ * @author Oliver Hader <oliver.hader@aoemedia.de>
+ *
+ */
+class tx_t3deploy_abstract {
+
+ /**
+ * Prints the output message
+ *
+ * @param string $message for output
+ */
+ protected function printMessage($message, $status=0, $exit = true) {
+ echo($message . PHP_EOL);
+ if($exit) exit($status);
+ }
+}
View
15 classes/class.tx_t3deploy_cacheController.php
@@ -8,6 +8,7 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
+t3lib_div::requireOnce(t3lib_extMgm::extPath('t3deploy'). 'classes/class.tx_t3deploy_abstract.php');
t3lib_div::requireOnce(PATH_t3lib . 'class.t3lib_install.php');
/**
@@ -17,7 +18,7 @@
* @author Oliver Hader <oliver.hader@aoemedia.de>
*
*/
-class tx_t3deploy_cacheController {
+class tx_t3deploy_cacheController extends tx_t3deploy_abstract {
/**
* object <t3lib_TCEmain>
@@ -30,8 +31,10 @@ class tx_t3deploy_cacheController {
public function __construct() {
$this->setTCE();
- // this seems to initalized a BE-User
- $this->TCE->start(Array(),Array());
+ // this seems to initalized a BE
+ $this->TCE->start(Array(),Array());
+ // We need a admin user to clear the full cache
+ $this->TCE->admin = TRUE;
}
/**
@@ -42,11 +45,9 @@ public function __construct() {
*/
public function clearcacheAction(){
- // The option all clears all Tables, IF the user has the TSconfig settings or is admin. We don't want a CLI user with Admin priveledges!!!!
+ // The option all clears all cache Tables & Files
$this->TCE->clear_cacheCmd('all');
-
- // The BE user (_cli_t3deploy) needs to be ADMIN to run this command via clear_cacheCmd, therefor we run the removeCacheFiles directly
- $this->TCE->removeCacheFiles();
+ $this->printMessage('T3Deploy: All Caches purged!', 0, FALSE);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.