Permalink
Browse files

deprecate(config): deprecates config value "siteemail"

Motivation: removing this value will save a metadata fetch for anonymous
users in `Elgg\BootService::boot`. See #9096
  • Loading branch information...
mrclay committed Mar 4, 2016
1 parent 5531891 commit cdd4bb5f6dd12252aeb36e9ec025acc2f68e5072
@@ -18,6 +18,7 @@ Deprecated APIs
* ``ElggFile::setFilestore``
* ``get_default_filestore``
* ``set_default_filestore``
+ * ``elgg_get_config('siteemail')``: Use ``elgg_get_site_entity()->email``
From 1.x to 2.0
===============
View
@@ -110,6 +110,7 @@
* The site email from the current site object.
*
* @global string $CONFIG->siteemail
+ * @deprecated 2.1 Use elgg_get_site_entity()->email
*/
$CONFIG->siteemail;
@@ -150,7 +150,7 @@ public function boot() {
}
_elgg_services()->metadataCache->populateFromEntities($preload_md_guids);
- // TODO get rid of this, then we can drop the metadata preload
+ // TODO get rid of in 3.0, then we can drop the metadata preload for anon visitors
$CONFIG->siteemail = $CONFIG->site->email;
// gives hint to get() how to approach missing values
@@ -83,6 +83,11 @@ function elgg_get_engine_path() {
* @since 1.8.0
*/
function elgg_get_config($name, $site_guid = 0) {
+ if ($name === 'siteemail') {
+ $msg = 'The config value "siteemail" is deprecated. Use elgg_get_site_entity()->email';
+ elgg_deprecated_notice($msg, '2.1');
+ }
+
return _elgg_services()->config->get($name, $site_guid);
}
@@ -11,7 +11,11 @@
if ($warning != 'installation:warning:' . $field) {
echo "<b>" . $warning . "</b><br />";
}
- $value = elgg_get_config($field);
+ if ($field === 'siteemail') {
+ $value = elgg_get_site_entity()->email;
+ } else {
+ $value = elgg_get_config($field);
+ }
$form_body .= elgg_view("input/text",array('name' => $field, 'value' => $value));
$form_body .= "</div>";
}

0 comments on commit cdd4bb5

Please sign in to comment.