本文整理汇总了PHP中_update_cache_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP _update_cache_clear函数的具体用法?PHP _update_cache_clear怎么用?PHP _update_cache_clear使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_update_cache_clear函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAvailableReleases
/**
* Obtains release info for all installed projects via update.module.
*
* @see update_get_available().
* @see update_manual_status().
*/
protected function getAvailableReleases()
{
// We force a refresh if the cache is not available.
if (!cache_get('update_available_releases', 'cache_update')) {
$this->refresh();
}
$available = update_get_available(TRUE);
// Force to invalidate some update_status caches that are only cleared
// when visiting update status report page.
if (function_exists('_update_cache_clear')) {
_update_cache_clear('update_project_data');
_update_cache_clear('update_project_projects');
}
return $available;
}
示例2: getAvailableReleases
/**
* Obtains release info for all installed projects via update.module.
*
* @see update_get_available().
* @see update_manual_status().
*/
protected function getAvailableReleases()
{
// Force to invalidate some caches that are only cleared
// when visiting update status report page. This allow to detect changes in
// .info files.
_update_cache_clear('update_project_data');
_update_cache_clear('update_project_projects');
// From update_get_available(): Iterate all projects and create a fetch task
// for those we have no information or is obsolete.
$available = _update_get_cached_available_releases();
module_load_include('inc', 'update', 'update.compare');
$update_projects = update_get_projects();
foreach ($update_projects as $key => $project) {
if (empty($available[$key])) {
update_create_fetch_task($project);
continue;
}
if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) {
$available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
}
if (empty($available[$key]['releases'])) {
$available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
}
if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) {
update_create_fetch_task($project);
}
}
// Set a batch to process all pending tasks.
$batch = array('operations' => array(array('update_fetch_data_batch', array())), 'finished' => 'update_fetch_data_finished', 'file' => drupal_get_path('module', 'update') . '/update.fetch.inc');
batch_set($batch);
drush_backend_batch_process();
// Clear any error set by a failed update fetch task. This avoid rollbacks.
drush_clear_error();
// Calculate update status data.
$available = _update_get_cached_available_releases();
return $available;
}
示例3: hook_cache_flush
/**
* Flush all persistent and static caches.
*
* This hook asks your module to clear all of its static caches,
* in order to ensure a clean environment for subsequently
* invoked data rebuilds.
*
* Do NOT use this hook for rebuilding information. Only use it to flush custom
* caches.
*
* Static caches using drupal_static() do not need to be reset manually.
* However, all other static variables that do not use drupal_static() must be
* manually reset.
*
* This hook is invoked by drupal_flush_all_caches(). It runs before module data
* is updated and before hook_rebuild().
*
* @see drupal_flush_all_caches()
* @see hook_rebuild()
*/
function hook_cache_flush()
{
if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
_update_cache_clear();
}
}
示例4: hook_themes_disabled
/**
* Respond to themes being disabled.
*
* @param array $theme_list
* Array containing the names of the themes being disabled.
*
* @see theme_disable()
*/
function hook_themes_disabled($theme_list)
{
// Clear all update module caches.
_update_cache_clear();
}
示例5: updateExtension
/**
* @param string $extension
*
* @return array Context result generated by Drupal.
*
* @throws Oxygen_Exception
*
* @see update_authorize_run_update()
*/
public function updateExtension($extension)
{
module_load_include('inc', 'update', 'update.manager');
drupal_get_updaters();
$directory = _update_manager_extract_directory();
$projectLocation = $directory . '/' . $extension;
$updater = Updater::factory($projectLocation);
$projectRealLocation = drupal_realpath($projectLocation);
// If the owner of the directory we extracted is the same as the
// owner of our configuration directory (e.g. sites/default) where we're
// trying to install the code, there's no need to prompt for FTP/SSH
// credentials. Instead, we instantiate a FileTransferLocal and invoke
// update_authorize_run_install() directly.
if (fileowner($projectRealLocation) !== fileowner(DRUPAL_ROOT . '/' . conf_path())) {
throw new Oxygen_Exception(Oxygen_Exception::PROJECT_MANAGER_FILE_SYSTEM_NOT_WRITABLE, array('projectOwner' => fileowner($projectRealLocation), 'siteOwner' => fileowner(conf_path())));
}
module_load_include('inc', 'update', 'update.authorize');
// @TODO: Implement other file transfer types.
$fileTransfer = new FileTransferLocal(DRUPAL_ROOT);
update_authorize_batch_copy_project($extension, get_class($updater), $projectRealLocation, $fileTransfer, $context);
// Reset the cache for this extension only, so we may immediately update the dashboard.
// Hacky way to do it, but most efficient.
module_load_include('inc', 'update', 'update.fetch');
module_load_include('inc', 'update', 'update.compare');
_update_cache_clear('update_project_projects');
_update_cache_clear('update_project_data');
$projects = update_get_projects();
_update_process_fetch_task($projects[$extension]);
return $context;
}