public static function DrupalAPCCache::remoteFlush in APC - Alternative PHP Cache 7
1 call to DrupalAPCCache::remoteFlush()
- apc_drush_exit in ./
apc.drush.inc - Implements hook_drush_exit().
File
- ./
drupal_apc_cache.inc, line 302 - This integrates the drupal APC cache backend.
Class
- DrupalAPCCache
- APC cache implementation.
Code
public static function remoteFlush() {
if (!module_exists('apc')) {
drush_log('You need to enable the APC module for remote cache clearing to work. Run drush pm-enable apc.', 'error');
return;
}
global $base_url;
if (!empty(self::$remoteClears)) {
// optimize '*' clears.
$star = serialize('*');
foreach (self::$remoteClears as $bin => $clears) {
if (!empty($clears[$star])) {
self::$remoteClears[$bin] = array(
$star => TRUE,
);
}
}
$args = array(
'apc_drush_flush' => array(
array(
'clears' => self::$remoteClears,
'cron_key' => variable_get('cron_key', 'drupal'),
),
),
);
$uri = $base_url . '/xmlrpc.php';
$response = xmlrpc($uri, $args);
if ($response === FALSE) {
drush_log('xmlrpc() error: (' . xmlrpc_errno() . ') ' . xmlrpc_error_msg(), 'error');
if ($base_url == 'http://' . basename(conf_path())) {
drush_log('The base_url might not be set correctly try using the -l/--uri option for drush.', 'warning');
}
}
elseif (!$response['success']) {
drush_log('APC could not flush cache(s) because ' . $apc_node . ' returned code ' . $response['message'], 'error');
}
else {
drush_log("APC-Remote {$apc_node}: {$response['message']}", 'success');
}
}
}