Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the usage of not existing config options #9709

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions src/libraries/kunena/src/Access/KunenaAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,6 @@ public function __construct()
}
}

if (KunenaConfig::getInstance()->get('cache_adm')) {
// Load administrators and moderators from cache
$options = ['defaultgroup' => 'com_kunena'];
$cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController('output', $options);
$data = $cache->get(self::$cacheKey, 'com_kunena');

if ($data) {
$data = unserialize($data);
$this->adminsByCatid = (array) $data['ac'];
$this->adminsByUserid = (array) $data['au'];
$this->moderatorsByCatid = (array) $data['mc'];
$this->moderatorsByUserid = (array) $data['mu'];
}
}

// If values were not cached (or users permissions have been changed), force reload
if (!isset($this->adminsByCatid)) {
$this->clearCache();
Expand Down Expand Up @@ -185,25 +170,6 @@ public function clearCache()
} catch (ExecutionFailureException $e) {
KunenaError::displayDatabaseError($e);
}

// FIXME: enable caching after fixing the issues
if (KunenaConfig::getInstance()->get('cache_adm')) {
// Store new data into cache
$options = ['defaultgroup' => 'com_kunena'];
$cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController('output', $options);
$cache->store(
serialize(
[
'ac' => $this->adminsByCatid,
'au' => $this->adminsByUserid,
'mc' => $this->moderatorsByCatid,
'mu' => $this->moderatorsByUserid,
]
),
self::$cacheKey,
'com_kunena'
);
}
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/libraries/kunena/src/Controller/Application/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,7 @@ protected function after()
Factory::getApplication()->setHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0', true);
Factory::getApplication()->sendHeaders();

if ($this->config->get('credits', 1)) {
$this->output->appendAfter($this->poweredBy());
}
$this->output->appendAfter($this->poweredBy());

KunenaProfiler::getInstance() ? KunenaProfiler::instance()->stop('function ' . \get_class($this) . '::' . __FUNCTION__ . '()') : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ public static function initialize(): void
{
KunenaProfiler::getInstance() ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;

if (KunenaFactory::getConfig()->get('cache_cat')) {
$options = ['defaultgroup' => 'com_kunena'];
$cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController('callback', $options);
$cache->setLifeTime(180);
self::$_instances = $cache->call(['CategoryHelper', 'loadCategories']);
} else {
self::$_instances = self::loadCategories();
}
self::$_instances = self::loadCategories();

if (\is_null(self::$_tree)) {
self::buildTree(self::$_instances);
Expand Down
52 changes: 0 additions & 52 deletions src/libraries/kunena/src/Route/KunenaRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,58 +754,6 @@ public static function getMenu()
return self::$home;
}

/**
* @return void
*
* @since Kunena 6.0
* @throws Exception
*/
public static function cacheLoad(): void
{
if (!KunenaConfig::getInstance()->get('cache_url')) {
return;
}

KunenaProfiler::getInstance() ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
$user = KunenaUserHelper::getMyself();
$cache = self::getCache();

// TODO: can use viewlevels instead of userid
$data = $cache->get($user->userid, 'com_kunena.route.v1');

if ($data !== false) {
list(self::$subtree, self::$uris) = unserialize($data);
}

KunenaProfiler::getInstance() ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
}

/**
* @return void
*
* @since Kunena 6.0
* @throws Exception
*/
public static function cacheStore(): void
{
if (!KunenaConfig::getInstance()->get('cache_url')) {
return;
}

if (!self::$urisSave) {
return;
}

KunenaProfiler::getInstance() ? KunenaProfiler::instance()->start('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
$user = KunenaUserHelper::getMyself();
$data = [self::$subtree, self::$uris];
$cache = self::getCache();

// TODO: can use viewlevels instead of userid
$cache->store(serialize($data), $user->userid, 'com_kunena.route.v1');
KunenaProfiler::getInstance() ? KunenaProfiler::instance()->stop('function ' . __CLASS__ . '::' . __FUNCTION__ . '()') : null;
}

/**
* @param string $string string
* @param null $default default
Expand Down
4 changes: 0 additions & 4 deletions src/site/src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,14 @@ public function dispatch()
$controller = KunenaControllerApplication::getInstance($view, $subview, $task, $input, $app);

if ($controller) {
KunenaRoute::cacheLoad();
$contents = $controller->execute();
KunenaRoute::cacheStore();
} elseif (class_exists('Kunena\Forum\Site\Controllers\\' . ucfirst($view) . 'Controller')) {
// Execute old MVC.
// Legacy support: If the content layout doesn't exist on HMVC, load and execute the old controller.
$controller = KunenaController::getInstance();
KunenaRoute::cacheLoad();
ob_start();
$controller->execute($task);
$contents = ob_get_clean();
KunenaRoute::cacheStore();
$controller->redirect();
} else {
// Legacy URL support.
Expand Down
2 changes: 0 additions & 2 deletions src/site/tmpl/Credits/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@

// Get HMVC controller and if exists, execute it.
KunenaControllerApplication::getInstance($view, $subview, $task, $input, $app);
KunenaRoute::cacheLoad();
$contents = (new KunenaControllerApplication())->execute();
KunenaRoute::cacheStore();

// Import plugins and event listeners.
PluginHelper::importPlugin('kunena');
Expand Down
Loading