Permalink
Browse files

T3Deploy cleanup

  • Loading branch information...
1 parent 7a549c1 commit 5c7419867cb9112e344eca44849357b12776bfb6 Sebastiaan van Parijs committed Feb 27, 2012
Showing with 14 additions and 154 deletions.
  1. +0 −112 classes/class.tx_bkwinotification_config.php
  2. +14 −42 classes/class.tx_t3deploy_cacheController.php
@@ -1,112 +0,0 @@
-<?php
-/***************************************************************
-* Copyright notice
-*
-* (c) 2011 BKWI <lhilgersom@bkwi.nl>
-* 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]
- *
- * Hint: use extdeveval to insert/update function index above.
- */
-
-require_once(PATH_tslib.'class.tslib_fe.php');
-require_once(PATH_t3lib.'class.t3lib_userauth.php');
-require_once(PATH_tslib.'class.tslib_feuserauth.php');
-require_once(PATH_t3lib.'class.t3lib_cs.php');
-require_once(PATH_tslib.'class.tslib_content.php');
-require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
-require_once(PATH_t3lib.'class.t3lib_page.php');
-
-/**
- * Get configuration for the 'bkwi_notification' extension.
- *
- * @author BKWI <lhilgersom@bkwi.nl>
- * @package TYPO3
- * @subpackage tx_bkwinotification
- */
-class tx_bkwinotification_config {
-
- var $pid = 2;
- /**
- * Get configuration array from EM for this extension
- * @return array configuration array
- */
- static function getEMConfig() {
- return unserialize($GLOBALS[TYPO3_CONF_VARS]['EXT']['extConf']['bkwi_notification']);
- }
-
- /**
- * Get Page TS-Config array for this extension for the given page id.
- *
- * @param int $id: current page id
- * @return array TSConfig array from mod.tx_{extKey} from pageTSC
- */
- static function getTSConfig($id) {
- $rootLineStruct = t3lib_BEfunc::BEgetRootLine($id);
- // get TSconfig
- $pagesTSC = t3lib_BEfunc::getPagesTSconfig($id, $rootLineStruct);
-# t3lib_div::debug($pagesTSC);
-
- return $pagesTSC['mod.']['tx_bkwinotification.'];
- }
-
- function buildTSFE() {
- $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
-
- if (!is_object($GLOBALS['TT'])) {
- $GLOBALS['TT'] = new t3lib_timeTrack;
- $GLOBALS['TT']->start();
- }
-
- // Create the TSFE class.
- $GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],$this->pid,'0',1,'','','','');
- $GLOBALS['TSFE']->connectToMySQL();
- $GLOBALS['TSFE']->initFEuser();
- $GLOBALS['TSFE']->fetch_the_id();
- $GLOBALS['TSFE']->getPageAndRootline();
- $GLOBALS['TSFE']->initTemplate();
- $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
- $GLOBALS['TSFE']->forceTemplateParsing = 1;
- $GLOBALS['TSFE']->getConfigArray();
-// $GLOBALS['TSFE']->config['config']['typolinkCheckRootline'] = TRUE;
- }
- /**
- * Add enableFields to query for BE-processes because we cannot use cObj->enableFields when we're not in FE
- * Includes deleted, hidden, starttime & endtime
- * @param string $table, optional tablename, gets prepended to fieldnames
- * @return string additional conditions for where clause
- */
- static function BEenableFields($table='') {
- if ($table!='') $table .= '.';
- $where = ' AND '.$table.'deleted=0';
- $where .= ' AND '. ($table=='fe_users.' ? $table.'disable=0' : $table.'hidden=0');
- $where .= ' AND ('.$table.'starttime=0 OR '.$table.'starttime<='.time().')';
- $where .= ' AND ('.$table.'endtime=0 OR '.$table.'endtime>='.time().')';
- return $where;
- }
-
-
-}
-
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bkwi_notification/classes/class.tx_bkwinotification_config.php']) {
- include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/bkwi_notification/classes/class.tx_bkwinotification_config.php']);
-}
-?>
@@ -31,66 +31,38 @@ public function __construct() {
$this->setTCE();
// this seems to initalized a BE-User
- $this->TCE->start(Array(),Array());
- // so this line does not throw an error any more
- #$TCE->clear_cache('tt_news',$oneRecordId);
-
-
- /*function clearpagecache($pid_list) {
-$tce = t3lib_div::makeInstance('t3lib_TCEmain');
-$pid_array = explode(',', $pid_list);
-foreach ($pid_array as $pid) {
-$tce->clear_cacheCmd($pid);
-}
-}
- *
- * <?php
-
-define("PATH_typo3conf", dirname(dirname(dirname(__FILE__)))."/");
-define("PATH_site", dirname(PATH_typo3conf)."/");
-define("PATH_typo3", PATH_site."typo3/"); // Typo-configuraton path
-define("PATH_t3lib", PATH_site."t3lib/");
-define('TYPO3_MODE','BE');
-ini_set('error_reporting', E_ALL ^ E_NOTICE);
-
-require_once (PATH_t3lib.'class.t3lib_div.php');
-require_once (PATH_t3lib.'class.t3lib_extmgm.php');
-√require_once (PATH_t3lib.'class.t3lib_tcemain.php');
-
-require_once(PATH_t3lib.'config_default.php');
-
-if (!defined ("TYPO3_db")) die ("The configuration file was not included.");
-require_once(PATH_t3lib.'class.t3lib_db.php'); // The database library
-$TYPO3_DB = t3lib_div::makeInstance('t3lib_db');
-$TYPO3_DB->sql_pconnect (TYPO3_db_host, TYPO3_db_username, TYPO3_db_password);
-$TYPO3_DB->sql_select_db (TYPO3_db);
-
-√$tce = t3lib_div::makeInstance('t3lib_TCEmain');
-$tce->clear_cacheCmd(40); // ID of the page for which to clear the cache
-
-?>
- */
-
+ $this->TCE->start(Array(),Array());
}
/**
* Updates the database structure.
*
* @param array $arguments Optional arguemtns passed to this action
- * @return string
+ * @return void
*/
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!!!!
$this->TCE->clear_cacheCmd('all');
- #if()
+ // 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();
}
+ /**
+ * Sets the TCEmain object
+ *
+ * #return void
+ */
private function setTCE(){
$this->TCE = t3lib_div::makeInstance('t3lib_TCEmain');
}
+ /**
+ * Gets the TCEmain object
+ *
+ * @return t3lib_TCEmain $TCE
+ */
public function getTCE(){
return $this->TCE;
}

0 comments on commit 5c74198

Please sign in to comment.