Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fixes after scrutinizr run
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Feb 2, 2016
1 parent 707823a commit 3c4e5ed
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
6 changes: 3 additions & 3 deletions core/src/core/classes/class.AJXP_PluginsService.php
Expand Up @@ -63,14 +63,14 @@ private function _loadRegistryFromCache(){

$res = null;

// Retrieving Registry from Server Cache
// Retrieving Registry from Server Cache
if ($this->cacheStorage) {
$res = $this->cacheStorage->fetch('plugins_registry');

$this->registry=$res;
}

// Retrieving Registry from files cache
// Retrieving Registry from files cache
if (empty($res)) {
$res = AJXP_Utils::loadSerialFile(AJXP_PLUGINS_CACHE_FILE);
$this->registry=$res;
Expand Down Expand Up @@ -116,7 +116,7 @@ public function loadPluginsRegistryFromCache($cacheStorage = null) {
* Save plugin registry to cache
*
*/
public function savePluginsRegistryToCache($cacheStorage = null) {
public function savePluginsRegistryToCache() {
if (!empty ($this->cacheStorage)) {
$this->cacheStorage->save("plugins_registry", $this->registry);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/classes/class.ConfService.php
Expand Up @@ -322,7 +322,7 @@ public static function getAuthDriverImpl()
/**
* Get auth driver implementation
*
* @return AbstractAuthDriver
* @return AbstractCacheDriver
*/
public static function getCacheDriverImpl()
{
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/boot.conf/class.BootConfLoader.php
Expand Up @@ -305,7 +305,7 @@ public function createBootstrapConf($data){

$newConfigPlugin = ConfService::instanciatePluginFromGlobalParams($coreConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver");
$newAuthPlugin = ConfService::instanciatePluginFromGlobalParams($coreAuth["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver");
$newCachePlugin = ConfService::instanciatePluginFromGlobalParans($coreCache["UNIQUE_INSTANCE_CONFIG"], "AbstractCacheDriver");
$newCachePlugin = ConfService::instanciatePluginFromGlobalParams($coreCache["UNIQUE_INSTANCE_CONFIG"], "AbstractCacheDriver");

$sqlPlugs = array(
"core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql",
Expand All @@ -324,7 +324,7 @@ public function createBootstrapConf($data){
$newConfigPlugin->_savePluginConfig($pluginId, $options);
}

return array($newConfigPlugin, $newAuthPlugin);
return array($newConfigPlugin, $newAuthPlugin, $newCachePlugin);
}

/**
Expand Down
21 changes: 12 additions & 9 deletions core/src/plugins/cache.doctrine/class.doctrineCacheDriver.php
Expand Up @@ -36,6 +36,9 @@
*/
class doctrineCacheDriver extends AbstractCacheDriver
{

private $cacheDriver;

/**
* Close file handle on objects destructor.
*/
Expand Down Expand Up @@ -109,33 +112,33 @@ public function _apc_init() {
}

public function _memcache_init() {
$this->memcache = new Memcache();
@$running = $this->memcache->connect($this->options['MEMCACHE_HOSTNAME'], $this->options['MEMCACHE_PORT']);
$memcache = new Memcache();
@$running = $memcache->connect($this->options['MEMCACHE_HOSTNAME'], $this->options['MEMCACHE_PORT']);

if (! $running) return;

$this->cacheDriver = new Cache\MemcacheCache();
$this->cacheDriver->setMemcache($this->memcache);
$this->cacheDriver->setMemcache($memcache);
}

public function _memcached_init() {
$this->memcached = new Memcached();
@$running = $this->memcached->addServer($this->options['MEMCACHED_HOSTNAME'], $this->options['MEMCACHED_PORT']);
$memcached = new Memcached();
@$running = $memcached->addServer($this->options['MEMCACHED_HOSTNAME'], $this->options['MEMCACHED_PORT']);

if (! $running) return;

$this->cacheDriver = new Cache\MemcachedCache();
$this->cacheDriver->setMemcached($this->memcached);
$this->cacheDriver->setMemcached($memcached);
}

public function _redis_init() {
$this->redis = new Redis();
@$running = $this->redis->connect($this->options['REDIS_HOSTNAME'], $this->options['REDIS_PORT']);
$redis = new Redis();
@$running = $redis->connect($this->options['REDIS_HOSTNAME'], $this->options['REDIS_PORT']);

if (! $running) return;

$this->cacheDriver = new \Doctrine\Common\Cache\RedisCache();
$this->cacheDriver->setRedis($this->redis);
$this->cacheDriver->setRedis($redis);
}

public function _xcache_init() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.cache/class.AbstractCacheDriver.php
Expand Up @@ -137,7 +137,7 @@ public function deleteAll(){
$cacheDriver = $this->getCacheDriver();

if (isset($cacheDriver)) {
$result = $cacheDriver->deleteAll($id);
$result = $cacheDriver->deleteAll();
return $result;
}

Expand Down
11 changes: 7 additions & 4 deletions core/src/plugins/core.cache/class.CoreCacheLoader.php
Expand Up @@ -35,17 +35,20 @@ class CoreCacheLoader extends AJXP_Plugin

public function getCacheImpl()
{

$pluginInstance = null;

if (!isSet(self::$cacheInstance) || (isset($this->pluginConf["UNIQUE_INSTANCE_CONFIG"]["instance_name"]) && self::$cacheInstance->getId() != $this->pluginConf["UNIQUE_INSTANCE_CONFIG"]["instance_name"])) {
if (isset($this->pluginConf["UNIQUE_INSTANCE_CONFIG"])) {
$this->pluginInstance = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_INSTANCE_CONFIG"], "AbstractCacheDriver");
$pluginInstance = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_INSTANCE_CONFIG"], "AbstractCacheDriver");

if ($this->pluginInstance != false) {
AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("cache", $this->pluginInstance->getName(), $this->pluginInstance);
if ($pluginInstance != false) {
AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("cache", $pluginInstance->getName(), $pluginInstance);
}
}
}

self::$cacheInstance = $this->pluginInstance;
self::$cacheInstance = $pluginInstance;
return self::$cacheInstance;
}
}

0 comments on commit 3c4e5ed

Please sign in to comment.