75 public function run(): \
Elgg\Http\ResponseBuilder {
78 $this->is_action =
$app->internal_services->request->getMethod() ===
'POST';
97 $params =
$app->internal_services->request->request->all();
99 $method =
'run' . ucwords(
$step);
101 return $this->$method(
$params);
117 $config->installer_running =
true;
118 $config->dbencoding =
'utf8mb4';
120 $config->system_cache_enabled =
false;
121 $config->simplecache_enabled =
false;
122 $config->debug = \Psr\Log\LogLevel::WARNING;
123 $config->cacheroot = sys_get_temp_dir() .
'elgginstaller/caches';
124 $config->assetroot = sys_get_temp_dir() .
'elgginstaller/assets';
126 $app = Application::factory([
128 'handle_exceptions' =>
false,
129 'handle_shutdown' =>
false,
137 Application::setInstance($app);
141 $app->internal_services->bootCache->disable();
142 $app->internal_services->pluginsCache->disable();
143 $app->internal_services->accessCache->disable();
144 $app->internal_services->metadataCache->disable();
145 $app->internal_services->serverCache->disable();
148 $index_admin = array_search(
'admin', $this->getSteps());
149 $index_complete = array_search(
'complete', $this->getSteps());
150 $index_step = array_search(
$current_step, $this->getSteps());
154 $use_elgg_session = ($index_step == $index_admin) || ($index_step == $index_complete);
155 if (!$use_elgg_session) {
158 $app->internal_services->set(
'session',
$session);
161 $app->internal_services->views->setViewtype(
'installation');
162 $app->internal_services->views->registerViewtypeFallback(
'installation');
163 $app->internal_services->views->registerViewsFromPath(
Paths::elgg());
164 $app->internal_services->translator->registerTranslations(
Paths::elgg() .
'install/languages/',
true);
188 $app = $this->getApp();
191 'dbhost' =>
'localhost',
193 'dbprefix' =>
'elgg_',
211 foreach ($required_params as
$key) {
221 if ($create_htaccess) {
223 if (!$rewrite_tester->createHtaccess(
$params[
'wwwroot'])) {
228 if (!\
Elgg\Http\Urls::isValidMultiByteUrl(
$params[
'wwwroot'])) {
235 $this->determineInstallStatus();
237 if (!$this->has_completed[
'config']) {
238 if (!$this->createSettingsFile(
$params)) {
243 $this->loadSettingsFile();
246 $config = $app->internal_services->config;
251 $db_config = $app->internal_services->dbConfig->getConnectionConfig();
257 'dbpassword' =>
'password',
258 'dbname' =>
'database',
259 'dbprefix' =>
'prefix',
261 foreach ($db_config_keys as $params_key => $db_config_key) {
262 if (
$params[$params_key] !== (
string) $db_config[$db_config_key]) {
267 if (!$this->connectToDatabase()) {
271 if (!$this->has_completed[
'database']) {
272 if (!$this->installDatabase()) {
278 $this->finishBootstrapping(
'settings');
280 if (!$this->saveSiteSettings(
$params)) {
284 if (!$this->createAdminAccount(
$params)) {
298 $vars[
'next_step'] = $this->getNextStep(
$step);
309 'steps' => $this->getSteps(),
313 return new \Elgg\Http\OkResponse(
$output);
326 return $this->render(
'welcome');
346 $this->checkRewriteRules(
$report);
349 if ($this->checkSettingsFile(
$report) !==
true) {
351 $this->isInstallDirWritable(
$report);
357 'severity' =>
'notice',
358 'message' =>
elgg_echo(
'install:check:database'),
362 return $this->render(
'requirements', [
364 'num_failures' => $this->countNumConditions(
$report,
'error'),
365 'num_warnings' => $this->countNumConditions(
$report,
'warning'),
378 protected function runDatabase(array $submissionVars = []): \
Elgg\Http\ResponseBuilder {
380 $app = $this->getApp();
389 'type' =>
'password',
400 'value' =>
'localhost',
422 'value' => $app->internal_services->config->wwwroot,
426 'type' =>
'dropdown',
428 'options' => \DateTimeZone::listIdentifiers(),
433 if ($this->checkSettingsFile()) {
435 $this->is_action =
true;
438 if ($this->is_action) {
439 $getResponse =
function () use ($app, $submissionVars, $formVars) {
441 if (!$this->checkSettingsFile()) {
442 if (!$this->validateDatabaseVars($submissionVars, $formVars)) {
447 if (!$this->createSettingsFile($submissionVars)) {
453 if (!$this->connectToDatabase()) {
457 if (!$this->installDatabase()) {
461 $app->internal_services->system_messages->addSuccessMessage(
elgg_echo(
'install:success:database'));
463 return $this->continueToNextStep(
'database');
472 $formVars = $this->makeFormSticky($formVars, $submissionVars);
474 $params = [
'variables' => $formVars,];
476 if ($this->checkSettingsFile()) {
481 return $this->render(
'database',
$params);
493 protected function runSettings(array $submissionVars = []): \
Elgg\Http\ResponseBuilder {
495 $app = $this->getApp();
500 'value' =>
'My New Community',
515 if ($this->is_action) {
516 $getResponse =
function () use ($app, $submissionVars, $formVars) {
518 if (!$this->validateSettingsVars($submissionVars, $formVars)) {
522 if (!$this->saveSiteSettings($submissionVars)) {
526 $app->internal_services->system_messages->addSuccessMessage(
elgg_echo(
'install:success:settings'));
528 return $this->continueToNextStep(
'settings');
537 $formVars = $this->makeFormSticky($formVars, $submissionVars);
539 return $this->render(
'settings', [
'variables' => $formVars]);
551 protected function runAdmin(array $submissionVars = []): \
Elgg\Http\ResponseBuilder {
552 $app = $this->getApp();
571 'type' =>
'password',
574 'pattern' =>
'.{6,}',
577 'type' =>
'password',
583 if ($this->is_action) {
584 $getResponse =
function () use ($app, $submissionVars, $formVars) {
585 if (!$this->validateAdminVars($submissionVars, $formVars)) {
589 if (!$this->createAdminAccount($submissionVars,
true)) {
593 $app->internal_services->system_messages->addSuccessMessage(
elgg_echo(
'install:success:admin'));
595 return $this->continueToNextStep(
'admin');
607 $lang = $app->internal_services->translator->getCurrentLanguage();
608 $translations = $app->internal_services->translator->getLoadedTranslations();
610 $app->internal_services->translator->addTranslation(
$lang, [
611 'install:admin:help:password1' => sprintf(
613 $app->internal_services->config->min_password_length
617 $formVars = $this->makeFormSticky($formVars, $submissionVars);
619 return $this->render(
'admin', [
'variables' => $formVars]);
638 $result = $this->render(
'complete');
666 return in_array(
$step, $this->getSteps()) ?
$step :
'welcome';
677 $this->is_action = false;
679 return new \Elgg\Http\RedirectResponse($this->getNextStepUrl($currentStep));
690 $index = 1 + array_search($currentStep, $this->steps);
692 return $this->steps[
$index] ??
'';
703 $app = $this->getApp();
704 $nextStep = $this->getNextStep($currentStep);
706 return $app->internal_services->config->wwwroot .
"install.php?step={$nextStep}";
716 $app = $this->getApp();
718 $path = Config::resolvePath();
723 $this->loadSettingsFile();
725 $this->has_completed[
'config'] =
true;
728 $dbSettingsPass = $this->checkDatabaseSettings($app->internal_services->dbConfig);
730 if (!$dbSettingsPass) {
734 $db = $app->internal_services->db;
738 $result =
$db->getConnection(DbConfig::READ)->executeQuery(
'SHOW TABLES');
744 if (in_array(
"{$db->prefix}config",
$table)) {
745 $this->has_completed[
'database'] =
true;
749 if ($this->has_completed[
'database'] ===
false) {
754 $qb = \Elgg\Database\Select::fromTable(\
Elgg\
Database\ConfigTable::TABLE_NAME);
755 $qb->select(
'COUNT(*) AS total');
759 $this->has_completed[
'settings'] =
true;
766 $qb->select(
'COUNT(*) AS total')
771 $this->has_completed[
'admin'] =
true;
776 throw new InstallationException(
'Elgg can not connect to the database: ' . $ex->getMessage(), $ex->getCode(), $ex);
793 if (!in_array(
false, $this->has_completed)) {
795 return new \Elgg\Http\RedirectResponse(
'/');
815 if ($this->has_completed[
'database'] ===
false) {
819 if ($this->has_completed[
'settings'] ===
false) {
820 return new \Elgg\Http\RedirectResponse(
'install.php?step=settings');
823 if ($this->has_completed[
'admin'] ===
false) {
824 return new \Elgg\Http\RedirectResponse(
'install.php?step=admin');
828 return new \Elgg\Http\RedirectResponse(
'install.php?step=complete');
845 $app = $this->getApp();
847 $index_db = array_search(
'database', $this->getSteps());
848 $index_step = array_search(
$step, $this->getSteps());
850 if ($index_step > $index_db) {
854 $app->internal_services->config->site = new \ElggSite();
868 $app = $this->getApp();
873 $config->testing_mode = $app->internal_services->config->testing_mode;
875 $app->internal_services->set(
'config', $app->internal_services->initConfig(
$config));
878 $app->internal_services->db->resetConnections($app->internal_services->dbConfig);
879 }
catch (\Exception $e) {
896 protected function makeFormSticky(array $formVars = [], array $submissionVars = []): array {
914 if (!is_writable(
Paths::projectConfig())) {
917 'severity' =>
'error',
918 'message' =>
elgg_echo(
'install:check:installdir', [Paths::PATH_TO_CONFIG]),
936 if (!is_file(
Config::resolvePath())) {
940 if (!is_readable(Config::resolvePath())) {
943 'severity' =>
'error',
944 'message' =>
elgg_echo(
'install:check:readsettings'),
962 if (version_compare(PHP_VERSION, self::PHP_MINIMAL_VERSION,
'<')) {
964 'severity' =>
'error',
965 'message' =>
elgg_echo(
'install:check:php:version', [self::PHP_MINIMAL_VERSION, PHP_VERSION]),
969 $this->checkPhpExtensions($phpReport);
971 $this->checkPhpDirectives($phpReport);
973 if (count($phpReport) == 0) {
975 'severity' =>
'success',
976 'message' =>
elgg_echo(
'install:check:php:success'),
1002 'severity' =>
'error',
1014 'severity' =>
'warning',
1029 if (ini_get(
'open_basedir')) {
1031 'severity' =>
'warning',
1032 'message' =>
elgg_echo(
'install:check:php:open_basedir'),
1036 if (ini_get(
'safe_mode')) {
1038 'severity' =>
'warning',
1039 'message' =>
elgg_echo(
'install:check:php:safe_mode'),
1043 if (ini_get(
'arg_separator.output') !==
'&') {
1044 $separator = htmlspecialchars(ini_get(
'arg_separator.output'));
1046 'severity' =>
'error',
1051 if (ini_get(
'register_globals')) {
1053 'severity' =>
'error',
1054 'message' =>
elgg_echo(
'install:check:php:register_globals'),
1058 if (ini_get(
'session.auto_start')) {
1060 'severity' =>
'error',
1061 'message' =>
elgg_echo(
'install:check:php:session.auto_start'),
1076 $url = $this->getApp()->internal_services->config->wwwroot;
1077 $url .= Request::REWRITE_TEST_TOKEN .
'?' . http_build_query([Request::REWRITE_TEST_TOKEN =>
'1']);
1092 foreach (
$report as $checks) {
1093 foreach ($checks as $check) {
1094 if ($check[
'severity'] === $condition) {
1117 $app = $this->getApp();
1120 if (
$info[
'required'] ===
true && !$submissionVars[
$field]) {
1122 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:requiredfield', [
$name]));
1128 if (!empty($submissionVars[
'wwwroot']) && !\
Elgg\Http\Urls::isValidMultiByteUrl($submissionVars[
'wwwroot'])) {
1129 $save_value = $this->sanitizeInputValue($submissionVars[
'wwwroot']);
1130 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:wwwroot', [$save_value]));
1136 if (stripos(PHP_OS,
'win') === 0) {
1137 if (strpos($submissionVars[
'dataroot'],
':') !== 1) {
1138 $save_value = $this->sanitizeInputValue($submissionVars[
'dataroot']);
1139 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:relative_path', [$save_value]));
1144 if (!str_starts_with($submissionVars[
'dataroot'],
'/')) {
1145 $save_value = $this->sanitizeInputValue($submissionVars[
'dataroot']);
1146 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:relative_path', [$save_value]));
1153 if (!is_dir($submissionVars[
'dataroot'])) {
1154 $save_value = $this->sanitizeInputValue($submissionVars[
'dataroot']);
1155 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:datadirectoryexists', [$save_value]));
1161 if (!is_writable($submissionVars[
'dataroot'])) {
1162 $save_value = $this->sanitizeInputValue($submissionVars[
'dataroot']);
1163 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:writedatadirectory', [$save_value]));
1169 if (stripos($submissionVars[
'dataroot'],
Paths::project()) === 0) {
1170 $save_value = $this->sanitizeInputValue($submissionVars[
'dataroot']);
1171 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:locationdatadirectory', [$save_value]));
1181 if (!empty($submissionVars[
'dbprefix']) && !preg_match(
'/^[a-zA-Z_][\w]*$/', $submissionVars[
'dbprefix'])) {
1182 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:database_prefix'));
1188 'dbhost' => $submissionVars[
'dbhost'],
1189 'dbport' => $submissionVars[
'dbport'],
1190 'dbuser' => $submissionVars[
'dbuser'],
1191 'dbpass' => $submissionVars[
'dbpassword'],
1192 'dbname' => $submissionVars[
'dbname'],
1193 'dbencoding' =>
'utf8mb4',
1196 return $this->checkDatabaseSettings(
$config);
1207 $app = $this->getApp();
1209 $db =
new Database(
$config, $app->internal_services->queryCache, $app->internal_services->config);
1212 $db->getConnection(DbConfig::READ)->executeQuery(
'SELECT 1');
1214 if (str_starts_with($e->getMessage(),
"Elgg couldn't connect")) {
1215 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:databasesettings'));
1218 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:nodatabase', [$database]));
1226 $min_version =
$db->isMariaDB() ? self::MARIADB_MINIMAL_VERSION : self::MYSQL_MINIMAL_VERSION;
1245 $app = $this->getApp();
1247 $template = file_get_contents(
Paths::elgg() .
'elgg-config/settings.example.php');
1249 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:readsettingsphp'));
1254 foreach (
$params as $k => $v) {
1258 $v = Paths::sanitize($v);
1261 $v = addslashes($v);
1265 $template = str_replace(
'{{' . $k .
'}}', $v, $template);
1268 $result = file_put_contents(Config::resolvePath(), $template);
1270 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:writesettingphp'));
1286 $this->getApp()->internal_services->set(
'dbConfig', $dbConfig);
1287 $this->getApp()->internal_services->db->resetConnections($dbConfig);
1299 $app = $this->getApp();
1300 $app->internal_services->db->setupConnections();
1302 $app->internal_services->system_messages->addErrorMessage($e->getMessage());
1317 return $this->getApp()->migrate();
1318 }
catch (\Exception $e) {
1337 if ($formVars[
'dataroot'][
'type'] !==
'combo') {
1342 if ($submissionVars[
'dataroot'] !==
'dataroot-checkbox') {
1347 if (file_exists($dir) || mkdir($dir, 0755)) {
1348 $submissionVars[
'dataroot'] = $dir;
1349 if (!file_exists(
"{$dir}/.htaccess")) {
1350 $htaccess =
"Order Deny,Allow\nDeny from All\n";
1351 if (!file_put_contents(
"$dir/.htaccess", $htaccess)) {
1371 $app = $this->getApp();
1374 $submissionVars[
$field] = trim($submissionVars[
$field]);
1375 if (
$info[
'required'] ===
true && $submissionVars[
$field] ===
'') {
1377 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:requiredfield', [
$name]));
1384 if ($submissionVars[
'siteemail'] && !
elgg_is_valid_email((
string) $submissionVars[
'siteemail'])) {
1385 $save_value = $this->sanitizeInputValue($submissionVars[
'siteemail']);
1386 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:emailaddress', [$save_value]));
1402 $app = $this->getApp();
1407 $site = new \ElggSite();
1408 $site->name = strip_tags($submissionVars[
'sitename']);
1410 $site->email = $submissionVars[
'siteemail'];
1414 if (
$site->guid !== 1) {
1415 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:createsite'));
1420 $app->internal_services->config->site =
$site;
1423 'installed' => time(),
1424 'simplecache_enabled' => 1,
1425 'system_cache_enabled' => 1,
1426 'simplecache_minify_js' =>
true,
1427 'simplecache_minify_css' =>
true,
1428 'lastcache' => time(),
1430 'default_access' => $submissionVars[
'siteaccess'],
1431 'allow_registration' =>
false,
1432 'require_admin_validation' =>
false,
1433 'walled_garden' =>
false,
1434 'allow_user_default_access' =>
'',
1435 'default_limit' => 10,
1445 $app->internal_services->reset(
'plugins');
1447 if (
elgg_extract(
'activate_plugins', $submissionVars,
true)) {
1448 $plugins = $app->internal_services->plugins->find(
'all');
1450 foreach ($plugins as
$plugin) {
1451 $plugin_config =
$plugin->getStaticConfig(
'plugin', []);
1452 if (!
elgg_extract(
'activate_on_install', $plugin_config,
false)) {
1465 $app->internal_services->events->unregisterHandler(
'create:after',
'object', \
Elgg\Upgrade\CreateAdminNoticeHandler::class);
1466 $upgrades = $app->internal_services->upgradeLocator->locate();
1470 }
catch (\Exception $e) {
1471 $app->internal_services->logger->log(\Psr\Log\LogLevel::ERROR, $e);
1487 $app = $this->getApp();
1490 if (
$info[
'required'] ===
true && !$submissionVars[
$field]) {
1492 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:requiredfield', [
$name]));
1498 if ($submissionVars[
'password1'] !== $submissionVars[
'password2']) {
1499 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:admin:password:mismatch'));
1504 if (trim($submissionVars[
'password1']) ===
'') {
1505 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:admin:password:empty'));
1510 $minLength = $app->internal_services->configTable->get(
'min_password_length');
1511 if (strlen($submissionVars[
'password1']) < $minLength) {
1512 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:admin:password:tooshort'));
1518 if ($submissionVars[
'email'] && !
elgg_is_valid_email((
string) $submissionVars[
'email'])) {
1519 $save_value = $this->sanitizeInputValue($submissionVars[
'email']);
1520 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:emailaddress', [$save_value]));
1537 $app = $this->getApp();
1541 'username' => $submissionVars[
'username'],
1542 'password' => $submissionVars[
'password1'],
1543 'name' => $submissionVars[
'displayname'],
1544 'email' => $submissionVars[
'email'],
1547 $app->internal_services->system_messages->addErrorMessage($e->getMessage());
1553 if (!
$user->makeAdmin()) {
1554 $app->internal_services->system_messages->addErrorMessage(elgg_echo(
'install:error:adminaccess'));
1559 $user->validated =
true;
1560 $user->validated_method =
'admin_user';
1569 $app->internal_services->system_messages->addErrorMessage(
elgg_echo(
'install:error:adminlogin'));
1585 if (is_array($input_value)) {
1586 return array_map([$this, __FUNCTION__], $input_value);
1589 if (!is_string($input_value)) {
1590 return $input_value;
1593 return htmlspecialchars($input_value);
if(empty($guid)) $upgrade
if(! $user||! $user->canDelete()) $name
$params
Saves global plugin settings.
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
foreach( $paths as $path)
foreach($categories as $key=> $category) $body
getNextStepUrl(string $currentStep)
Get the URL of the next step.
run()
Dispatches a request to one of the step controllers.
batchInstall(array $params, bool $create_htaccess=false)
A batch install of Elgg.
const PHP_MINIMAL_VERSION
runWelcome()
Step controllers.
sanitizeInputValue($input_value)
Sanitize input to help prevent XSS.
runDatabase(array $submissionVars=[])
Database set up controller.
getApp()
Build the application needed by the installer.
getSteps()
Step management.
resumeInstall(string $step)
Check if this is a case of an installation being resumed and figure out where to continue from.
continueToNextStep(string $currentStep)
Forwards the browser to the next step.
saveSiteSettings(array $submissionVars)
Initialize the site including site entity, plugins, and configuration.
determineInstallStatus()
Updates $this->has_completed according to the current installation.
const MYSQL_MINIMAL_VERSION
runComplete()
Controller for last step.
validateAdminVars(array $submissionVars, array $formVars)
Validate account form variables.
getNextStep(string $currentStep)
Get the next step as a string.
checkSettingsFile(array &$report=[])
Check that the settings file exists.
validateSettingsVars(array $submissionVars, array $formVars)
Validate the site settings form variables.
createSettingsFile(array $params)
Writes the settings file to the engine directory.
createAdminAccount(array $submissionVars, bool $login=false)
Create a user account for the admin.
render(string $step, array $vars=[])
Renders the data passed by a controller.
checkPhpExtensions(array &$phpReport)
Check the server's PHP extensions.
validateDatabaseVars(array $submissionVars, array $formVars)
Database support methods.
finishBootstrapping(string $step)
Bootstrapping.
runAdmin(array $submissionVars=[])
Admin account controller.
checkInstallCompletion(string $step)
Security check to ensure the installer cannot be run after installation has finished.
getCurrentStep()
Returns current step.
const MARIADB_MINIMAL_VERSION
countNumConditions(array $report, string $condition)
Count the number of failures in the requirements report.
connectToDatabase()
Bootstrap database connection before entire engine is available.
runRequirements(array $vars=[])
Requirements controller.
makeFormSticky(array $formVars=[], array $submissionVars=[])
Action handling methods.
checkPHP(array &$report)
Check version of PHP, extensions, and variables.
loadSettingsFile()
Load settings.
checkPhpDirectives(array &$phpReport)
Check PHP parameters.
checkRewriteRules(array &$report)
Confirm that the rewrite rules are firing.
createDataDirectory(array &$submissionVars, array $formVars)
Site settings support methods.
installDatabase()
Create the database tables.
checkDatabaseSettings(DbConfig $config)
Confirm the settings for the database.
runSettings(array $submissionVars=[])
Site settings controller.
isInstallDirWritable(array &$report)
Indicates whether the webserver can add settings.php on its own or not.
static fromFiles(Config $config)
Create a session stored in files.
Load, boot, and implement a front controller for an Elgg application.
Database configuration service.
A generic parent class for Configuration exceptions.
Thrown when there is a major problem with the installation.
Could not register a new user for whatever reason.
A generic parent class for database exceptions.
Generic parent class for login exceptions.
Find Elgg and project paths.
static sanitize($path, $append_slash=true)
Sanitize file paths ensuring that they begin and end with slashes etc.
Test if URL rewriting is working.
elgg_save_config(string $name, $value)
Save a configuration setting.
const ELGG_IGNORE_ACCESS
elgg_call() flags
if(! $item instanceof ElggEntity) $link
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
$config
Advanced site settings, debugging section.
foreach($requiredExtensions as $extension) $recommendedExtensions
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
elgg()
Bootstrapping and helper procedural code available for use in Elgg core and plugins.
_elgg_services()
Get the global service provider.
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_add_admin_notice(string $id, string $message)
Write a persistent message to the admin view.
elgg_register_user(array $params=[])
Registers a user.
elgg_get_site_entity()
Get the current site entity.
elgg_delete_directory(string $directory, bool $leave_base_directory=false)
Delete a directory and all its contents.
foreach(array_keys($combine_languages) as $language) $translations
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
elgg_view_page(string $title, string|array $body, string $page_shell='default', array $vars=[])
Assembles and outputs a full page.
elgg_view_url(string $href, ?string $text=null, array $options=[])
Helper function for outputting urls.
elgg_view(string $view, array $vars=[], string $viewtype='')
Return a parsed view.
if(isset($_COOKIE['elggperm'])) $session
elgg_normalize_url(string $url)
elgg_format_element(string $tag_name, array $attributes=[], string $text='', array $options=[])
Format an HTML element.
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
elgg_login(\ElggUser $user, bool $persistent=false)
Log in a user.
$upgrades
Lists pending upgrades.