本文整理汇总了PHP中Cache::disableCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::disableCache方法的具体用法?PHP Cache::disableCache怎么用?PHP Cache::disableCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::disableCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/** Executes the job.
* @return string Returns a string describing the job result in case of success.
* @throws Exception Throws an exception in case of errors.
*/
public function run() {
Cache::disableCache();
Cache::disableLocalCache();
try {
$db = Loader::db();
$instances = array(
'navigation' => Loader::helper('navigation'),
'dashboard' => Loader::helper('concrete/dashboard'),
'view_page' => PermissionKey::getByHandle('view_page')
);
$rsPages = $db->query('SELECT cID FROM Pages WHERE (cID > 1) ORDER BY cID');
$relName = ltrim(SITEMAPXML_FILE, '\\/');
$osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
$urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
if(!file_exists($osName)) {
@touch($osName);
}
if(!is_writable($osName)) {
throw new Exception(t('The file %s is not writable', $osName));
}
if(!$hFile = fopen($osName, 'w')) {
throw new Exception(t('Cannot open file %s', $osName));
}
if(!@fprintf($hFile, '<?xml version="1.0" encoding="%s"?>' . self::EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">', APP_CHARSET)) {
throw new Exception(t('Error writing header of %s', $osName));
}
$addedPages = 0;
if(self::AddPage($hFile, 1, $instances)) {
$addedPages++;
}
while($rowPage = $rsPages->FetchRow()) {
if(self::AddPage($hFile, intval($rowPage['cID']), $instances)) {
$addedPages++;
}
}
$rsPages->Close();
unset($rsPages);
if(!@fwrite($hFile, self::EOL . '</urlset>')) {
throw new Exception(t('Error writing footer of %s', $osName));
}
@fflush($hFile);
@fclose($hFile);
unset($hFile);
return t('%1$s file saved (%2$d pages).', $urlName, $addedPages);
}
catch(Exception $x) {
if(isset($rsPages) && $rsPages) {
$rsPages->Close();
$rsPages = null;
}
if(isset($hFile) && $hFile) {
@fflush($hFile);
@ftruncate($hFile, 0);
@fclose($hFile);
$hFile = null;
}
throw $x;
}
}
示例2: run
public function run() {
Cache::disableCache();
Loader::library('database_indexed_search');
$is = new IndexedSearch();
if ($_GET['force'] == 1) {
Loader::model('attribute/categories/collection');
Loader::model('attribute/categories/file');
Loader::model('attribute/categories/user');
$attributes = CollectionAttributeKey::getList();
$attributes = array_merge($attributes, FileAttributeKey::getList());
$attributes = array_merge($attributes, UserAttributeKey::getList());
foreach($attributes as $ak) {
$ak->updateSearchIndex();
}
$result = $is->reindexAll(true);
} else {
$result = $is->reindexAll();
}
if ($result->count == 0) {
return t('Indexing complete. Index is up to date');
} else {
if ($result->count == $is->searchBatchSize) {
return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
} else {
return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages'));
}
}
}
示例3: getLatestAvailableVersionNumber
public function getLatestAvailableVersionNumber() {
if (defined('MULTI_SITE') && MULTI_SITE == 1) {
$updates = Update::getLocalAvailableUpdates();
$multiSiteVersion = 0;
foreach($updates as $up) {
if (version_compare($up->getUpdateVersion(), $multiSiteVersion, '>')) {
$multiSiteVersion = $up->getUpdateVersion();
}
}
Config::save('APP_VERSION_LATEST', $multiSiteVersion);
return $multiSiteVersion;
}
$d = Loader::helper('date');
// first, we check session
$queryWS = false;
Cache::disableCache();
$vNum = Config::get('APP_VERSION_LATEST', true);
Cache::enableCache();
if (is_object($vNum)) {
$seconds = strtotime($vNum->timestamp);
$version = $vNum->value;
if (is_object($version)) {
$versionNum = $version->version;
} else {
$versionNum = $version;
}
$diff = time() - $seconds;
if ($diff > APP_VERSION_LATEST_THRESHOLD) {
// we grab a new value from the service
$queryWS = true;
}
} else {
$queryWS = true;
}
if ($queryWS) {
Loader::library('marketplace');
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
$update = Update::getLatestAvailableUpdate();
$versionNum = $update->version;
if ($versionNum) {
Config::save('APP_VERSION_LATEST', $versionNum);
if (version_compare($versionNum, APP_VERSION, '>')) {
Loader::model('system_notification');
SystemNotification::add(SystemNotification::SN_TYPE_CORE_UPDATE, t('A new version of concrete5 is now available.'), '', $update->notes, View::url('/dashboard/system/update'));
}
} else {
// we don't know so we're going to assume we're it
Config::save('APP_VERSION_LATEST', APP_VERSION);
}
}
return $versionNum;
}
示例4: on_start
public function on_start()
{
$this->secCheck();
// if you just reverted, but didn't manually clear out your files - cache would be a prob here.
$ca = new Cache();
$ca->flush();
Cache::disableCache();
Cache::disableLocalCache();
$this->site_version = Config::get('SITE_APP_VERSION');
Database::ensureEncoding();
}
示例5: on_start
public function on_start()
{
$cnt = Loader::controller('/dashboard/system/backup_restore/update');
$cnt->secCheck();
// if you just reverted, but didn't manually clear out your files - cache would be a prob here.
$ca = new Cache();
$ca->flush();
Cache::disableCache();
Cache::disableLocalCache();
$this->site_version = Config::get('SITE_APP_VERSION');
Database::ensureEncoding();
}
示例6: on_start
/**
* Testing
*/
public function on_start()
{
if (isset($_POST['locale']) && $_POST['locale']) {
define("ACTIVE_LOCALE", $_POST['locale']);
$this->set('locale', $_POST['locale']);
}
require DIR_BASE_CORE . '/config/file_types.php';
Cache::disableCache();
$this->setRequiredItems();
$this->setOptionalItems();
Loader::model('package/starting_point');
if (file_exists(DIR_CONFIG_SITE . '/site.php')) {
throw new Exception(t('concrete5 is already installed.'));
}
}
示例7: run
/** Executes the job.
* @return string Returns a string describing the job result in case of success.
* @throws Exception Throws an exception in case of errors.
*/
public function run()
{
Cache::disableCache();
Cache::disableLocalCache();
try {
$db = Loader::db();
$instances = array('navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
$instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
$xmlDoc = new SimpleXMLElement('<' . '?xml version="1.0" encoding="' . APP_CHARSET . '"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
$rs = Loader::db()->Query('SELECT cID FROM Pages');
while ($row = $rs->FetchRow()) {
self::addPage($xmlDoc, intval($row['cID']), $instances);
}
$rs->Close();
Events::fire('on_sitemap_xml_ready', $xmlDoc);
$dom = dom_import_simplexml($xmlDoc)->ownerDocument;
$dom->formatOutput = true;
$addedPages = count($xmlDoc->url);
$relName = ltrim(SITEMAPXML_FILE, '\\/');
$osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
$urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
if (!file_exists($osName)) {
@touch($osName);
}
if (!is_writable($osName)) {
throw new Exception(t('The file %s is not writable', $osName));
}
if (!($hFile = @fopen($osName, 'w'))) {
throw new Exception(t('Cannot open file %s', $osName));
}
if (!@fwrite($hFile, $dom->saveXML())) {
throw new Exception(t('Error writing to file %s', $osName));
}
@fflush($hFile);
@fclose($hFile);
unset($hFile);
return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
} catch (Exception $x) {
if (isset($hFile) && $hFile) {
@fflush($hFile);
@ftruncate($hFile, 0);
@fclose($hFile);
$hFile = null;
}
throw $x;
}
}
示例8: on_start
/**
* Testing
*/
public function on_start() {
if (isset($_POST['locale']) && $_POST['locale']) {
define("ACTIVE_LOCALE", $_POST['locale']);
$this->set('locale', $_POST['locale']);
}
require(DIR_BASE_CORE . '/config/file_types.php');
Cache::disableCache();
Cache::disableLocalCache();
$this->setRequiredItems();
$this->setOptionalItems();
Loader::model('package/starting_point');
if (file_exists(DIR_CONFIG_SITE . '/site.php')) {
throw new Exception(t('concrete5 is already installed.'));
}
if (!isset($_COOKIE['CONCRETE5_INSTALL_TEST'])) {
setcookie('CONCRETE5_INSTALL_TEST', '1', 0, DIR_REL . '/');
}
}
示例9: handleDetail
/**
* handle detail request
*/
private function handleDetail()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// process attachments
$attachment = $this->getAttachment();
$attachment->handleHttpGetRequest();
// clear subtitle
$view->setName('');
// check security
if (!$request->exists('id')) {
throw new Exception('Poll item is missing.');
}
$id = intval($request->getValue('id'));
$key = array('id' => $id, 'activated' => true);
if (!$this->exists($key)) {
throw new HttpException('404');
}
$detail = $this->getDetail($key);
// check if tree node of poll item is accessable
$tree = $this->director->tree;
if (!$tree->exists($detail['tree_id'])) {
throw new HttpException('404');
}
// process request
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($detail['tag']);
// disable cache because we want to count visits
$template->setCacheable(false);
Cache::disableCache();
// update view counter
$this->updateCount($key);
// overwrite default naming
$template->setVariable('pageTitle', $detail['name'], false);
// add breadcrumb item
$url = new Url(true);
$url->clearParameter('id');
$breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
$this->director->theme->addBreadcrumb($breadcrumb);
// check if template is in cache
/*
if(!$template->isCached())
{
$template->setVariable('poll', $detail, false);
}
*/
$template->setVariable('poll', $detail, false);
$settings = $this->getPollSettings();
$treeSettings = $settings->getSettings($detail['tag'], $detail['tree_id']);
$template->setVariable('newssettings', $treeSettings, false);
// get settings
if ($treeSettings['item']) {
// process items
$item = $this->getItem();
$item->handleHttpGetRequest();
}
$url = new Url(true);
$url->clearParameter('id');
$url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
$template->setVariable('href_back', $url->getUrl(true), false);
$this->template[$detail['tag']] = $template;
}
示例10: handleDetail
/**
* handle detail request
*/
private function handleDetail()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// it makes no sense to have multiple tags for this plugin.
// if someone did it, you get strange results and he probably can figure out why.. no multiple detail stuff in 1 page supported!
// so take a shot and get the first tag to set the content
$taglist = $this->plugin->getTagList(array('plugin_type' => News::TYPE_ARCHIVE));
if (!$taglist) {
return;
}
$taginfo = current($taglist);
// process attachments
$attachment = $this->getAttachment();
$attachment->handleHttpGetRequest();
// clear subtitle
$view->setName('');
if (!$request->exists('id')) {
continue;
}
$id = intval($request->getValue('id'));
$key = array('id' => $id, 'active' => true);
$overview = $this->getNewsOverview();
if (!$overview->exists($key)) {
throw new HttpException('404');
}
$detail = $overview->getDetail($key);
// check if tree node of news item is accessable
$tree = $this->director->tree;
if (!$tree->exists($detail['tree_id'])) {
throw new HttpException('404');
}
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($detail['tag']);
// disable cache because we want to count visits
$template->setCacheable(false);
Cache::disableCache();
// update view counter
$overview->updateCount($key);
// overwrite default naming
$template->setVariable('pageTitle', $detail['name'], false);
$template->setVariable('news', $detail, false);
$url = new Url(true);
$url->clearParameter('id');
$url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
$template->setVariable('href_back', $url->getUrl(true), false);
$breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
$this->director->theme->addBreadcrumb($breadcrumb);
$this->template[$taginfo['tag']] = $template;
}
示例11: handleGet
/**
* handle overview request
*/
private function handleGet()
{
$view = ViewManager::getInstance();
$request = Request::getInstance();
// disable caching of current page
Cache::disableCache();
$tree = $this->director->tree;
$taglist = $this->getTagList();
//if(!$taglist) return;
//FIXME this is used by plugins that are connected on the fly (like the login plugin) ( check what means the following statement: either way it has a tree_id bug)
//ORIGINAL COMMENT: FIXME check if this is used (i dont think so, but you never know) (either way it has a tree_id bug)
if (!$taglist) {
$taglist[] = array('tree_id' => $tree->currentIdExists(), 'tag' => $this->director->theme->getConfig()->main_tag);
}
$autentication = Authentication::getInstance();
$login = $autentication->isLogin();
foreach ($taglist as $item) {
// clear login state
if ($login && ($item['plugin_type'] == Login::TYPE_LOGINOUT || $item['plugin_type'] == Login::TYPE_LOGOUT)) {
$autentication->logout();
header("Location: /");
exit;
}
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$settings = $this->exists($key) ? $this->getDetail($key) : $this->getFields(SqlParser::MOD_INSERT);
$template->setVariable('settings', $settings);
$template->setVariable('tag', $item['tag']);
$template->setVariable('referer', $request->getUrl());
$this->template[$item['tag']] = $template;
}
}
示例12: handleActivateGet
/**
* handle activate request
*/
private function handleActivateGet()
{
$view = ViewManager::getInstance();
$request = Request::getInstance();
$systemUser = new SystemUser();
$loginRequest = new LoginRequest();
$view->setType(self::VIEW_ACTIVATE);
if (!$request->exists('key')) {
throw new Exception('Key is missing.');
}
$key = $request->getValue('key');
if (!$key) {
throw new Exception('Key is missing.');
}
// delete expired requests
$loginRequest->delete(array('expired' => true));
// get request details
$requestKey = array('request_key' => $key);
if (!$loginRequest->exists($requestKey)) {
throw new Exception('Request does not exist.');
}
$requestInfo = $loginRequest->getDetail($requestKey);
// get user details
$userKey = array('id' => $requestInfo['usr_id']);
if (!$systemUser->exists($userKey)) {
throw new Exception('Request does not exist.');
}
$user = $systemUser->getDetail(array('id' => $requestInfo['usr_id']));
// disable caching of current page
Cache::disableCache();
$taglist = $this->getTagList();
if (!$taglist) {
return;
}
foreach ($taglist as $item) {
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$settingsKey = array('tag' => $item['tag'], 'tree_id' => $item['tree_id']);
$settings = $this->getDetail($settingsKey);
$template->setVariable('settings', $settings);
$template->setVariable('userinfo', $user, false);
$template->setVariable($requestInfo, NULL, false);
$template->setVariable('tag', $item['tag']);
$this->template[$item['tag']] = $template;
}
}
示例13: handleDetail
/**
* handle detail request
*/
private function handleDetail()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// process attachments
$attachment = $this->plugin->getObject(Calendar::TYPE_ATTACHMENT);
$attachment->handleHttpGetRequest();
// process images
$image = $this->plugin->getObject(Calendar::TYPE_IMAGE);
$image->handleHttpGetRequest();
// clear subtitle
$view->setName('');
// check security
if (!$request->exists('id')) {
throw new Exception('Calendar id is missing.');
}
$id = intval($request->getValue('id'));
$key = array('id' => $id, 'activated' => $settings['history'] ? strftime('%Y-%m-%d', $settings['history']) : '');
if (!$this->exists($key)) {
throw new HttpException('404');
}
$detail = $this->getDetail($key);
$objSettings = $this->plugin->getObject(Calendar::TYPE_SETTINGS);
$settings = $objSettings->getSettings($detail['tree_id'], $detail['tag']);
// check if tree node of cal item is accessable
$tree = $this->director->tree;
if (!$tree->exists($detail['tree_id'])) {
throw new HttpException('404');
}
if ($detail['thumbnail']) {
$img = new Image($detail['thumbnail'], $this->plugin->getContentPath(true));
$detail['thumbnail'] = array('src' => $this->plugin->getContentPath(false) . $img->getFileName(false), 'width' => $img->getWidth(), 'height' => $img->getHeight());
}
// process request
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($detail['tag']);
// disable cache because we want to count visits
$template->setCacheable(false);
Cache::disableCache();
// update view counter
$this->updateCount($key);
// overwrite default naming
$template->setVariable('pageTitle', $detail['name'], false);
// add breadcrumb item
$url = new Url(true);
$url->clearParameter('id');
$breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
$this->director->theme->addBreadcrumb($breadcrumb);
$template->setVariable('cal', $detail, false);
$template->setVariable('settings', $settings);
$template->setVariable('calsettings', $settings, false);
// get settings
if ($settings['comment']) {
// process comments
$comment = $this->plugin->getObject(Calendar::TYPE_COMMENT);
$comment->setSettings($settings);
$comment->handleHttpGetRequest();
}
$url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
$template->setVariable('href_back', $url->getUrl(true), false);
$this->template[$detail['tag']] = $template;
}
示例14: delete
public function delete($cfKey, $pkgID = null) {
if ($pkgID > 0) {
unset($this->rows["{$cfKey}.{$pkgID}"]);
$this->db->query(
"delete from Config where cfKey = ? and pkgID = ?",
array($cfKey, $pkgID)
);
} else {
foreach ($this->rows as $key => $row) {
if ($row['cfKey'] == $cfKey) {
unset($this->rows[$key]);
}
}
$this->db->query(
"delete from Config where cfKey = ?",
array($cfKey)
);
}
if (defined('ENABLE_CACHE') && (!ENABLE_CACHE)) {
// if cache has been explicitly disabled, we re-enable it anyway.
Cache::enableCache();
}
Cache::set('config_options', 'all', $this->rows);
if (defined('ENABLE_CACHE') && (!ENABLE_CACHE)) {
// if cache has been explicitly disabled, we re-enable it anyway.
Cache::disableCache();
}
}
示例15: handleOverview
/**
* handle overview request
*/
private function handleOverview()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// retrieve tags that are linked to this plugin
$taglist = $this->plugin->getTagList();
if (!$taglist) {
return;
}
foreach ($taglist as $tag) {
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'current' => $request->exists("bnr{$tag['tag']}", Request::SESSION) ? $request->getValue("bnr{$tag['tag']}", Request::SESSION) : 0, 'activated' => true);
// skip if no images available
if (!$this->exists($searchcriteria)) {
continue;
}
Cache::disableCache();
// get settings
$settings = $this->getSettings($searchcriteria);
$template->setVariable('settings', $settings, false);
switch ($settings['display_order']) {
case Banner::DISP_ORDER_LINEAR:
$banner = $this->getLinear($searchcriteria);
break;
default:
$banner = $this->getRandom($searchcriteria);
}
$template->setVariable('banner', $banner);
// save current id in session for next banner retrieval
$request->setValue("bnr{$banner['tag']}", $banner['id']);
// register view
$this->addView($banner);
$theme = $this->director->theme;
// add javascript start script
// skip if transition speed is insane fast
if ($settings['display'] != Banner::DISP_SINGLE && $banner['transition_speed'] > 1) {
$theme->addJavascript(sprintf('setTimeout("getNextBanner(%d, %d, \'%s\', %d)", %d*1000);', $banner['id'], $banner['tree_id'], $banner['tag'], $banner['display_order'], $banner['transition_speed']));
}
// parse unique stylesheet
// retrieve tag to postfix scripts and stylesheets for uniqueness (there can be more than 1 banner in a single page)
$parseFile = new ParseFile();
$parseFile->setVariable('banner', $banner, false);
$parseFile->setSource($this->plugin->getHtdocsPath(true) . "css/banner.css.in");
//$parseFile->setDestination($this->plugin->getCachePath(true)."banner_{$tag['tree_id']}{$tag['tag']}.css");
//$parseFile->save();
$theme->addStylesheet($parseFile->fetch());
$this->template[$tag['tag']] = $template;
}
}