Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15190759
D14064.id34003.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14064.id34003.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2669,6 +2669,7 @@
'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php',
'PhabricatorProjectsPolicyRule' => 'applications/policy/rule/PhabricatorProjectsPolicyRule.php',
'PhabricatorProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorProtocolAdapter.php',
+ 'PhabricatorPurgeApcController' => 'applications/system/controller/PhabricatorPurgeApcController.php',
'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php',
'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php',
'PhabricatorQueryConstraint' => 'infrastructure/query/constraint/PhabricatorQueryConstraint.php',
@@ -6711,6 +6712,7 @@
'PhabricatorProjectWatchController' => 'PhabricatorProjectController',
'PhabricatorProjectsPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorProtocolAdapter' => 'Phobject',
+ 'PhabricatorPurgeApcController' => 'PhabricatorController',
'PhabricatorPygmentSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorQuery' => 'Phobject',
'PhabricatorQueryConstraint' => 'Phobject',
diff --git a/src/applications/system/application/PhabricatorSystemApplication.php b/src/applications/system/application/PhabricatorSystemApplication.php
--- a/src/applications/system/application/PhabricatorSystemApplication.php
+++ b/src/applications/system/application/PhabricatorSystemApplication.php
@@ -18,6 +18,7 @@
return array(
'/status/' => 'PhabricatorStatusController',
'/debug/' => 'PhabricatorDebugController',
+ '/purge_apc/' => 'PhabricatorPurgeApcController',
'/robots.txt' => 'PhabricatorRobotsController',
'/services/' => array(
'encoding/' => 'PhabricatorSystemSelectEncodingController',
diff --git a/src/applications/system/controller/PhabricatorPurgeApcController.php b/src/applications/system/controller/PhabricatorPurgeApcController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/system/controller/PhabricatorPurgeApcController.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Purges APC via apc_clear_cache(). This allows you to deploy new code without
+ * restarting Phabricator. In an ideal world, you would have made sure your new
+ * code actually works.
+ *
+ * Restricting this to admins to prevent abuse.
+ */
+final class PhabricatorPurgeApcController extends PhabricatorController {
+
+ public function shouldRequireAdmin() {
+ return true;
+ }
+
+ public function processRequest() {
+ $result = '';
+
+ // apc logic from PhabricatorOpcodeCacheSpec.php
+ $apc_installed = extension_loaded('apc') && !extension_loaded('apcu');
+ if (!$apc_installed) {
+ $result = 'APC is not installed!';
+ } else if (!ini_get('apc.enabled')) {
+ $result = 'APC is installed, but not enabled!';
+ } else {
+ apc_clear_cache();
+ $result = 'Ran apc_clear_cache()';
+ }
+
+ $response = new AphrontWebpageResponse();
+ $response->setContent($result);
+ return $response;
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 22, 10:06 PM (5 h, 28 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7180999
Default Alt Text
D14064.id34003.diff (3 KB)
Attached To
Mode
D14064: Add dialog to purge opcode/data caches
Attached
Detach File
Event Timeline
Log In to Comment