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


PHP SSViewer::flush_template_cache方法代码示例

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


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

示例1: run

 /**
  * @inheritdoc
  */
 public function run($request)
 {
     /* Get the protocol and host */
     list($protocol, $host) = explode('://', Director::absoluteBaseURL());
     $host = trim($host, '/\\');
     try {
         /* Flush via SSViewer, this is a clean flush */
         echo 'Flushing SSViewer caches<br />';
         SSViewer::flush_template_cache();
         /* Remove the entire cache directory forcefully. Hard, unclean flush */
         echo 'Removing temp folder ' . TEMP_FOLDER . '<br />';
         exec('rm -rf ' . TEMP_FOLDER);
         if (!file_exists(TEMP_FOLDER)) {
             /* Show a success-message if the TEMP_FOLDER is gone */
             echo 'Succesfully purged the temporary folder. A rebuild of caches is necessary now.<br />';
         }
         /* Flush Varnish. If it isn't available, this _might_ crash. Previous statements have been executed though */
         echo "Flushing Varnish cache for host {$host}<br />";
         exec('flushvarnish -h ' . $host);
         /* Be friendly to the user */
         echo 'Done clearing caches, please reload your site: <a href="' . Director::absoluteBaseURL() . '">here</a><br />';
         echo 'Please note, all protocols have the same cache, so not only ' . $protocol . 'is cleared';
     } catch (Exception $e) {
         /* When boom, error out */
         echo 'Error while clearing caches: ' . $e->getMessage();
     }
 }
开发者ID:silverstripe-europe-meetup,项目名称:website-2015,代码行数:30,代码来源:FlushCaches.php

示例2: beforeCallActionHandler

 function beforeCallActionHandler($request, $action)
 {
     if (!$this->owner->response->isFinished() && $action == 'build' && $request->getVar('flush')) {
         SS_TemplateLoader::instance()->getManifest()->regenerate(true);
         SSViewer::flush_template_cache();
     }
 }
开发者ID:Tangdongle,项目名称:silverstripe-betternavigator,代码行数:7,代码来源:FlushOnDevBuild.php

示例3: settheme

 public function settheme(HTTPRequest $request)
 {
     $newTheme = $request->param("ID");
     $newTheme = Convert::raw2sql($newTheme);
     DB::query("Update SiteConfig SET Theme = '{$newTheme}';");
     Session::set("theme", $newTheme);
     SSViewer::flush_template_cache();
     $this->redirect($this->Link());
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-test,代码行数:9,代码来源:Page.php

示例4: setUp

 function setUp()
 {
     // The first DB test will sort out the DB, we don't have to
     SSViewer::flush_template_cache();
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:5,代码来源:TestRunner.php

示例5: ini_set

<?php

/**********************
 * 
 * Errors / Dev
 * 
 **********************/
//
//Force enviroment to Dev ** REMOVE FOR LIVE SITES **
Director::set_environment_type("dev");
//
//Force cache to flush on page load if in Dev mode (prevents needing ?flush=1 on the end of a URL)
if (Director::isDev()) {
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    SSViewer::flush_template_cache();
    Debug::log_errors_to('err.log');
}
//(v2.4) Log errors to an email address
//SS_Log::add_writer(new SS_LogEmailWriter('me@mydomain.com'), SS_Log::ERR);
//
//(v2.4) Log errors to a file
//SS_Log::add_writer(new SS_LogFileWriter('error_log.txt'), SS_Log::ERR);
//
/**
 * Extended URL rules for the CMS module
 * 
 * @package cms
 */
Director::addRules(50, array('processes//$Action/$ID/$Batch' => 'BatchProcess_Controller', 'admin/help//$Action/$ID' => 'CMSHelp', 'admin/bulkload//$Action/$ID/$OtherID' => 'BulkLoaderAdmin', 'admin/cms//$Action/$ID/$OtherID' => 'CMSMain', 'PageComment//$Action/$ID' => 'PageComment_Controller', 'dev/buildcache/$Action' => 'RebuildStaticCacheTask'));
CMSMenu::add_director_rules();
开发者ID:Raiser,项目名称:Praktikum,代码行数:31,代码来源:_config.php

示例6: setUp

	function setUp() {
		SapphireTest::create_temp_db();
		SSViewer::flush_template_cache();
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:4,代码来源:TestRunner.php

示例7: clear_templates

/**
 * Clears the template manifest
 * @param string $project
 * @return void
 */
function clear_templates($project = 'mysite')
{
    $manifest = new \SS_TemplateManifest(BASE_PATH, $project);
    $manifest->regenerate(true);
    \SSViewer::flush_template_cache();
}
开发者ID:helpfulrobot,项目名称:heyday-silverstripe-cacheclear,代码行数:11,代码来源:functions.php

示例8: flushTemplate

 /**
  * Clears cached template files.
  */
 public function flushTemplate()
 {
     // Rebuild the template manifest.
     $template = new SS_TemplateManifest(BASE_PATH, false, true);
     // Clear the template cache.
     SSViewer::flush_template_cache();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-sakemore,代码行数:10,代码来源:FlushCache.php


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