本文整理汇总了PHP中clearCache函数的典型用法代码示例。如果您正苦于以下问题:PHP clearCache函数的具体用法?PHP clearCache怎么用?PHP clearCache使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearCache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (!pageArray(2)) {
forward("admin/plugins");
}
$guid = pageArray(2);
adminGateKeeper();
$plugin = getEntity($guid);
classGateKeeper($plugin, "Plugin");
$plugin->status = "disabled";
$plugin->save();
Cache::clear();
Cache::clear();
Admintab::deleteAll();
Setting::updateSettingsTable();
clearCache();
Cache::clear();
Systemvariable::set("setup_complete", false);
$translations = getEntities(array("type" => "Translationentity"));
if ($translations) {
foreach ($translations as $translation) {
$translation->delete();
}
}
new SystemMessage("Your plugin has been disabled.");
forward("admin/plugins");
}
示例2: clear_cache
/**
* function to clear all cache data
* by default accessible only for admin
*
* @access Public
* @return void
*/
public function clear_cache()
{
$this->autoRender = false;
Cache::clear();
clearCache();
$files = array();
$files = array_merge($files, glob(CACHE . '*'));
// remove cached css
$files = array_merge($files, glob(CACHE . 'css' . DS . '*'));
// remove cached css
$files = array_merge($files, glob(CACHE . 'js' . DS . '*'));
// remove cached js
$files = array_merge($files, glob(CACHE . 'models' . DS . '*'));
// remove cached models
$files = array_merge($files, glob(CACHE . 'persistent' . DS . '*'));
// remove cached persistent
foreach ($files as $f) {
if (is_file($f)) {
unlink($f);
}
}
if (function_exists('apc_clear_cache')) {
apc_clear_cache();
apc_clear_cache('user');
}
$this->set(compact('files'));
$this->layout = 'ajax';
}
示例3: admin_upgrade
function admin_upgrade($name = null)
{
if (empty($name)) {
$this->Session->setFlash(__d('upgrader', 'Missing config name', true));
$this->redirect('/admin');
}
clearCache(null, 'models');
App::import('Lib', 'Upgrader.Upgrader');
$upgrader = new Upgrader($name);
$sErrors = $upgrader->check(true);
if (!$sErrors) {
$this->Session->setFlash(__d('upgrader', 'The database is valid', true));
//$this->redirect(array('plugin'=>'upgrader','controller'=>'upgrader','action'=>'index'));
$this->redirect('/admin');
}
$this->set('name', $name);
//debug($sErrors);
if (!empty($this->params['named']['start'])) {
$error = array();
$step = empty($this->params['named']['step']) ? 1 : $this->params['named']['step'];
$res = $upgrader->run($error);
if ($res === 'break') {
$this->redirect(array('start' => '1', 'step' => $step++));
}
if ($res === true) {
$this->Session->setFlash(__d('upgrader', 'The database has been fixed', true));
//$this->redirect(array('plugin'=>'upgrader','controller'=>'upgrader','action'=>'index'));
$this->redirect('/admin');
} else {
$this->Session->setFlash(__d('upgrader', 'An error occurred', true) . ' :<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
}
}
}
示例4: __construct
public function __construct()
{
$guid = pageArray(2);
adminGateKeeper();
$plugin = getEntity($guid);
Setting::updateSettingsTable();
clearCache();
Cache::clear();
Cache::clear();
if ($plugin->enable()) {
new SystemMessage("Plugin Enabled");
new Cache("enabled_plugins_", false, "site");
new Cache("enabled_plugins_reversed", false, "site");
Systemvariable::set("setup_complete", false);
forward("admin/plugins");
}
Setting::updateSettingsTable();
clearCache();
Cache::clear();
Cache::clear();
Admintab::deleteAll();
$translations = getEntities(array("type" => "Translationentity"));
if ($translations) {
foreach ($translations as $translation) {
$translation->delete();
}
}
new SystemMessage("Your plugin can't be enabled. Check requirements");
forward("admin/plugins");
}
示例5: admin_clear_cache
public static function admin_clear_cache()
{
$cachePaths = array('persistent');
foreach ($cachePaths as $config) {
clearCache(null, $config);
}
}
示例6: index
public function index()
{
//清除缓存
clearCache();
$this->home = HOME_PATH;
$this->m = "../" . M_PATH;
$this->display();
}
示例7: insert
public function insert()
{
foreach ($_POST["types"] as $k => $p) {
if ($p) {
clearCache($k);
}
}
}
示例8: clearProductCache
/**
* Clear product cache for Cake/App
*
* @param $marketId
* @param $locale
* @param $duration
* @param $sku
*/
public function clearProductCache($marketId, $locale, $duration, $sku)
{
$cache_key = strtolower('cake_' . $duration . '_' . preg_replace('/\\B([A-Z])/', '_$1', $marketId . $locale . $sku));
/**
* Clear Cache for sku
*/
$success = clearCache($cache_key, '', '');
$this->set(['success' => $success, 'result' => $cache_key, '_serialize' => ['success', 'result']]);
}
示例9: submit
public function submit()
{
$dirs = $_POST['id'];
//dump($dirs);
foreach ($dirs as $value) {
clearCache($type = 0, $path = $value);
$say .= "清理缓存文件夹成功! " . $value . "</br>";
}
$this->success($say);
}
示例10: admin_clearcache
function admin_clearcache()
{
//debug($configure);
if (clearCache()) {
$this->Session->setFlash(__('CakePHPs Cache is cleared!', true));
} else {
$this->Session->setFlash(__('CakePHPs Cache was not cleared!', true));
}
$this->redirect('/admin/settings/');
}
示例11: admin_upgrade
function admin_upgrade()
{
clearCache(null, 'models');
$sErrors = NewsletterUpgrade::check();
if (!$sErrors) {
$this->Session->setFlash(__d('newsletter', 'The database is valid', true));
$this->redirect(array('plugin' => 'newsletter', 'controller' => 'newsletter', 'action' => 'index'));
}
//debug($sErrors);
if (!empty($this->params['named']['start'])) {
$error = array();
$step = empty($this->params['named']['step']) ? 1 : $this->params['named']['step'];
$res = NewsletterUpgrade::run($error);
if ($res === 'break') {
$this->redirect(array('start' => '1', 'step' => $step++));
}
if ($res === true) {
$this->Session->setFlash(__d('newsletter', 'The database has been fixed', true));
$this->redirect(array('plugin' => 'newsletter', 'controller' => 'newsletter', 'action' => 'index'));
} else {
$this->Session->setFlash(__d('newsletter', 'An error occurred', true) . ' :<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
}
/*
App::import('Lib', 'Newsletter.QueryUtil');
if(!empty($sErrors['missing_table'])){
$this->_fix_missing_tables($sErrors,$error);
}elseif(!empty($sErrors['field_mismatch'])){
if(in_array('NewsletterEmail.sendlist_id',$sErrors['field_mismatch']['fields'])){
$this->_fix_email_list_relation($sErrors,$error);
}
if(in_array('NewsletterSended.sendlist_id',$sErrors['field_mismatch']['fields'])){
$this->_fix_sended_tabled($sErrors,$error);
}
if(in_array('NewsletterSended.newsletter_variant_id',$sErrors['field_mismatch']['fields'])){
$this->_fix_sended_variant($sErrors,$error);
}
if(in_array('NewsletterSended.name',$sErrors['field_mismatch']['fields'])){
$this->_fix_sended_name($sErrors,$error);
}
clearCache(null, 'models');
}
if(!empty($error)){
$this->Session->setFlash(
__d('newsletter','An error occurred', true)
.' :<ul><li>'
.implode('</li><li>',$error)
.'</li></ul>'
);
}else{
$this->Session->setFlash(__d('newsletter','The database has been fixed', true));
$this->redirect(array('plugin'=>'newsletter','controller'=>'newsletter','action'=>'index'));
}
*/
}
}
示例12: delComment
function delComment(&$Model, $c_id, $u_id)
{
$owner = $Model->Comment->read('name', $c_id);
if ($u_id == $owner['Comment']['name']) {
# clear cache
clearCache($this->cacheName, '', '');
return $Model->deleteComment($c_id);
} else {
return false;
}
}
示例13: __construct
public function __construct()
{
adminGateKeeper();
$settings = getEntities(array("type" => "Setting"));
foreach ($settings as $setting) {
$setting->delete();
}
Systemvariable::set("setup_complete", "false");
clearCache();
Cache::clear();
forward();
}
示例14: myClearCache
function myClearCache($pattern)
{
App::import('Core', 'Folder');
$folder = new Folder(CACHE . 'views');
$files = $folder->find('.*' . $pattern . '.*');
if (!empty($files)) {
foreach ($files as $file) {
$file = r('.php', '', $file);
clearCache($file);
}
}
}
示例15: _save
function _save()
{
$response = array();
$this->Discussion->isNew = false;
if ($this->Discussion->store($this->data)) {
$response[] = "jQuery('#jr_postForm" . $this->data['Discussion']['discussion_id'] . "').slideUp('slow',function(){jQuery(this).html('');});";
$response[] = "jreviews_admin.menu.moderation_counter('discussion_count');";
}
clearCache('', 'views');
clearCache('', '__data');
return $this->ajaxResponse($response);
}