]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not define xcache_unset_by_prefix() if it does not exist.
authorAndreas Fischer <bantu@owncloud.com>
Thu, 15 Aug 2013 01:31:42 +0000 (03:31 +0200)
committerAndreas Fischer <bantu@owncloud.com>
Thu, 15 Aug 2013 01:31:42 +0000 (03:31 +0200)
The defined function is not compatible with the function provided by xcache
because it does not honor the prefix parameter. Thus defining it like this is
a bad idea.

lib/memcache/xcache.php

index 7880518fd9f6bed4bc84471826a439703c5d1c49..e0acb11b0549bfa0c03765076ff7ee68daebe702 100644 (file)
@@ -37,7 +37,12 @@ class XCache extends Cache {
        }
 
        public function clear($prefix='') {
-               xcache_unset_by_prefix($this->getNamespace().$prefix);
+               if (function_exists('xcache_unset_by_prefix')) {
+                       xcache_unset_by_prefix($this->getNamespace().$prefix);
+               } else {
+                       // Since we can not clear by prefix, we just clear the whole cache.
+                       xcache_clear_cache(\XC_TYPE_VAR, 0);
+               }
                return true;
        }
 
@@ -56,10 +61,3 @@ class XCache extends Cache {
                return true;
        }
 }
-
-if(!function_exists('xcache_unset_by_prefix')) {
-       function xcache_unset_by_prefix($prefix) {
-               // Since we can't clear targetted cache, we'll clear all. :(
-               xcache_clear_cache(\XC_TYPE_VAR, 0);
-       }
-}