当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseConnection::exec_TRUNCATEquery方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Database\DatabaseConnection::exec_TRUNCATEquery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::exec_TRUNCATEquery方法的具体用法?PHP DatabaseConnection::exec_TRUNCATEquery怎么用?PHP DatabaseConnection::exec_TRUNCATEquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Database\DatabaseConnection的用法示例。


在下文中一共展示了DatabaseConnection::exec_TRUNCATEquery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: truncateTables

 /**
  * Truncate tables before data transfer
  *
  * @return void
  */
 private function truncateTables()
 {
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_domain_model_person');
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_domain_model_product');
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_domain_model_productproperty');
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_domain_model_productpropertyvalue');
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_domain_model_project');
     $this->databaseConnection->exec_TRUNCATEquery('tx_projectregistration_product_property_mm');
     $this->feedback .= $this->renderFlashMessage('Truncated extension tables.', 'Tables truncated', FlashMessage::WARNING);
 }
开发者ID:S3b0,项目名称:project_registration,代码行数:15,代码来源:class.ext_update.php

示例2: forceFlushCoreFileAndDatabaseCaches

 /**
  * Recursively delete cache directory and truncate all DB tables prefixed with 'cf_'
  */
 protected function forceFlushCoreFileAndDatabaseCaches()
 {
     // Delete typo3temp/Cache
     GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache', TRUE);
     // Get all table names starting with 'cf_' and truncate them
     $tables = $this->databaseConnection->admin_get_tables();
     foreach ($tables as $table) {
         $tableName = $table['Name'];
         if (substr($tableName, 0, 3) === 'cf_') {
             $this->databaseConnection->exec_TRUNCATEquery($tableName);
         }
     }
 }
开发者ID:johannessteu,项目名称:typo3_console,代码行数:16,代码来源:CacheService.php

示例3: removeAll

 /**
  * Removes all processed files and also deletes the associated physical files
  *
  * @param int|NULL $storageUid If not NULL, only the processed files of the given storage are removed
  * @return int Number of failed deletions
  */
 public function removeAll($storageUid = null)
 {
     $res = $this->databaseConnection->exec_SELECTquery('*', $this->table, 'identifier <> \'\'');
     $logger = $this->getLogger();
     $errorCount = 0;
     while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
         if ($storageUid && (int) $storageUid !== (int) $row['storage']) {
             continue;
         }
         try {
             $file = $this->createDomainObject($row);
             $file->getStorage()->setEvaluatePermissions(false);
             $file->delete(true);
         } catch (\Exception $e) {
             $logger->error('Failed to delete file "' . $row['identifier'] . '" in storage uid ' . $row['storage'] . '.', array('exception' => $e));
             ++$errorCount;
         }
     }
     $this->databaseConnection->exec_TRUNCATEquery($this->table);
     return $errorCount;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:27,代码来源:ProcessedFileRepository.php

示例4: clear_cacheCmd

 /**
  * Clears the cache based on the command $cacheCmd.
  *
  * $cacheCmd='pages'
  * Clears cache for all pages and page-based caches inside the cache manager.
  * Requires admin-flag to be set for BE_USER.
  *
  * $cacheCmd='all'
  * Clears all cache_tables. This is necessary if templates are updated.
  * Requires admin-flag to be set for BE_USER.
  *
  * The following cache_* are intentionally not cleared by 'all'
  *
  * - cache_md5params:	RDCT redirects.
  * - cache_imagesizes:	Clearing this table would cause a lot of unneeded
  * Imagemagick calls because the size informations have
  * to be fetched again after clearing.
  * - all caches inside the cache manager that are inside the group "system"
  * - they are only needed to build up the core system and templates,
  *   use "temp_cached" or "system" to do that
  *
  * $cacheCmd=[integer]
  * Clears cache for the page pointed to by $cacheCmd (an integer).
  *
  * $cacheCmd='cacheTag:[string]'
  * Flush page and pagesection cache by given tag
  *
  * $cacheCmd='cacheId:[string]'
  * Removes cache identifier from page and page section cache
  *
  * Can call a list of post processing functions as defined in
  * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']
  * (numeric array with values being the function references, called by
  * GeneralUtility::callUserFunction()).
  *
  *
  * @param string $cacheCmd The cache command, see above description
  * @return void
  */
 public function clear_cacheCmd($cacheCmd)
 {
     if (is_object($this->BE_USER)) {
         $this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd));
     }
     // Clear cache for either ALL pages or ALL tables!
     switch (strtolower($cacheCmd)) {
         case 'pages':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) {
                 $this->getCacheManager()->flushCachesInGroup('pages');
             }
             break;
         case 'all':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
                 // Clear cache group "all" of caching framework caches
                 $this->getCacheManager()->flushCachesInGroup('all');
                 $this->databaseConnection->exec_TRUNCATEquery('cache_treelist');
             }
             break;
         case 'temp_cached':
         case 'system':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system') || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $this->admin) {
                 $this->getCacheManager()->flushCachesInGroup('system');
             }
             break;
     }
     $tagsToFlush = array();
     // Clear cache for a page ID!
     if (MathUtility::canBeInterpretedAsInteger($cacheCmd)) {
         $list_cache = array($cacheCmd);
         // Call pre-processing function for clearing of cache for page ids:
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'] as $funcName) {
                 $_params = array('pageIdArray' => &$list_cache, 'cacheCmd' => $cacheCmd, 'functionID' => 'clear_cacheCmd()');
                 // Returns the array of ids to clear, FALSE if nothing should be cleared! Never an empty array!
                 GeneralUtility::callUserFunction($funcName, $_params, $this);
             }
         }
         // Delete cache for selected pages:
         if (is_array($list_cache)) {
             foreach ($list_cache as $pageId) {
                 $tagsToFlush[] = 'pageId_' . (int) $pageId;
             }
         }
     }
     // flush cache by tag
     if (GeneralUtility::isFirstPartOfStr(strtolower($cacheCmd), 'cachetag:')) {
         $cacheTag = substr($cacheCmd, 9);
         $tagsToFlush[] = $cacheTag;
     }
     // process caching framwork operations
     if (!empty($tagsToFlush)) {
         foreach (array_unique($tagsToFlush) as $tag) {
             $this->getCacheManager()->flushCachesInGroupByTag('pages', $tag);
         }
     }
     // Call post processing function for clear-cache:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'])) {
         $_params = array('cacheCmd' => strtolower($cacheCmd));
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'] as $_funcRef) {
             GeneralUtility::callUserFunction($_funcRef, $_params, $this);
