Exemplo n.º 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('system_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());
     set_config('allow_user_default_access', '', $site->getGUID());
     $this->enablePlugins();
     return TRUE;
 }
     throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootNotWritable'), $dataroot));
 }
 $site = new ElggSite();
 $site->name = get_input('sitename');
 $site->url = get_input('wwwroot');
 $site->description = get_input('sitedescription');
 $site->email = get_input('siteemail');
 $site->access_id = ACCESS_PUBLIC;
 $guid = $site->save();
 if (!$guid) {
     throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot')));
 }
 datalist_set('installed', time());
 datalist_set('path', $path);
 datalist_set('dataroot', $dataroot);
 datalist_set('default_site', $site->getGUID());
 set_config('view', get_input('view'), $site->getGUID());
 set_config('language', get_input('language'), $site->getGUID());
 set_config('default_access', get_input('default_access'), $site->getGUID());
 $debug = get_input('debug');
 if ($debug) {
     set_config('debug', 1, $site->getGUID());
 } else {
     unset_config('debug', $site->getGUID());
 }
 $usage = get_input('usage');
 if (is_array($usage)) {
     $usage = $usage[0];
 }
 if ($usage) {
     unset_config('ping_home', $site->getGUID());
Exemplo n.º 3
0
 /**
  * Initialize the site including site entity, plugins, and configuration
  *
  * @param array $submissionVars Submitted vars
  *
  * @return bool
  */
 protected function saveSiteSettings($submissionVars)
 {
     // ensure that file path, data path, and www root end in /
     $submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
     $submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
     $site = new ElggSite();
     $site->name = strip_tags($submissionVars['sitename']);
     $site->url = $submissionVars['wwwroot'];
     $site->access_id = ACCESS_PUBLIC;
     $site->email = $submissionVars['siteemail'];
     $guid = $site->save();
     if (!$guid) {
         register_error(_elgg_services()->translator->translate('install:error:createsite'));
         return FALSE;
     }
     // bootstrap site info
     $this->CONFIG->site_guid = $guid;
     $this->CONFIG->site = $site;
     _elgg_services()->configTable->set('installed', time());
     _elgg_services()->configTable->set('dataroot', $submissionVars['dataroot']);
     _elgg_services()->configTable->set('default_site', $site->getGUID());
     _elgg_services()->configTable->set('version', elgg_get_version());
     _elgg_services()->configTable->set('simplecache_enabled', 1);
     _elgg_services()->configTable->set('system_cache_enabled', 1);
     _elgg_services()->configTable->set('simplecache_lastupdate', time());
     // new installations have run all the upgrades
     $upgrades = elgg_get_upgrade_files(\Elgg\Application::elggDir()->getPath("/engine/lib/upgrades/"));
     _elgg_services()->configTable->set('processed_upgrades', $upgrades);
     _elgg_services()->configTable->set('view', 'default', $site->getGUID());
     _elgg_services()->configTable->set('language', 'en', $site->getGUID());
     _elgg_services()->configTable->set('default_access', $submissionVars['siteaccess'], $site->getGUID());
     _elgg_services()->configTable->set('allow_registration', TRUE, $site->getGUID());
     _elgg_services()->configTable->set('walled_garden', FALSE, $site->getGUID());
     _elgg_services()->configTable->set('allow_user_default_access', '', $site->getGUID());
     _elgg_services()->configTable->set('default_limit', 10, $site->getGUID());
     _elgg_services()->configTable->set('security_protect_upgrade', true, $site->getGUID());
     _elgg_services()->configTable->set('security_notify_admins', true, $site->getGUID());
     _elgg_services()->configTable->set('security_notify_user_password', true, $site->getGUID());
     _elgg_services()->configTable->set('security_email_require_password', true, $site->getGUID());
     $this->setSubtypeClasses();
     $this->enablePlugins();
     return TRUE;
 }
Exemplo n.º 4
0
 /**
  * Initialize the site including site entity, plugins, and configuration
  *
  * @param array $submissionVars Submitted vars
  *
  * @return bool
  */
 protected function saveSiteSettings($submissionVars)
 {
     // ensure that file path, data path, and www root end in /
     $submissionVars['dataroot'] = sanitise_filepath($submissionVars['dataroot']);
     $submissionVars['wwwroot'] = sanitise_filepath($submissionVars['wwwroot']);
     $site = new ElggSite();
     $site->name = strip_tags($submissionVars['sitename']);
     $site->url = $submissionVars['wwwroot'];
     $site->access_id = ACCESS_PUBLIC;
     $site->email = $submissionVars['siteemail'];
     $guid = $site->save();
     if (!$guid) {
         register_error(_elgg_services()->translator->translate('install:error:createsite'));
         return FALSE;
     }
     // bootstrap site info
     $this->CONFIG->site_guid = $guid;
     $this->CONFIG->site_id = $guid;
     $this->CONFIG->site = $site;
     _elgg_services()->datalist->set('installed', time());
     _elgg_services()->datalist->set('dataroot', $submissionVars['dataroot']);
     _elgg_services()->datalist->set('default_site', $site->getGUID());
     _elgg_services()->datalist->set('version', elgg_get_version());
     _elgg_services()->datalist->set('simplecache_enabled', 1);
     _elgg_services()->datalist->set('system_cache_enabled', 1);
     _elgg_services()->datalist->set('simplecache_lastupdate', time());
     // @todo plugins might use this, but core doesn't. remove in 2.0
     _elgg_services()->datalist->set('path', $this->CONFIG->path);
     // new installations have run all the upgrades
     $upgrades = elgg_get_upgrade_files("{$this->CONFIG->path}engine/lib/upgrades/");
     _elgg_services()->datalist->set('processed_upgrades', serialize($upgrades));
     _elgg_services()->configTable->set('view', 'default', $site->getGUID());
     _elgg_services()->configTable->set('language', 'en', $site->getGUID());
     _elgg_services()->configTable->set('default_access', $submissionVars['siteaccess'], $site->getGUID());
     _elgg_services()->configTable->set('allow_registration', TRUE, $site->getGUID());
     _elgg_services()->configTable->set('walled_garden', FALSE, $site->getGUID());
     _elgg_services()->configTable->set('allow_user_default_access', '', $site->getGUID());
     _elgg_services()->configTable->set('default_limit', 10, $site->getGUID());
     $this->setSubtypeClasses();
     $this->enablePlugins();
     return TRUE;
 }