protected static function load()
{
$loader = function () {
$db = Factory::getDbo();
$query = $db->getQuery(true)->select($db->quoteName(['extension_id', 'element', 'params', 'enabled'], ['id', 'option', null, null]))->from($db->quoteName('#__extensions'))->where([$db->quoteName('type') . ' = ' . $db->quote('component'), $db->quoteName('state') . ' = 0', $db->quoteName('enabled') . ' = 1']);
$components = [];
$db->setQuery($query);
foreach ($db->getIterator() as $component) {
$components[$component->option] = new ComponentRecord((array) $component);
}
return $components;
};
$cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController('callback', ['defaultgroup' => '_system']);
try {
static::$components = $cache->get($loader, array(), __METHOD__);
} catch (CacheExceptionInterface $e) {
static::$components = $loader();
}
return true;
}