/** * Method to preload the JAccessRules object for the given asset type. * * @param string|array $assetTypes e.g. 'com_content.article' * @param boolean $reload Set to true to reload from database. * * @return boolean True on success. * * @since 1.6 */ public static function preload($assetTypes = 'components', $reload = false) { // Get instance of the Profiler: $_PROFILER = JProfiler::getInstance('Application'); // Check for default case: $isDefault = is_string($assetTypes) && in_array($assetTypes, array('components', 'component')); // Preload the rules for all of the components: if ($isDefault) { // Mark in the profiler. JDEBUG ? $_PROFILER->mark('Start JAccess::preload(components)') : null; $components = self::preloadComponents(); self::$preloadedAssetTypes = array_merge(self::$preloadedAssetTypes, array_flip($components)); // Mark in the profiler. JDEBUG ? $_PROFILER->mark('Finish JAccess::preload(components)') : null; // Quick short circuit for default case: if ($isDefault) { return true; } } // If we get to this point, this is a regular asset type // and we'll proceed with the preloading process. if (!is_array($assetTypes)) { $assetTypes = (array) $assetTypes; } foreach ($assetTypes as $assetType) { if (!isset(self::$preloadedAssetTypes[$assetType]) || $reload) { JDEBUG ? $_PROFILER->mark('New JAccess Preloading Process(' . $assetType . ')') : null; self::preloadPermissionsParentIdMapping($assetType); JDEBUG ? $_PROFILER->mark('After preloadPermissionsParentIdMapping (' . $assetType . ')') : null; self::preloadPermissions($assetType); JDEBUG ? $_PROFILER->mark('After preloadPermissions (' . $assetType . ')') : null; JDEBUG ? $_PROFILER->mark('End New JAccess Preloading Process(' . $assetType . ')') : null; self::$preloadedAssetTypes[$assetType] = true; } } return true; }
/** * Method for clearing static caches. * * @return void * * @since 11.3 */ public static function clearStatics() { self::$componentsPreloaded = false; self::$viewLevels = array(); self::$assetPermissionsById = array(); self::$assetPermissionsByName = array(); self::$preloadedAssetTypes = array(); self::$identities = array(); self::$assetRules = array(); self::$userGroups = array(); self::$userGroupPaths = array(); self::$groupsByUser = array(); }