Skip to content

Commit

Permalink
don't use xcache in case admin auth is enabled in php.ini this can ca…
Browse files Browse the repository at this point in the history
…use issues
  • Loading branch information
DeepDiver1975 committed Aug 9, 2013
1 parent 82f34f8 commit e406e95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cache.php
Expand Up @@ -32,7 +32,7 @@ class OC_Cache {
static public function getGlobalCache($fast=false) {
if (!self::$global_cache) {
self::$global_cache_fast = null;
if (!self::$global_cache_fast && function_exists('xcache_set')) {
if (!self::$global_cache_fast && OC_Cache_XCache::available()) {
self::$global_cache_fast = new OC_Cache_XCache(true);
}
if (!self::$global_cache_fast && function_exists('apc_store')) {
Expand Down Expand Up @@ -61,7 +61,7 @@ static public function getGlobalCache($fast=false) {
static public function getUserCache($fast=false) {
if (!self::$user_cache) {
self::$user_cache_fast = null;
if (!self::$user_cache_fast && function_exists('xcache_set')) {
if (!self::$user_cache_fast && OC_Cache_XCache::available()) {
self::$user_cache_fast = new OC_Cache_XCache();
}
if (!self::$user_cache_fast && function_exists('apc_store')) {
Expand Down
16 changes: 16 additions & 0 deletions lib/cache/xcache.php
Expand Up @@ -16,6 +16,22 @@ public function __construct($global = false) {
}
}

public static function available()
{
if (!extension_loaded('xcache')) {
return false;
}
if (\OC::$CLI) {
return false;
}
// as soon as admin auth is enabled we can run into issues with admin ops like xcache_clear_cache
if (ini_get('xcache.admin.enable_auth')) {
return false;
}

return true;
}

/**
* entries in XCache gets namespaced to prevent collisions between owncloud instances and users
*/
Expand Down

1 comment on commit e406e95

@Soeldner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.