ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilGlobalCacheSettings Class Reference

Class ilGlobalCacheSettings. More...

+ Inheritance diagram for ilGlobalCacheSettings:
+ Collaboration diagram for ilGlobalCacheSettings:

Public Member Functions

 readFromIniFile (ilIniFile $ilIniFile)
 
 writeToIniFile (ilIniFile $ilIniFile)
 
 activateAll ()
 
 addActivatedComponent ($component)
 
 resetActivatedComponents ()
 
 isComponentActivated ($component)
 
 areAllComponentActivated ()
 
 getService ()
 
 setService ($service)
 
 getActivatedComponents ()
 
 setActivatedComponents ($activated_components)
 
 isActive ()
 
 setActive ($active)
 
 getLogLevel ()
 
 setLogLevel ($log_level)
 
 __toString ()
 

Data Fields

const LOG_LEVEL_FORCED = -1
 
const LOG_LEVEL_NONE = 0
 
const LOG_LEVEL_SHY = 1
 
const LOG_LEVEL_NORMAL = 2
 
const LOG_LEVEL_CHATTY = 3
 
const INI_HEADER_CACHE = 'cache'
 
const INI_FIELD_ACTIVATE_GLOBAL_CACHE = 'activate_global_cache'
 
const INI_FIELD_GLOBAL_CACHE_SERVICE_TYPE = 'global_cache_service_type'
 
const INI_HEADER_CACHE_ACTIVATED_COMPONENTS = 'cache_activated_components'
 
const INI_FIELD_LOG_LEVEL = 'log_level'
 

Protected Member Functions

 checkIniHeader (ilIniFile $ilIniFile)
 
 getLogLevelName ()
 
 lookupLogLevelName ($level)
 

Protected Attributes

 $service = ilGlobalCache::TYPE_STATIC
 
 $activated_components = array()
 
 $active = false
 
 $log_level = self::LOG_LEVEL_NONE
 

Detailed Description

Class ilGlobalCacheSettings.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 12 of file class.ilGlobalCacheSettings.php.

Member Function Documentation

◆ __toString()

ilGlobalCacheSettings::__toString ( )

Definition at line 216 of file class.ilGlobalCacheSettings.php.

217 {
218 $service = 'Service: ' . ($this->getService() > 0 ? ilGlobalCache::lookupServiceClassName($this->getService()) : 'none');
219 $activated = 'Activated Components: ' . implode(', ', $this->getActivatedComponents());
220 $log_level = 'Log Level: ' . $this->getLogLevelName();
221
222 return implode("\n", array( '', '', $service, $activated, $log_level, '' ));
223 }
static lookupServiceClassName($service_type)

References $log_level, $service, getActivatedComponents(), getLogLevelName(), getService(), and ilGlobalCache\lookupServiceClassName().

Referenced by writeToIniFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateAll()

ilGlobalCacheSettings::activateAll ( )

Definition at line 86 of file class.ilGlobalCacheSettings.php.

87 {
88 foreach (ilGlobalCache::getAvailableComponents() as $comp) {
89 $this->addActivatedComponent($comp);
90 }
91 }
static getAvailableComponents()

References addActivatedComponent(), and ilGlobalCache\getAvailableComponents().

+ Here is the call graph for this function:

◆ addActivatedComponent()

ilGlobalCacheSettings::addActivatedComponent (   $component)
Parameters
$component

Definition at line 97 of file class.ilGlobalCacheSettings.php.

98 {
99 $this->activated_components[] = $component;
100 $this->activated_components = array_unique($this->activated_components);
101 }

Referenced by activateAll(), and readFromIniFile().

+ Here is the caller graph for this function:

◆ areAllComponentActivated()

ilGlobalCacheSettings::areAllComponentActivated ( )
Returns
bool

Definition at line 124 of file class.ilGlobalCacheSettings.php.

125 {
126 return count($this->activated_components) == count(ilGlobalCache::getAvailableComponents());
127 }

References ilGlobalCache\getAvailableComponents().

+ Here is the call graph for this function:

◆ checkIniHeader()

ilGlobalCacheSettings::checkIniHeader ( ilIniFile  $ilIniFile)
protected
Parameters
ilIniFile$ilIniFile

Definition at line 187 of file class.ilGlobalCacheSettings.php.

188 {
189 if (!$ilIniFile->readGroup(self::INI_HEADER_CACHE)) {
190 $ilIniFile->addGroup(self::INI_HEADER_CACHE);
191 }
192 if (!$ilIniFile->readGroup(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS)) {
193 $ilIniFile->addGroup(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS);
194 }
195 }

Referenced by readFromIniFile().

+ Here is the caller graph for this function:

◆ getActivatedComponents()

ilGlobalCacheSettings::getActivatedComponents ( )
Returns
array

Definition at line 151 of file class.ilGlobalCacheSettings.php.

References $activated_components.

