Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
apc
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
apc
Commits
c0d625ff
Commit
c0d625ff
authored
6 months ago
by
Alberto Paderno
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3466111
: Remove Drush support
parent
e448414a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!59
Issue #3466111: Remove Drush support
Pipeline
#246689
passed
6 months ago
Stage: build
Stage: validate
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apc.drush.inc
+0
-78
0 additions, 78 deletions
apc.drush.inc
apc.module
+0
-41
0 additions, 41 deletions
apc.module
drupal_apc_cache.inc
+0
-28
0 additions, 28 deletions
drupal_apc_cache.inc
with
0 additions
and
147 deletions
apc.drush.inc
deleted
100644 → 0
+
0
−
78
View file @
e448414a
<?php
/**
* @file
* Drush hook implementations for the Alternative PHP Cache module.
*/
/**
* Implements hook_drush_exit().
*/
function
apc_drush_exit
()
{
global
$base_url
;
if
(
class_exists
(
'DrupalApcCache'
))
{
$requests
=
DrupalApcCache
::
pendingRequests
();
if
(
!
empty
(
$requests
)
&&
is_array
(
$requests
))
{
if
(
!
function_exists
(
'module_exists'
))
{
// Drupal bootstrap did not reach the DRUPAL_BOOTSTRAP_VARIABLES phase,
// or module_exists() would be defined. This means it is not possible to
// check if the Alternative PHP Cache module is available.
// Exit silently.
return
;
}
if
(
!
module_exists
(
'apc'
))
{
drush_log
(
dt
(
'You need to enable the Alternative PHP Cache module to clear the cache on the server.'
),
'error'
);
return
;
}
$star
=
serialize
(
'*'
);
foreach
(
array_keys
(
$requests
)
as
$key
)
{
if
(
!
empty
(
$requests
[
$key
][
$star
]))
{
// If there is a request to clear all the entries for a bin, that is
// the only request which needs to be passed.
$requests
[
$key
]
=
array
(
$star
=>
TRUE
);
}
}
$args
=
array
(
'apc.clear_cache'
=>
array
(
variable_get
(
'cron_key'
,
'drupal'
),
$requests
,
),
);
$uri
=
$base_url
.
'/xmlrpc.php'
;
$response
=
xmlrpc
(
$uri
,
$args
);
if
(
$response
===
FALSE
)
{
drush_log
(
dt
(
'apc.clear_cache: %err_msg (%err_no)'
,
array
(
'%err_msg'
=>
xmlrpc_error
(),
'%err_no'
=>
xmlrpc_errno
())
),
'error'
);
if
(
$base_url
==
'http://'
.
basename
(
conf_path
()))
{
drush_log
(
dt
(
'$base_url might not be set correctly.'
),
'warning'
);
}
}
else
{
drush_log
(
dt
(
"apc.clear_cache: The cache has been cleared."
),
'success'
);
}
}
}
}
This diff is collapsed.
Click to expand it.
apc.module
+
0
−
41
View file @
c0d625ff
...
...
@@ -88,44 +88,3 @@ function apc_clear_apcu_cache() {
drupal_set_message
(
t
(
'APCu is not enabled.'
),
'warning'
);
}
}
/**
* Implements hook_xmlrpc().
*/
function
apc_xmlrpc
()
{
$methods
[]
=
array
(
'apc.clear_cache'
,
'apc_clear_cache'
,
array
(
'boolean'
,
'string'
,
'array'
,
),
t
(
'Clears the APCu cache.'
),
);
return
$methods
;
}
/**
* XML-RPC callback to clear the cache.
*
* @see apc_xmlrpc()
*/
function
apc_clear_cache
(
$key
,
$bins
=
array
())
{
if
(
empty
(
$key
)
||
variable_get
(
'cron_key'
,
'drupal'
)
!=
$key
)
{
watchdog
(
'apc'
,
'An invalid auth key was passed to apc_clear_cache().'
,
array
(),
WATCHDOG_ERROR
);
return
xmlrpc_error
(
-
32602
,
t
(
'Invalid auth key for apc.clear_cache.'
));
}
// 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
TRUE
;
}
This diff is collapsed.
Click to expand it.
drupal_apc_cache.inc
+
0
−
28
View file @
c0d625ff
...
...
@@ -15,13 +15,6 @@
*/
class
DrupalApcCache
implements
DrupalCacheInterface
{
/**
* Requests to clear the cache to send via XML-RPC to the server.
*
* @var array
*/
protected
static
$pendingRequests
=
array
();
/**
* The list of all the operations done to the cache.
*
...
...
@@ -390,14 +383,6 @@ protected function deleteKeys($prefix = NULL) {
* {@inheritdoc}
*/
public
function
clear
(
$cid
=
NULL
,
$wildcard
=
FALSE
)
{
if
(
drupal_is_cli
())
{
// APCu uses a separate storage for CLI. Store these requests to be sent
// to the server via XML-RPC.
self
::
$pendingRequests
[
$this
->
bin
][
serialize
(
$cid
)]
=
$wildcard
;
return
;
}
if
(
empty
(
$cid
))
{
$this
->
deleteKeys
();
}
...
...
@@ -435,19 +420,6 @@ public function isEmpty() {
return
TRUE
;
}
/**
* Retrieves the requests that should be sent to the server via XML-RPC.
*
* @return array
* An array of requests.
* The array contains a key for each bin which must be cleared. The value
* for those keys is an array of cache IDs, whose value is TRUE if the cache
* ID is a wildcard string or FALSE otherwise.
*/
public
static
function
pendingRequests
()
{
return
self
::
$pendingRequests
;
}
/**
* Retrieves the list of operations done on the cache.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment