コード例 #1
0
ファイル: ClickMenu.php プロジェクト: vip3out/TYPO3.CMS
 /**
  * Adding CM element for regular editing of the element!
  *
  * @param string $table Table name
  * @param int $uid UID for the current record.
  * @return array Item array, element in $menuItems
  * @internal
  */
 public function DB_edit($table, $uid)
 {
     // If another module was specified, replace the default Page module with the new one
     $newPageModule = trim($this->backendUser->getTSConfigVal('options.overridePageModule'));
     $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
     $loc = 'top.content.list_frame';
     $theIcon = $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render();
     $link = BackendUtility::getModuleUrl('record_edit', array('edit[' . $table . '][' . $uid . ']' => 'edit'));
     if ($this->iParts[0] === 'pages' && $this->iParts[1] && $this->backendUser->check('modules', $pageModule)) {
         $this->editPageIconSet = true;
     }
     $editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=' . GeneralUtility::quoteJSvalue($link . '&returnUrl=') . '+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search);}';
     return $this->linkItem($this->label('edit'), $theIcon, $editOnClick . ';');
 }
コード例 #2
0
ファイル: DataHandler.php プロジェクト: rickymathew/TYPO3.CMS
 /**
  * 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);
         }
     }
 }
コード例 #3
0
 /**
  * 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');
                 $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
                 // Clearing additional cache tables:
                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'])) {
                     foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'] as $tableName) {
                         GeneralUtility::deprecationLog('Hook clearAllCache_additionalTables in DataHandler is deprecated in 6.2 and will be removed two versions later. Use the caching framework with database backend instead.');
                         if (!preg_match('/[^[:alnum:]_]/', $tableName) && substr($tableName, -5) === 'cache') {
                             $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery($tableName);
                         } else {
                             throw new \RuntimeException('TYPO3 Fatal Error: Trying to flush table "' . $tableName . '" with "Clear All Cache"', 1270853922);
                         }
                     }
                 }
             }
             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 (\TYPO3\CMS\Core\Utility\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 (count($tagsToFlush) > 0) {
         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);
         }
     }
 }
コード例 #4
0
ファイル: DataHandler.php プロジェクト: noxludo/TYPO3v4-Core
 /**
  * Clears the cache based on the command $cacheCmd.
  *
  * $cacheCmd='pages':	Clears cache for all pages. 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.
  *
  * $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
  * t3lib_div::callUserFunction()).
  *
  * Note: The following cache_* are intentionally not cleared by
  * $cacheCmd='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.
  *
  * @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->internal_clearPageCache();
             }
             break;
         case 'all':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
                 // Clear all caching framework caches
                 $GLOBALS['typo3CacheManager']->flushCaches();
                 if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
                     $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
                 }
                 // Clearing additional cache tables:
                 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'])) {
                     foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'] as $tableName) {
                         if (!preg_match('/[^[:alnum:]_]/', $tableName) && substr($tableName, -5) === 'cache') {
                             $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery($tableName);
                         } else {
                             throw new \RuntimeException('TYPO3 Fatal Error: Trying to flush table "' . $tableName . '" with "Clear All Cache"', 1270853922);
                         }
                     }
                 }
             }
             \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
             break;
         case 'temp_cached':
             \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
             break;
     }
     $tagsToFlush = array();
     // Clear cache for a page ID!
     if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($cacheCmd)) {
         if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
             $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!
                     \TYPO3\CMS\Core\Utility\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 (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr(strtolower($cacheCmd), 'cachetag:')) {
         $cacheTag = substr($cacheCmd, 9);
         $tagsToFlush[] = $cacheTag;
     }
     // process caching framwork operations
     if (count($tagsToFlush) > 0) {
         /** @var $pageCache \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend */
         $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
         /** @var $pageSectionCache \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend */
         $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
         foreach ($tagsToFlush as $tag) {
             $pageCache->flushByTag($tag);
             $pageSectionCache->flushByTag($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) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
         }
     }
 }
コード例 #5
0
 /**
  * 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)', [$this->BE_USER->user['username'], $cacheCmd]);
     }
     switch (strtolower($cacheCmd)) {
         case 'pages':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) {
                 $this->getCacheManager()->flushCachesInGroup('pages');
             }
             break;
         case 'all':
             // allow to clear all caches if the TS config option is enabled or the option is not explicitly
             // disabled for admins (which could clear all caches by default). The latter option is useful
             // for big production sites where it should be possible to restrict the cache clearing for some admins.
             if ($this->BE_USER->getTSConfigVal('options.clearCache.all') || $this->admin && $this->BE_USER->getTSConfigVal('options.clearCache.all') !== '0') {
                 $this->getCacheManager()->flushCaches();
                 GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('cache_treelist')->truncate('cache_treelist');
                 // Delete Opcode Cache
                 GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive();
             }
             break;
         case 'temp_cached':
         case 'system':
             GeneralUtility::deprecationLog('Calling clear_cacheCmd() with arguments \'temp_cached\' or \'system\', using' . ' the TS config option \'options.clearCache.system\' has been deprecated.');
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system')) {
                 $this->getCacheManager()->flushCachesInGroup('system');
             }
             break;
     }
     $tagsToFlush = [];
     // Clear cache for a page ID!
     if (MathUtility::canBeInterpretedAsInteger($cacheCmd)) {
         $list_cache = [$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 = ['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)) {
         $this->getCacheManager()->flushCachesInGroupByTags('pages', $tagsToFlush);
     }
     // Call post processing function for clear-cache:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'])) {
         $_params = ['cacheCmd' => strtolower($cacheCmd)];
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'] as $_funcRef) {
             GeneralUtility::callUserFunction($_funcRef, $_params, $this);
         }
     }
 }