/** * Run tasks for one domain */ protected function runTaskForDomain($dbName) { DatabaseConnection::switchDatabase($dbName); if ($this->input->getOption('list')) { // Show domain list (and skip all other tasks) $this->showDomainList($dbName); } else { // Remove domains (eg. for cleanup) if ($this->input->getOption('remove')) { $this->removeDomains($this->input->getOption('remove')); } // Set development domains $this->manipulateDomains(); // Add sharing domains if ($this->input->getOption('baseurl')) { $this->updateBaseUrlConfig(); } // Add sharing domains if ($this->input->getOption('duplicate')) { $this->addDuplicateDomains($this->input->getOption('duplicate')); } // Show domain list $this->showDomainList($dbName); } }
/** * Cleanup TYPO3 database * * @param string $database Database */ protected function cleanupTypo3Database($database) { $cleanupTableList = array(); // Check if database is TYPO3 instance $tableList = DatabaseConnection::tableList($database); foreach ($tableList as $table) { $clearTable = false; // Caching und indexing tables switch (true) { case strpos($table, 'cache_') === 0: case strpos($table, 'cachingframework_') === 0: case strpos($table, 'cf_') === 0: // Caching framework $clearTable = true; break; case strpos($table, 'index_') === 0: // EXT:indexed_search $clearTable = true; break; } switch ($table) { case 'sys_history': case 'sys_log': // History/Log $clearTable = true; break; case 'sys_dmain': // EXT:direct_mail $clearTable = true; break; case 'tx_devlog': // EXT:devlog $clearTable = true; break; case 'tx_realurl_errorlog': case 'tx_realurl_pathcache': case 'tx_realurl_urldecodecache': case 'tx_realurl_urlencodecache': // EXT: realurl $clearTable = true; break; case 'tx_solr_cache': case 'tx_solr_cache_tags': // EXT:solr $clearTable = true; break; } if ($clearTable) { $cleanupTableList[] = $table; } } $this->output->writeln('<p>Starting cleanup of database "' . $database . '"</p>'); DatabaseConnection::switchDatabase(DatabaseConnection::sanitizeSqlDatabase($database)); foreach ($cleanupTableList as $table) { $query = 'TRUNCATE ' . DatabaseConnection::sanitizeSqlTable($table); DatabaseConnection::exec($query); if ($this->output->isVerbose()) { $this->output->writeln('<p>Truncating table ' . $table . '</p>'); } } $this->output->writeln('<p>finished</p>'); }