/**
  * @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();
     }
 }
 function beforeCallActionHandler($request, $action)
 {
     if (!$this->owner->response->isFinished() && $action == 'build' && $request->getVar('flush')) {
         SS_TemplateLoader::instance()->getManifest()->regenerate(true);
         SSViewer::flush_template_cache();
     }
 }
 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
0
 function setUp()
 {
     // The first DB test will sort out the DB, we don't have to
     SSViewer::flush_template_cache();
 }
Пример #5
0
<?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('*****@*****.**'), 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
0
	function setUp() {
		SapphireTest::create_temp_db();
		SSViewer::flush_template_cache();
	}
/**
 * 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();
}
 /**
  * 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();
 }