//.........这里部分代码省略.........
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:101,代码来源:DataHandler.php

示例5: reset

 /**
  * Resets the store by removing all data in it
  *
  * @return void
  */
 public function reset()
 {
     $this->databaseConnection->exec_TRUNCATEquery(self::ASSOCIATION_TABLE_NAME);
     $this->databaseConnection->exec_TRUNCATEquery(self::NONCE_TABLE_NAME);
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:10,代码来源:OpenidStore.php

示例6: clearUrlCache

 /**
  * Empties the URL cache.
  *
  * @return mixed
  */
 public function clearUrlCache()
 {
     $this->databaseConnection->exec_TRUNCATEquery('tx_realurl_urlcache');
     $this->databaseConnection->exec_TRUNCATEquery('tx_realurl_uniqalias_cache_map');
 }
开发者ID:MaxServ,项目名称:typo3-realurl,代码行数:10,代码来源:DatabaseCache.php

示例7: purge

 public function purge($simulate)
 {
     $this->output->info('Purge deleted');
     $this->purgeDeleted('sys_file_reference', $simulate);
     $this->db->exec_DELETEquery('sys_file_reference', 'tablenames = \'\' OR fieldname = \'\'');
     $delete = new PreparedStatement('DELETE FROM sys_file_reference WHERE uid = ?', 'sys_file_reference');
     $this->output->info('Purge references pointing to deleted records');
     $res = $this->db->exec_SELECTquery('*', 'sys_file_reference', '');
     $pageTools = new PageRepository();
     $pageTools->init(FALSE);
     while ($row = $this->db->sql_fetch_assoc($res)) {
         $cnt = $this->db->exec_SELECTcountRows('uid', $row['tablenames'], 'uid = ' . $row['uid_foreign'] . $pageTools->enableFields($row['tablenames']));
         if (!$cnt) {
             if ($simulate) {
                 $this->output->info('Would delete reference ' . $row['uid']);
             } else {
                 $delete->execute(array($row['uid']));
                 $this->output->info('Deleted reference ' . $row['uid']);
             }
         }
     }
     $delete->free();
     $this->output->info('Purge sys_file records with no references');
     $delete = new PreparedStatement('DELETE FROM sys_file WHERE uid = ?', 'sys_file');
     $res = $this->db->exec_SELECTquery('uid', 'sys_file', 'uid NOT IN (select uid_local from sys_file_reference group by uid_local)');
     while ($row = $this->db->sql_fetch_assoc($res)) {
         if ($simulate) {
             $this->output->info('Would delete file record %s', array($row['uid']));
         } else {
             $delete->execute(array($row['uid']));
             $this->output->info('Deleted file record <b>%s</b>', array($row['uid']));
         }
     }
     $this->output->info('Purge actual files with no record');
     $prefixRegex = '/^' . preg_quote(PATH_site, '/') . '(fileadmin|uploads)/';
     $files = new \RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PATH_site, RecursiveDirectoryIterator::SKIP_DOTS | RecursiveDirectoryIterator::UNIX_PATHS), RecursiveIteratorIterator::LEAVES_ONLY | RecursiveIteratorIterator::CHILD_FIRST), $prefixRegex);
     $exists = new PreparedStatement('SELECT uid FROM sys_file WHERE identifier = ?', 'sys_file');
     $fileSize = 0;
     foreach ($files as $file) {
         $filename = (string) $file;
         if (!is_file($filename)) {
             continue;
         }
         $fileId = preg_replace($prefixRegex, '', $filename);
         $exists->execute(array($fileId));
         $result = $exists->fetchAll();
         if (empty($result[0]['uid'])) {
             $fileSize += filesize($filename);
             if ($simulate) {
                 $this->output->info('<i>Would delete file %s</i>', array($filename));
             } else {
                 unlink($filename);
                 $this->output->info('Delete file %s', array($filename));
             }
         }
     }
     $size = GeneralUtility::formatSize($fileSize);
     if ($simulate) {
         $this->output->info('Would delete %s of files', array($size));
         $this->output->info('Would truncate table sys_file_processedfile');
     } else {
         $this->output->info('Deleted %s of files', array($size));
         $this->db->exec_TRUNCATEquery('sys_file_processedfile');
         $this->output->info('Truncated table sys_file_processedfile');
     }
 }
开发者ID:garfieldius,项目名称:typo3.fal_clean,代码行数:66,代码来源:CleanService.php


注:本文中的TYPO3\CMS\Core\Database\DatabaseConnection::exec_TRUNCATEquery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。