Referenced by __toString(), and ilGlobalCache\setup().

+ Here is the caller graph for this function:

◆ getLogLevel()

ilGlobalCacheSettings::getLogLevel ( )
Returns
int

Definition at line 201 of file class.ilGlobalCacheSettings.php.

202 {
203 return $this->log_level;
204 }

References $log_level.

Referenced by getLogLevelName(), and writeToIniFile().

+ Here is the caller graph for this function:

◆ getLogLevelName()

ilGlobalCacheSettings::getLogLevelName ( )
protected
Returns
string

Definition at line 229 of file class.ilGlobalCacheSettings.php.

References getLogLevel(), and lookupLogLevelName().

Referenced by __toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getService()

ilGlobalCacheSettings::getService ( )
Returns
int

Definition at line 133 of file class.ilGlobalCacheSettings.php.

134 {
135 return $this->service;
136 }

References $service.

Referenced by __toString(), and writeToIniFile().

+ Here is the caller graph for this function:

◆ isActive()

ilGlobalCacheSettings::isActive ( )
Returns
boolean

Definition at line 169 of file class.ilGlobalCacheSettings.php.

References $active.

Referenced by readFromIniFile(), and writeToIniFile().

+ Here is the caller graph for this function:

◆ isComponentActivated()

ilGlobalCacheSettings::isComponentActivated (   $component)
Parameters
$component
Returns
bool

Definition at line 115 of file class.ilGlobalCacheSettings.php.

116 {
117 return in_array($component, $this->activated_components);
118 }

Referenced by writeToIniFile().

+ Here is the caller graph for this function:

◆ lookupLogLevelName()

ilGlobalCacheSettings::lookupLogLevelName (   $level)
protected
Parameters
$level
Returns
string

Definition at line 240 of file class.ilGlobalCacheSettings.php.

241 {
242 $r = new ReflectionClass($this);
243 foreach ($r->getConstants() as $k => $v) {
244 if (strpos($k, 'LOG_LEVEL') === 0 and $v == $level) {
245 return $k;
246 }
247 }
248
249 return '';
250 }

Referenced by getLogLevelName().

+ Here is the caller graph for this function:

◆ readFromIniFile()

ilGlobalCacheSettings::readFromIniFile ( ilIniFile  $ilIniFile)
Parameters
ilIniFile$ilIniFile

Definition at line 45 of file class.ilGlobalCacheSettings.php.

46 {
47 $this->checkIniHeader($ilIniFile);
48 $this->setActive($ilIniFile->readVariable(self::INI_HEADER_CACHE, self::INI_FIELD_ACTIVATE_GLOBAL_CACHE));
49 $this->setService($ilIniFile->readVariable(self::INI_HEADER_CACHE, self::INI_FIELD_GLOBAL_CACHE_SERVICE_TYPE));
50 $this->setLogLevel($ilIniFile->readVariable(self::INI_HEADER_CACHE, self::INI_FIELD_LOG_LEVEL));
51 if (!$this->isActive()) {
53 } else {
54 $cache_components = $ilIniFile->readGroup(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS);
55 if (is_array($cache_components)) {
56 foreach ($cache_components as $comp => $v) {
57 if ($v) {
58 $this->addActivatedComponent($comp);
59 }
60 }
61 }
62 }
63 }
checkIniHeader(ilIniFile $ilIniFile)

References addActivatedComponent(), checkIniHeader(), isActive(), resetActivatedComponents(), setActive(), setLogLevel(), and setService().

+ Here is the call graph for this function:

◆ resetActivatedComponents()

ilGlobalCacheSettings::resetActivatedComponents ( )

Definition at line 104 of file class.ilGlobalCacheSettings.php.

105 {
106 $this->activated_components = array();
107 }

Referenced by readFromIniFile().

+ Here is the caller graph for this function:

◆ setActivatedComponents()

ilGlobalCacheSettings::setActivatedComponents (   $activated_components)
Parameters
array$activated_components

Definition at line 160 of file class.ilGlobalCacheSettings.php.

161 {
162 $this->activated_components = $activated_components;
163 }

References $activated_components.

◆ setActive()

ilGlobalCacheSettings::setActive (   $active)
Parameters
boolean$active

Definition at line 178 of file class.ilGlobalCacheSettings.php.

179 {
180 $this->active = $active;
181 }

References $active.

Referenced by readFromIniFile().

+ Here is the caller graph for this function:

◆ setLogLevel()

ilGlobalCacheSettings::setLogLevel (   $log_level)
Parameters
int$log_level

Definition at line 210 of file class.ilGlobalCacheSettings.php.

211 {
212 $this->log_level = $log_level;
213 }

References $log_level.

Referenced by readFromIniFile().

+ Here is the caller graph for this function:

◆ setService()

ilGlobalCacheSettings::setService (   $service)
Parameters
int$service

