22 private $settings_loaded =
false;
27 private $cookies_configured =
false;
39 $config = new \stdClass();
41 $this->config = $config;
42 $this->config->path = Directory\Local::root()->getPath(
'/');
67 if ($site_guid == 0) {
68 return $this->config->wwwroot;
85 return $this->config->pluginspath;
96 if ($this->cookies_configured) {
100 $this->loadSettingsFile();
103 if (!isset(
$c->cookies)) {
104 $c->cookies = array();
106 if (!isset(
$c->cookies[
'session'])) {
107 $c->cookies[
'session'] = array();
109 $session_defaults = session_get_cookie_params();
110 $session_defaults[
'name'] =
'Elgg';
111 $c->cookies[
'session'] = array_merge($session_defaults,
$c->cookies[
'session']);
112 if (!isset(
$c->cookies[
'remember_me'])) {
113 $c->cookies[
'remember_me'] = array();
115 $session_defaults[
'name'] =
'elggperm';
116 $session_defaults[
'expire'] = strtotime(
"+30 days");
117 $c->cookies[
'remember_me'] = array_merge($session_defaults,
$c->cookies[
'remember_me']);
119 $this->cookies_configured =
true;
128 if (!isset($this->config->dataroot)) {
132 return $this->config->dataroot;
139 $this->loadSettingsFile();
141 if (!isset($this->config->cacheroot)) {
142 $this->config->cacheroot = $this->getDataPath();
145 return $this->config->cacheroot;
151 public function get(
$name, $site_guid = 0) {
155 if (($site_guid === 0 || $site_guid === null || $site_guid == $this->config->site_guid) && isset($this->config->$name)) {
156 return $this->config->$name;
159 if ($site_guid === null) {
163 if ($site_guid == 0) {
164 $site_guid = (int) $this->config->site_guid;
168 if (!isset($this->config->site_config_loaded) || $site_guid != $this->config->site_guid) {
181 if ($site_guid == $this->config->site_guid || $site_guid === null) {
182 $this->config->$name =
$value;
192 return isset($this->config->{
$name}) ? $this->config->{
$name} : null;
200 $this->config->$name =
$value;
209 if (strlen(
$name) > 255) {
210 _elgg_services()->logger->error(
"The name length for configuration variables cannot be greater than 255");
214 if ($site_guid === null) {
220 if ($site_guid == 0) {
221 $site_guid = (int) $this->config->site_guid;
226 if ($site_guid === null || $site_guid == $this->config->site_guid) {
240 $root = Directory\Local::root();
242 $root->getPath(
'engine/settings.php'),
243 $root->getPath(
'elgg-config/settings.php'),
251 if ($this->settings_loaded) {
255 if (isset($this->config->Config_file)) {
256 if ($this->config->Config_file ===
false) {
257 $this->settings_loaded =
true;
260 $path = $this->config->Config_file;
262 foreach ($this->getSettingsPaths() as
$path) {
263 if (is_file($path)) {
270 if (!is_file(
$path)) {
271 if ($this->getVolatile(
'installer_running')) {
272 $this->settings_loaded =
true;
276 header(
"Location: install.php");
280 if (!is_readable(
$path)) {
281 echo "The Elgg settings file exists but the web server doesn't have read permission to it.";
288 $global_is_bound = (isset($CONFIG) && $CONFIG === $this->config);
293 if (isset($CONFIG->dataroot)) {
294 $CONFIG->dataroot = rtrim($CONFIG->dataroot, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
295 $GLOBALS[
'_ELGG']->dataroot_in_settings =
true;
297 $GLOBALS[
'_ELGG']->dataroot_in_settings =
false;
300 $GLOBALS[
'_ELGG']->simplecache_enabled_in_settings = isset($CONFIG->simplecache_enabled);
302 if (!empty($CONFIG->cacheroot)) {
303 $CONFIG->cacheroot = rtrim($CONFIG->cacheroot, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
306 if (!$global_is_bound) {
313 $this->settings_loaded =
true;
328 return $this->config;
if($guid==elgg_get_logged_in_user_guid()) $name
Access to configuration values.
static getDataPath()
Determine the Elgg data directory with trailing slash, save it to config, and return it...
getPluginsPath()
{Get the plugin path for this installation.string}
save($name, $value, $site_guid=0)
{Save a configuration setting.Configuration name (cannot be greater than 255 characters) Configuratio...
Describes an object that manages Elgg configuration values.
getSettingsPaths()
Get expected settings file paths.
elgg echo
Translates a string.
loadSettingsFile()
{Merge the settings file into the storage object.A particular location can be specified via $CONFIG->...
elgg global
Pointer to the global context.
clearfix elgg elgg elgg elgg page header
getSiteUrl($site_guid=0)
{Get the URL for the current (or specified) site.The GUID of the site whose URL we want to grab strin...
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
getCookieConfig()
Set up and return the cookie configuration array resolved from settings.php.
getStorageObject()
Get the raw object used for storage.
getDataPath()
{Get the data directory path for this installation.string}
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
__construct(\stdClass $config=null, $set_global=true)
Constructor.
getCachePath()
{Get the cache directory path for this installation.If not set in settings.php, the data path will be...
get_entity($guid)
Loads and returns an entity object from a guid.
getVolatile($name)
{Get a config value for the current site if it's already loaded.This should be used instead of readin...