public function testElggSaveConfigForCurrentSiteConfig() { global $CONFIG; $name = 'foo' . rand(0, 1000); $value = 'test'; $this->assertTrue(elgg_save_config($name, $value)); $this->assertIdentical($value, elgg_get_config($name)); $this->assertIdentical($value, $CONFIG->{$name}); $this->assertTrue(elgg_remove_config($name)); }
/** * Removes a config setting. * * @note Internal: These settings are stored in the dbprefix_config table and read * during system boot into $CONFIG. * * @param string $name The name of the field. * * @return bool Success or failure * * @see get_config() * @see set_config() * * @deprecated Use elgg_remove_config() */ function unset_config($name) { elgg_deprecated_notice(__FUNCTION__ . ' is deprecated. Use elgg_remove_config().', '3.0'); return elgg_remove_config($name); }
<?php /** * Save the developer settings */ $site = elgg_get_site_entity(); if (get_input('simple_cache')) { elgg_enable_simplecache(); } else { elgg_disable_simplecache(); } if (get_input('system_cache')) { elgg_enable_system_cache(); } else { elgg_disable_system_cache(); } $debug = get_input('debug_level'); if ($debug) { elgg_save_config('debug', $debug); } else { elgg_remove_config('debug'); } $simple_settings = ['display_errors', 'screen_log', 'show_strings', 'wrap_views', 'log_events', 'show_gear', 'show_modules']; foreach ($simple_settings as $setting) { elgg_set_plugin_setting($setting, get_input($setting), 'developers'); } elgg_flush_caches(); system_message(elgg_echo('developers:settings:success')); forward(REFERER);
<?php /** * Elgg profile plugin edit default profile action removal * */ $id = get_input('id'); $fieldlist = elgg_get_config('profile_custom_fields'); if (!$fieldlist) { $fieldlist = ''; } $fieldlist = str_replace("{$id},", "", $fieldlist); $fieldlist = str_replace(",{$id}", "", $fieldlist); $fieldlist = str_replace("{$id}", "", $fieldlist); if ($id && elgg_remove_config("admin_defined_profile_{$id}") && elgg_remove_config("admin_defined_profile_type_{$id}") && elgg_save_config('profile_custom_fields', $fieldlist)) { system_message(elgg_echo('profile:editdefault:delete:success')); } else { register_error(elgg_echo('profile:editdefault:delete:fail')); } forward(REFERER);
<?php /** * Reset profile fields action * */ $fieldlist = elgg_get_config('profile_custom_fields'); if ($fieldlist) { $fieldlistarray = explode(',', $fieldlist); foreach ($fieldlistarray as $listitem) { elgg_remove_config("admin_defined_profile_{$listitem}"); elgg_remove_config("admin_defined_profile_type_{$listitem}"); } } elgg_remove_config('profile_custom_fields'); system_message(elgg_echo('profile:defaultprofile:reset')); forward(REFERER);