Elgg  Version 3.0
configuration.php
Go to the documentation of this file.
1 <?php
18 
25 function elgg_get_site_url() {
26  return _elgg_config()->wwwroot;
27 }
28 
36  return _elgg_services()->plugins->getPath();
37 }
38 
45 function elgg_get_data_path() {
46  return _elgg_config()->dataroot;
47 }
48 
56 function elgg_get_cache_path() {
57  $path = _elgg_config()->cacheroot ? : elgg_get_data_path() . 'caches/';
58  return Paths::sanitize($path);
59 }
60 
68 function elgg_get_asset_path() {
69  $path = _elgg_config()->assetroot ? : elgg_get_cache_path() . 'views_simplecache/';
70  return Paths::sanitize($path);
71 }
72 
83 function elgg_get_root_path() {
84  return Paths::project();
85 }
86 
93  return Paths::elgg() . 'engine';
94 }
95 
105 function elgg_get_config($name, $default = null) {
106  if ($name == 'icon_sizes') {
107  $msg = 'The config value "icon_sizes" is deprecated. Use elgg_get_icon_sizes()';
108  elgg_deprecated_notice($msg, '2.2');
109  }
110 
111  if (!_elgg_config()->hasValue($name)) {
112  elgg_log("Config value for '$name' is not set'", 'INFO');
113  return $default;
114  }
115 
116  return _elgg_config()->$name;
117 }
118 
131  _elgg_config()->$name = $value;
132 }
133 
144  return _elgg_config()->save($name, $value);
145 }
146 
155  return _elgg_config()->remove($name);
156 }
157 
164 function _elgg_config() {
165  $config = _elgg_services()->config;
166  if (!$config) {
167  throw new \RuntimeException(__FUNCTION__ . ' can not be called before an instance of ' . \Elgg\Application::class . ' is bootstrapped');
168  }
169 
170  return $config;
171 }
172 
185 function _elgg_config_test($hook, $type, $tests) {
186  $tests[] = ElggCoreConfigTest::class;
187  return $tests;
188 }
189 
198 function elgg_get_icon_sizes($entity_type = null, $entity_subtype = null, $type = 'icon') {
199  return _elgg_services()->iconService->getSizes($entity_type, $entity_subtype, $type);
200 }
201 
205 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
206  $hooks->registerHandler('unit_test', 'system', '_elgg_config_test');
207 };
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_get_asset_path()
Get the asset cache directory path for this installation, ending with slash.
elgg_get_icon_sizes($entity_type=null, $entity_subtype=null, $type= 'icon')
Returns a configuration array of icon sizes.
$path
Definition: details.php:89
_elgg_config_test($hook, $type, $tests)
Register unit tests.
Events service.
$type
Definition: delete.php:21
elgg_save_config($name, $value)
Save a configuration setting.
$config
Advanced site settings, debugging section.
Definition: debugging.php:6
string project
Definition: conf.py:46
Configuration exception.
Base class for events and hooks.
elgg_get_cache_path()
Get the cache directory path for this installation, ending with slash.
elgg_set_config($name, $value)
Set an Elgg configuration value.
elgg_log($message, $level=\Psr\Log\LogLevel::NOTICE)
Log a message.
Definition: elgglib.php:786
elgg_get_root_path()
Get the project path (where composer is installed), ending with slash.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:841
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
$default
Definition: checkbox.php:35
_elgg_config()
Get the Elgg config service.
$value
Definition: debugging.php:7
class
Definition: placeholder.php:21
elgg_get_engine_path()
/path/to/elgg/engine with no trailing slash.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
elgg_get_plugins_path()
Get the plugin path for this installation, ending with slash.
elgg_get_data_path()
Get the data directory path for this installation, ending with slash.
elgg_remove_config($name)
Removes a config setting.
var elgg
Definition: elgglib.js:4
elgg_get_config($name, $default=null)
Get an Elgg configuration value.