delete() public method

Invalidate a given key.
public delete ( string $key ) : boolean
$key string Name
return boolean
Example #1
0
 /**
  * Initialize the site including site entity, plugins, and configuration
  *
  * @param array $submissionVars Submitted vars
  *
  * @return bool
  */
 protected function saveSiteSettings($submissionVars)
 {
     global $CONFIG;
     // ensure that file path, data path, and www root end in /
     $submissionVars['path'] = sanitise_filepath($submissionVars['path']);
     $submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
     $submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
     $site = new ElggSite();
     $site->name = $submissionVars['sitename'];
     $site->url = $submissionVars['wwwroot'];
     $site->access_id = ACCESS_PUBLIC;
     $site->email = $submissionVars['siteemail'];
     $guid = $site->save();
     if (!$guid) {
         register_error(elgg_echo('install:error:createsite'));
         return FALSE;
     }
     // bootstrap site info
     $CONFIG->site_guid = $guid;
     $CONFIG->site = $site;
     datalist_set('installed', time());
     datalist_set('path', $submissionVars['path']);
     datalist_set('dataroot', $submissionVars['dataroot']);
     datalist_set('default_site', $site->getGUID());
     datalist_set('version', get_version());
     datalist_set('simplecache_enabled', 1);
     datalist_set('viewpath_cache_enabled', 1);
     // new installations have run all the upgrades
     $upgrades = elgg_get_upgrade_files($submissionVars['path'] . 'engine/lib/upgrades/');
     datalist_set('processed_upgrades', serialize($upgrades));
     set_config('view', 'default', $site->getGUID());
     set_config('language', 'en', $site->getGUID());
     set_config('default_access', $submissionVars['siteaccess'], $site->getGUID());
     set_config('allow_registration', TRUE, $site->getGUID());
     set_config('walled_garden', FALSE, $site->getGUID());
     $this->enablePlugins();
     // reset the views path in case of installing over an old data dir.
     $dataroot = $submissionVars['dataroot'];
     $CONFIG->dataroot = $dataroot;
     $cache = new ElggFileCache($dataroot);
     $cache->delete('view_paths');
     return TRUE;
 }
        } else {
            unset_config('https_login', $site->getGUID());
        }
        // activate some plugins by default
        if (isset($CONFIG->default_plugins)) {
            if (!is_array($CONFIG->default_plugins)) {
                $plugins = explode(',', $CONFIG->default_plugins);
            } else {
                $CONFIG->default_plugins = $CONFIG->default_plugins;
            }
            foreach ($plugins as $plugin) {
                enable_plugin(trim($plugin), $site->getGUID());
            }
        } else {
            enable_plugin('profile', $site->getGUID());
            enable_plugin('logbrowser', $site->getGUID());
            enable_plugin('diagnostics', $site->getGUID());
            enable_plugin('uservalidationbyemail', $site->getGUID());
            enable_plugin('htmlawed', $site->getGUID());
            enable_plugin('search', $site->getGUID());
        }
        // reset the views path in case of installing over an old data dir.
        // @todo should this warn / error first?
        $dataroot = datalist_get('dataroot');
        $cache = new ElggFileCache($dataroot);
        $cache->delete('view_paths');
        system_message(elgg_echo("installation:configuration:success"));
        header("Location: ../../account/register.php");
        exit;
    }
}