本文整理汇总了PHP中cache_clear_all函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_clear_all函数的具体用法?PHP cache_clear_all怎么用?PHP cache_clear_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_clear_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: phptemplate_settings
/**
* Implementation of THEMEHOOK_settings() function.
*
* @param $saved_settings
* array An array of saved settings for this theme.
* @return
* array A form array.
*/
function phptemplate_settings($saved_settings)
{
// Empty the cached css...
cache_clear_all('abessive_custom_css', 'cache');
$form = array();
require_once path_to_theme() . '/abessive_settings.php';
// Add Farbtastic color picker
drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
drupal_add_js('misc/farbtastic/farbtastic.js');
drupal_add_js(path_to_theme() . '/theme-settings.js');
$defaults = _abessive_default_settings();
$settings = array_merge($defaults, $saved_settings);
$form['abessive_picker'] = array('#type' => 'markup', '#value' => '<div id="picker"></div>');
$form['abessive_background_color'] = array('#type' => 'textfield', '#title' => t('Background Color'), '#description' => t('What colour should the body background behind all the containers be? Default: %val', array('%val' => $defaults['abessive_background_color'])), '#default_value' => $settings['abessive_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_border_color'] = array('#type' => 'textfield', '#title' => t('Border Color'), '#description' => t('What colour should the border around all the containers be? Default: %val', array('%val' => $defaults['abessive_border_color'])), '#default_value' => $settings['abessive_border_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_content_background_color'] = array('#type' => 'textfield', '#title' => t('Content Background Color'), '#description' => t('What colour should the background of all the containers be? Default: %val', array('%val' => $defaults['abessive_content_background_color'])), '#default_value' => $settings['abessive_content_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field', 'abessive_calculate_gradient'));
$form['abessive_content_background_color']['abessive_r5'] = $form['abessive_content_background_color']['abessive_r4'] = $form['abessive_content_background_color']['abessive_r3'] = $form['abessive_content_background_color']['abessive_r2'] = array('#type' => 'value', '#default_value' => 0);
$form['abessive_text_color'] = array('#type' => 'textfield', '#title' => t('Text Color'), '#description' => t('What colour should the text be? Default: %val', array('%val' => $defaults['abessive_text_color'])), '#default_value' => $settings['abessive_text_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Color'), '#description' => t('What colour should hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_color'])), '#default_value' => $settings['abessive_link_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_hover_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Hover Color'), '#description' => t('What colour should hyperlinks be when hovered over? Default: %val', array('%val' => $defaults['abessive_link_hover_color'])), '#default_value' => $settings['abessive_link_hover_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_link_active_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Active Color'), '#description' => t('What colour should active hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_active_color'])), '#default_value' => $settings['abessive_link_active_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field'));
$form['abessive_left_width'] = array('#type' => 'textfield', '#title' => t('Left Column Width'), '#description' => t('How wide should the left column be? Default: %val', array('%val' => $defaults['abessive_left_width'])), '#default_value' => $settings['abessive_left_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field'));
$form['abessive_right_width'] = array('#type' => 'textfield', '#title' => t('Right Column Width'), '#description' => t('How wide should the right column be? Default: %val', array('%val' => $defaults['abessive_right_width'])), '#default_value' => $settings['abessive_right_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field'));
$form['#submit'][] = 'abessive_submit_settings';
return $form;
}
示例2: clearAll
/**
* Clear all Zeitgeist cache entries.
*/
public static function clearAll()
{
$known_cids = array_keys(static::getCids());
foreach ($known_cids as $cid) {
$core_cid = static::prefixCid($cid);
cache_clear_all($core_cid, Cache::BIN);
}
variable_del(static::VARCIDS);
}
示例3: osha_update_menu_links
/**
* Update menu links
*/
function osha_update_menu_links()
{
db_update('menu_links')->fields(array('link_path' => 'tools-and-publications/publications', 'router_path' => 'tools-and-publications/publications'))->condition('mlid', '652')->execute();
db_update('menu_links')->fields(array('link_path' => 'inside-eu-osha/press-room', 'router_path' => 'inside-eu-osha/press-room'))->condition('mlid', '673')->execute();
db_update('menu_links')->fields(array('link_path' => 'inside-eu-osha/press-room', 'router_path' => 'inside-eu-osha/press-room'))->condition('mlid', '1704')->execute();
db_update('menu_links')->fields(array('link_path' => 'tools-and-publications/events', 'router_path' => 'tools-and-publications/events'))->condition('mlid', '1513')->execute();
db_update('block')->fields(array('pages' => 'tools-and-publications/events'))->condition('delta', '5322')->execute();
// Flush cache.
cache_clear_all();
}
示例4: refreshVariables
/**
* Refresh the in-memory set of variables.
*
* Refresh the in-memory set of variables. Useful after a page request is made
* that changes a variable in a different thread.
*
* This is an overridden version of the function provided by the Drupal test
* module. It maintains any settings created in settings.php (and it's
* corresponding global.inc) file.
*
* In other words calling a settings page with $this->drupalPost() with a
* changed value would update a variable to reflect that change, but in
* the thread that made the call (thread running the test) the changed
* variable would not be picked up.
*
* This method clears the variables cache and loads a fresh copy from
* the database to ensure that the most up-to-date set of variables is loaded.
*/
protected function refreshVariables()
{
global $conf;
cache_clear_all('variables', 'cache_bootstrap');
$variables = variable_initialize();
// Merge updated database variables back into $conf.
foreach ($variables as $name => $value) {
$conf[$name] = $value;
}
return $conf;
}
示例5: cleanup
function cleanup($config)
{
$res = db_query("SELECT cid FROM {cache} WHERE cid LIKE '%s%%'", 'htmlpurifier:');
while ($row = db_fetch_object($res)) {
$key = substr($row->cid, 13);
// 13 == strlen('htmlpurifier:')
if ($this->isOld($key, $config)) {
cache_clear_all($row->cid, 'cache');
}
}
}
示例6: deleteComments
private function deleteComments()
{
module_load_include('inc', 'comment', 'comment.admin');
$result = db_query("SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid");
while ($comment = db_fetch_object($result)) {
// Delete comment and its replies.
_comment_delete_thread($comment);
_comment_update_node_statistics($comment->nid);
}
// Clear the cache so an anonymous user sees that his comment was deleted.
cache_clear_all();
}
示例7: _update
/**
* (non-PHPdoc)
* @see Yamm_Entity::_update()
*/
protected function _update($object, $identifier)
{
// TODO we should check for all dependencies which are not data, such as
// handlers and modules (this is done by views_export module).
views_include('view');
// Should give us the '$view' variable
eval($object);
$view->save();
views_ui_cache_set($view);
menu_rebuild();
cache_clear_all('*', 'cache_views');
cache_clear_all();
}
示例8: cleanup
function cleanup($config)
{
// TODO: This does not work with the pluggable cache system in Drupal 7,
// since it assumes a database cache is being used.
$res = db_query("SELECT cid FROM {cache} WHERE cid LIKE :cid", array(':cid' => 'htmlpurifier:%'));
foreach ($res as $row) {
$key = substr($row->cid, 13);
// 13 == strlen('htmlpurifier:')
if ($this->isOld($key, $config)) {
cache_clear_all($row->cid, 'cache');
}
}
}
示例9: deleteNode
/**
* Delete a node.
*/
function deleteNode($nid)
{
// Implemention taken from node_delete, with some assumptions regarding
// function_exists removed.
$node = node_load($nid);
db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
// Call the node-specific callback (if any):
node_invoke($node, 'delete');
node_invoke_nodeapi($node, 'delete');
// Clear the page and block caches.
cache_clear_all();
}
示例10: visitContentPage
/**
* Visit a node page given its type and title.
*
* @param string $type
* The node type.
* @param string $title
* The node title.
*
* @Then I visit the :type content with title :title
*/
public function visitContentPage($type, $title)
{
$nodes = node_load_multiple([], ['title' => $title, 'type' => $type], TRUE);
if (!$nodes) {
throw new \InvalidArgumentException("Node of type '{$type}' and title '{$title}' not found.");
}
// Get node path without any base path by setting 'base_url' and 'absolute'.
$node = array_shift($nodes);
$path = 'node/' . $node->nid;
cache_clear_all($path, 'cache_path');
$path = url($path, ['base_url' => '', 'absolute' => TRUE]);
// Visit newly created node page.
$this->visitPath($path);
}
示例11: action_results
function action_results()
{
// Get the results from the drupal cache and clear them.
$results = cache_get('publisher_batch_results');
$success = cache_get('publisher_batch_success');
cache_clear_all('publisher_batch_results', 'cache');
cache_clear_all('publisher_batch_success', 'cache');
if (!$success && !$results) {
drupal_set_message('There are currently no results to display.', 'error');
return '';
}
if ($results && isset($results->data)) {
$results = $results->data;
}
if ($success && isset($success->data)) {
$success = $success->data;
}
if ($success) {
drupal_set_message('Publisher batch operation completed successfully!');
} else {
drupal_set_message('There was an error during the publisher batch operation. See the table below for details.', 'error');
}
// Check the count of the results.
if (!$results || !is_array($results) || count($results) <= 0) {
return '<p>There are currently no results to display. This could mean the batch operation failed entirely
or there were no entities to process and send over to the remote server.</p>';
}
// Build the table.
$table_attributes = array('class' => array('system-status-report'));
$table_rows = array();
foreach ($results as $result) {
if (!array_key_exists('type', $result) || !array_key_exists('message', $result) || !array_key_exists('entity_type', $result) || !array_key_exists('entity_id', $result)) {
continue;
}
$row = array('data' => array());
$row['class'] = $result['type'] != 'status' ? array($result['type']) : array('ok');
$row['no_striping'] = true;
$row['data'] = array($result['entity_type'], $result['entity_id'], $result['message']);
$table_rows[] = $row;
}
$table_header = array('Entity Type', 'Entity ID', 'Message');
return theme('table', array('header' => $table_header, 'rows' => $table_rows, 'attributes' => $table_attributes));
}
示例12: _nodereferrer_create_add_form_submit
/**
* Submit the form to add to an existing node
*/
function _nodereferrer_create_add_form_submit($form, &$form_state)
{
if ($form_state['clicked_button']['#name'] != 'add') {
drupal_set_message(t('The operation was cancelled'));
drupal_goto('node/' . arg(1));
}
$append_node = node_load($form_state['values']['referrence']);
// Make sure the user is allowed to do this
if (!node_access('update', $append_node)) {
drupal_set_message(t('You do not have rights to update this node'));
drupal_goto('node/' . arg(1));
return;
}
$current_node = node_load(arg(1));
$field = $current_node->referrers[arg(3)]['referrence'][arg(4)][arg(5)]['field_name'];
array_push($append_node->{$field}, array('nid' => $current_node->nid));
// Save, and ensure the changes are noticed
node_save($append_node);
cache_clear_all();
drupal_set_message(t('The node was added'));
drupal_goto('node/' . arg(1));
}
示例13: handle
/**
* Implements AcsfEventHandler::handle().
*/
public function handle()
{
drush_print(dt('Entered @class', array('@class' => get_class($this))));
// Clear the theme field so all users will use the default theme.
db_update('users')->fields(array('theme' => 0))->execute();
// Clear any in-progress multistep forms that are not normally wiped during
// cache-clear. The other caches are expected to be cleared externally from
// this process.
cache_clear_all('*', 'cache_form', TRUE);
// Clean up ACSF variables.
$acsf_variables = acsf_vget_group('acsf_duplication_scrub');
foreach ($acsf_variables as $name => $value) {
acsf_vdel($name);
}
// Begin the site without any watchdog records. This should happen right at
// the end of the scubbing process to remove any log entries added by the
// scrubbing process itself.
if (db_table_exists('watchdog')) {
db_delete('watchdog')->execute();
}
// Mark the entire scrubbing process as complete.
variable_set('acsf_duplication_scrub_status', 'complete');
}
示例14: testCachePerRole
/**
* Test DRUPAL_CACHE_PER_ROLE.
*/
function testCachePerRole()
{
$this->setCacheMode(DRUPAL_CACHE_PER_ROLE);
// Enable our test block. Set some content for it to display.
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($current_content, t('Block content displays.'));
// Change the content, but the cached copy should still be served.
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
$this->assertText($old_content, t('Block is served from the cache.'));
// Clear the cache and verify that the stale data is no longer there.
cache_clear_all();
$this->drupalGet('');
$this->assertNoText($old_content, t('Block cache clear removes stale cache data.'));
$this->assertText($current_content, t('Fresh block content is displayed after clearing the cache.'));
// Test whether the cached data is served for the correct users.
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($old_content, t('Anonymous user does not see content cached per-role for normal user.'));
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
$this->assertText($old_content, t('User with the same roles sees per-role cached content.'));
$this->drupalLogin($this->admin_user);
$this->drupalGet('');
$this->assertNoText($old_content, t('Admin user does not see content cached per-role for normal user.'));
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($old_content, t('Block is served from the per-role cache.'));
}
示例15: removePage
/**
* @see CultureFeed_Pages::removePage()
*/
public function removePage($id)
{
$result = $this->realCultureFeedPages->removePage($id);
$this->cacheClear('page:' . $id);
// Also flush search results.
cache_clear_all('culturefeed:results:search/page:', 'cache_culturefeed_search', TRUE);
return $result;
}