Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
update_advanced.php
Go to the documentation of this file.
1 <?php
13 if (!$site) {
14  throw new InstallationException("The system is missing an ElggSite entity!");
15 }
16 if (!($site instanceof ElggSite)) {
17  throw new InstallationException("Passing a non-ElggSite to an ElggSite constructor!");
18 }
19 
20 $site->url = rtrim(get_input('wwwroot', '', false), '/') . '/';
21 
22 datalist_set('path', sanitise_filepath(get_input('path', '', false)));
23 $dataroot = sanitise_filepath(get_input('dataroot', '', false));
24 
25 // check for relative paths
26 if (stripos(PHP_OS, 'win') === 0) {
27  if (strpos($dataroot, ':') !== 1) {
28  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
29  register_error($msg);
31  }
32 } else {
33  if (strpos($dataroot, '/') !== 0) {
34  $msg = elgg_echo('admin:configuration:dataroot:relative_path', array($dataroot));
35  register_error($msg);
37  }
38 }
39 
40 datalist_set('dataroot', $dataroot);
41 
42 if ('on' === get_input('simplecache_enabled')) {
44 } else {
46 }
47 
49 if ('on' === get_input('cache_symlink_enabled') && !$cache_symlinked) {
50  if (!is_dir(elgg_get_root_path() . 'cache/')) {
51  $cache_symlinked = symlink(elgg_get_cache_path() . 'views_simplecache/', elgg_get_root_path() . 'cache/');
52  }
53  if (!_elgg_is_cache_symlinked()) {
54  unlink(elgg_get_root_path() . 'cache/');
55  $cache_symlinked = false;
56  }
57  if (!$cache_symlinked) {
58  register_error(elgg_echo('installation:cache_symlink:error'));
59  }
60 }
61 
62 set_config('simplecache_minify_js', 'on' === get_input('simplecache_minify_js'), $site->getGUID());
63 set_config('simplecache_minify_css', 'on' === get_input('simplecache_minify_css'), $site->getGUID());
64 
65 if ('on' === get_input('system_cache_enabled')) {
67 } else {
69 }
70 
71 set_config('default_access', get_input('default_access', ACCESS_PRIVATE), $site->getGUID());
72 
73 $user_default_access = ('on' === get_input('allow_user_default_access'));
74 set_config('allow_user_default_access', $user_default_access, $site->getGUID());
75 
76 $debug = get_input('debug');
77 if ($debug) {
78  set_config('debug', $debug, $site->getGUID());
79 } else {
80  unset_config('debug', $site->getGUID());
81 }
82 
83 // allow new user registration?
84 $allow_registration = ('on' === get_input('allow_registration', false));
85 set_config('allow_registration', $allow_registration, $site->getGUID());
86 
87 // setup walled garden
88 $walled_garden = ('on' === get_input('walled_garden', false));
89 set_config('walled_garden', $walled_garden, $site->getGUID());
90 
91 $regenerate_site_secret = get_input('regenerate_site_secret', false);
93  // if you cancel this even you should present a message to the user
94  if (elgg_trigger_before_event('regenerate_site_secret', 'system')) {
97  elgg_trigger_after_event('regenerate_site_secret', 'system');
98 
99  system_message(elgg_echo('admin:site:secret_regenerated'));
100 
101  elgg_delete_admin_notice('weak_site_key');
102  }
103 }
104 
105 if ($site->save()) {
106  system_message(elgg_echo("admin:configuration:success"));
107 } else {
108  register_error(elgg_echo("admin:configuration:fail"));
109 }
110 
elgg_enable_system_cache()
Enables the system disk cache.
Definition: cache.php:72
elgg_delete_admin_notice($id)
Remove an admin notice by ID.
Definition: admin.php:92
elgg_get_site_entity($site_guid=0)
Get an entity (default is current site)
Definition: sites.php:18
elgg_reset_system_cache()
Reset the system cache by deleting the caches.
Definition: cache.php:29
_elgg_is_cache_symlinked()
Checks if /cache directory has been symlinked to views simplecache directory.
Definition: cache.php:235
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
unset_config($name, $site_guid=0)
Removes a config setting.
$allow_registration
sanitise_filepath($path, $append_slash=true)
Sanitise file paths ensuring that they begin and end with slashes etc.
Definition: elgglib.php:399
elgg_disable_system_cache()
Disables the system disk cache.
Definition: cache.php:84
init_site_secret()
Initialise the site secret (32 bytes: "z" to indicate format + 186-bit key in Base64 URL)...
Definition: actions.php:181
elgg_trigger_before_event($event, $object_type, $object=null)
Trigger a "Before event" indicating a process is about to begin.
Definition: elgglib.php:610
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
elgg_get_cache_path()
Get the cache directory path for this installation.
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
const REFERER
Definition: elgglib.php:2029
datalist_set($name, $value)
Set the value for a datalist element.
const ACCESS_PRIVATE
Definition: elgglib.php:1988
elgg_get_root_path()
Get the root directory path for this installation.
$dataroot
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
elgg_disable_simplecache()
Disables the simple cache.
Definition: cache.php:170
elgg_trigger_after_event($event, $object_type, $object=null)
Trigger an "After event" indicating a process has finished.
Definition: elgglib.php:629
$user_default_access
elgg_enable_simplecache()
Enables the simple cache.
Definition: cache.php:157
$regenerate_site_secret
system_message($message)
Display a system message on next page load.
Definition: elgglib.php:438
$cache_symlinked
$walled_garden
set_config($name, $value, $site_guid=0)
Add or update a config setting.