diff --git a/app/code/local/Aoe/ClassPathCache/Helper/Data.php b/app/code/local/Aoe/ClassPathCache/Helper/Data.php
index e3d61cc..04b76dd 100644
--- a/app/code/local/Aoe/ClassPathCache/Helper/Data.php
+++ b/app/code/local/Aoe/ClassPathCache/Helper/Data.php
@@ -72,5 +72,18 @@ public function getUrl()
));
}
+ /**
+ * return in the admin area the url for cleanup
+ *
+ * @return string|boolean
+ */
+ public function getAdminUrl()
+ {
+ if(Mage::app()->getStore()->isAdmin())
+ {
+ return Mage::helper('adminhtml')->getUrl('adminhtmlcpc/index/clear');
+ }
+ return false;
+ }
}
diff --git a/app/code/local/Aoe/ClassPathCache/controllers/Adminhtml/IndexController.php b/app/code/local/Aoe/ClassPathCache/controllers/Adminhtml/IndexController.php
new file mode 100644
index 0000000..7059373
--- /dev/null
+++ b/app/code/local/Aoe/ClassPathCache/controllers/Adminhtml/IndexController.php
@@ -0,0 +1,54 @@
++_helper()->revalidateCache();
+ // check also frontend
+ $response = file_get_contents($this->_helper()->getUrl());
+ if ($response != 'OK') {
+ $success = false;
+ }
+ // set message
+ if($success)
+ {
+ $this->_session()->addSuccess($this->_helper()->__('the classpath cache was cleaned.'));
+ } else {
+ $this->_session()->addError($this->_helper()->__('could not clear classpath cache.'));
+ }
+ // redirect to referrer
+ $this->_redirectReferer();
+ }
+
+ /**
+ * class path helper
+ *
+ * @return Aoe_ClassPathCache_Helper_Data
+ */
+ protected function _helper()
+ {
+ return Mage::helper('aoe_classpathcache');
+ }
+
+ /**
+ * adminhtml session
+ *
+ * @return Mage_Adminhtml_Model_Session
+ */
+ protected function _session()
+ {
+ return Mage::getSingleton('adminhtml/session');
+ }
+}
\ No newline at end of file
diff --git a/app/code/local/Aoe/ClassPathCache/etc/config.xml b/app/code/local/Aoe/ClassPathCache/etc/config.xml
index 3caf759..99c73f1 100644
--- a/app/code/local/Aoe/ClassPathCache/etc/config.xml
+++ b/app/code/local/Aoe/ClassPathCache/etc/config.xml
@@ -1,41 +1,52 @@
-
-
- 0.4.0
-
-
+
+
+ 0.4.0
+
+
-
-
-
- Aoe_ClassPathCache_Helper
-
-
-
+
+
+
+ Aoe_ClassPathCache_Helper
+
+
+
-
-
-
-
-
- Aoe_ClassPathCache
- aoeclasspathcache
-
-
-
-
+
+
+
+
+
+ Aoe_ClassPathCache
+ aoeclasspathcache
+
+
+
+
+
+
+
+
+
+ aoe_classpathcache/aoe_classpathcache.xml
+
+
+
+
+
+
+
+
+
+
+ Aoe_ClassPathCache_Adminhtml
+ adminhtmlcpc
+
+
+
+
-
-
-
-
- aoe_classpathcache/aoe_classpathcache.xml
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/code/local/Varien/Autoload.php b/app/code/local/Varien/Autoload.php
index 729af41..6833c2d 100644
--- a/app/code/local/Varien/Autoload.php
+++ b/app/code/local/Varien/Autoload.php
@@ -16,6 +16,7 @@ class Varien_Autoload
static protected $_numberOfFilesAddedToCache = 0;
static public $useAPC = NULL;
+ static public $useXCACHE = NULL;
static protected $cacheKey = self::CACHE_KEY_PREFIX;
/* Base Path */
@@ -37,7 +38,10 @@ public function __construct()
}
// Allow APC to be disabled externally by explicitly setting Varien_Autoload::$useAPC = FALSE;
- if (self::$useAPC === NULL) {
+ if (self::$useXCACHE === NULL) {
+ self::$useXCACHE = extension_loaded('XCache') && ini_get('xcache.cacher');
+ }
+ if (self::$useAPC === NULL && self::$useXCACHE == FALSE) {
self::$useAPC = extension_loaded('apc') && ini_get('apc.enabled');
}
@@ -171,6 +175,11 @@ static public function loadCacheContent() {
if ($value !== FALSE) {
self::setCache($value);
}
+ } elseif(self::isXcacheUsed()) {
+ $value = xcache_isset(self::getCacheKey()) ? xcache_get(self::getCacheKey()) : false;
+ if ($value !== FALSE) {
+ self::setCache($value);
+ }
} elseif (file_exists(self::getCacheFilePath())) {
self::setCache(unserialize(file_get_contents(self::getCacheFilePath())));
}
@@ -216,7 +225,7 @@ static public function searchFullPath($filename)
foreach ($paths as $path) {
$fullPath = $path . DIRECTORY_SEPARATOR . $filename;
if (file_exists($fullPath)) {
- return $fullPath;
+ return realpath($fullPath);
}
}
return false;
@@ -232,6 +241,16 @@ public static function isApcUsed()
return self::$useAPC;
}
+ /**
+ * Check if xcache is used
+ *
+ * @return bool
+ */
+ public static function isXcacheUsed()
+ {
+ return self::$useXCACHE;
+ }
+
/**
* Get cache key (for apc)
*
@@ -262,6 +281,10 @@ public function __destruct()
if (PHP_SAPI != 'cli') {
apc_store(self::getCacheKey(), self::$_cache, 0);
}
+ } elseif(self::isXcacheUsed()) {
+ if (PHP_SAPI != 'cli') {
+ xcache_set(self::getCacheKey(), self::$_cache, 0);
+ }
} else {
$fileContent = serialize(self::$_cache);
$tmpFile = tempnam(sys_get_temp_dir(), 'aoe_classpathcache');
diff --git a/app/design/adminhtml/default/default/layout/aoe_classpathcache/aoe_classpathcache.xml b/app/design/adminhtml/default/default/layout/aoe_classpathcache/aoe_classpathcache.xml
index 040baeb..bb55044 100644
--- a/app/design/adminhtml/default/default/layout/aoe_classpathcache/aoe_classpathcache.xml
+++ b/app/design/adminhtml/default/default/layout/aoe_classpathcache/aoe_classpathcache.xml
@@ -1,10 +1,8 @@
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/aoe_classpathcache/aoe_classpathcache.phtml b/app/design/adminhtml/default/default/template/aoe_classpathcache/aoe_classpathcache.phtml
index d161e62..82652d3 100644
--- a/app/design/adminhtml/default/default/template/aoe_classpathcache/aoe_classpathcache.phtml
+++ b/app/design/adminhtml/default/default/template/aoe_classpathcache/aoe_classpathcache.phtml
@@ -5,11 +5,17 @@ $_helper = $this->helper('aoe_classpathcache'); /* @var $_helper Aoe_ClassPathCa