Skip to content
Snippets Groups Projects

Issue #3462024: Change apc_drush_flush() to use two parameters instead of one

2 files
+ 37
34
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 22
20
@@ -64,44 +64,46 @@ function apc_clear_apcu_cache() {
*/
function apc_xmlrpc() {
$methods[] = array(
'apc_drush_flush',
'apc_drush_flush',
'apc.clear_cache',
'apc_clear_cache',
array(
'array',
'string',
'array',
),
t('XMLRPC callback to enable cache clear from Drush/CLI.'),
t('Clears the APCu cache.'),
);
return $methods;
}
/**
* XMLRPC callback to clear the cache from Drush/CLI.
* XML-RPC callback to clear the cache.
*
* @see apc_xmlrpc()
*/
function apc_drush_flush($variables) {
$cron_key = isset($variables['cron_key']) ? $variables['cron_key'] : NULL;
$clears = isset($variables['clears']) ? $variables['clears'] : array();
function apc_clear_cache($key, $bins = array()) {
if (empty($key) || variable_get('cron_key', 'drupal') != $key) {
watchdog('apc', 'An invalid key was passed to apc_clear_cache().', array(), WATCHDOG_ERROR);
if (empty($cron_key) || variable_get('cron_key', 'drupal') != $cron_key) {
watchdog('apc', 'APC could not flush cache(s) because an invalid key was used.', array(), WATCHDOG_ERROR);
return array(
'success' => FALSE,
'message' => t('APC could not flush cache(s) because an invalid key was used.'),
'message' => t('Invalid key for apc.clear_cache.'),
);
}
else {
foreach ($clears as $bin => $cids) {
foreach ($cids as $serialized_cid => $wildcard) {
cache_clear_all(unserialize($serialized_cid), $bin, $wildcard);
}
}
return array(
'success' => TRUE,
'message' => t('APC all requested flushes done.'),
);
// Clear the APCu cache.
foreach ($bins as $bin => $cids) {
foreach ($cids as $cid => $wildcard) {
// $cid has been serialized in DrupalAPCCache::clear().
cache_clear_all(unserialize($cid), $bin, $wildcard);
}
}
return array(
'success' => TRUE,
'message' => t('The cache has been cleared.'),
);
}
/**
Loading