本文整理汇总了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();
}
}
示例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();
}
}
示例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());
}
示例4: setUp
function setUp()
{
// The first DB test will sort out the DB, we don't have to
SSViewer::flush_template_cache();
}
示例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();
示例6: setUp
function setUp() {
SapphireTest::create_temp_db();
SSViewer::flush_template_cache();
}
示例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();
}
示例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();
}