Definition at line 142 of file class.ilGlobalCacheSettings.php.

143 {
144 $this->service = $service;
145 }

References $service.

Referenced by readFromIniFile().

+ Here is the caller graph for this function:

◆ writeToIniFile()

ilGlobalCacheSettings::writeToIniFile ( ilIniFile  $ilIniFile)
Parameters
ilIniFile$ilIniFile

Definition at line 69 of file class.ilGlobalCacheSettings.php.

70 {
71 $ilIniFile->setVariable(self::INI_HEADER_CACHE, self::INI_FIELD_ACTIVATE_GLOBAL_CACHE, $this->isActive() ? '1' : '0');
72 $ilIniFile->setVariable(self::INI_HEADER_CACHE, self::INI_FIELD_GLOBAL_CACHE_SERVICE_TYPE, $this->getService());
73 $ilIniFile->setVariable(self::INI_HEADER_CACHE, self::INI_FIELD_LOG_LEVEL, $this->getLogLevel());
74
75 $ilIniFile->removeGroup(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS);
76 $ilIniFile->addGroup(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS);
77 foreach (ilGlobalCache::getAvailableComponents() as $comp) {
78 $ilIniFile->setVariable(self::INI_HEADER_CACHE_ACTIVATED_COMPONENTS, $comp, $this->isComponentActivated($comp) ? '1' : '0');
79 }
80 if ($ilIniFile->write()) {
81 ilGlobalCache::log('saved new settings: ' . $this->__toString(), self::LOG_LEVEL_FORCED);
82 }
83 }
static log($message, $log_level)
write()
save ini-file-data to filesystem @access private

References __toString(), ilGlobalCache\getAvailableComponents(), getLogLevel(), getService(), isActive(), isComponentActivated(), ilGlobalCache\log(), and ilIniFile\write().

+ Here is the call graph for this function:

Field Documentation

◆ $activated_components

ilGlobalCacheSettings::$activated_components = array()
protected

◆ $active

ilGlobalCacheSettings::$active = false
protected

Definition at line 35 of file class.ilGlobalCacheSettings.php.

Referenced by isActive(), and setActive().

◆ $log_level

ilGlobalCacheSettings::$log_level = self::LOG_LEVEL_NONE
protected

Definition at line 39 of file class.ilGlobalCacheSettings.php.

Referenced by __toString(), getLogLevel(), and setLogLevel().

◆ $service

ilGlobalCacheSettings::$service = ilGlobalCache::TYPE_STATIC
protected

Definition at line 27 of file class.ilGlobalCacheSettings.php.

Referenced by __toString(), getService(), and setService().

◆ INI_FIELD_ACTIVATE_GLOBAL_CACHE

const ilGlobalCacheSettings::INI_FIELD_ACTIVATE_GLOBAL_CACHE = 'activate_global_cache'

Definition at line 20 of file class.ilGlobalCacheSettings.php.

◆ INI_FIELD_GLOBAL_CACHE_SERVICE_TYPE

const ilGlobalCacheSettings::INI_FIELD_GLOBAL_CACHE_SERVICE_TYPE = 'global_cache_service_type'

Definition at line 21 of file class.ilGlobalCacheSettings.php.

◆ INI_FIELD_LOG_LEVEL

const ilGlobalCacheSettings::INI_FIELD_LOG_LEVEL = 'log_level'

Definition at line 23 of file class.ilGlobalCacheSettings.php.

◆ INI_HEADER_CACHE

const ilGlobalCacheSettings::INI_HEADER_CACHE = 'cache'

Definition at line 19 of file class.ilGlobalCacheSettings.php.

◆ INI_HEADER_CACHE_ACTIVATED_COMPONENTS

const ilGlobalCacheSettings::INI_HEADER_CACHE_ACTIVATED_COMPONENTS = 'cache_activated_components'

Definition at line 22 of file class.ilGlobalCacheSettings.php.

◆ LOG_LEVEL_CHATTY

const ilGlobalCacheSettings::LOG_LEVEL_CHATTY = 3

◆ LOG_LEVEL_FORCED

const ilGlobalCacheSettings::LOG_LEVEL_FORCED = -1

Definition at line 14 of file class.ilGlobalCacheSettings.php.

Referenced by HTML_Template_IT\init().

◆ LOG_LEVEL_NONE

const ilGlobalCacheSettings::LOG_LEVEL_NONE = 0

Definition at line 15 of file class.ilGlobalCacheSettings.php.

◆ LOG_LEVEL_NORMAL

const ilGlobalCacheSettings::LOG_LEVEL_NORMAL = 2

Definition at line 17 of file class.ilGlobalCacheSettings.php.

◆ LOG_LEVEL_SHY

const ilGlobalCacheSettings::LOG_LEVEL_SHY = 1

Definition at line 16 of file class.ilGlobalCacheSettings.php.


The documentation for this class was generated from the following file: