Controller for installing Elgg. Supports both web-based on CLI installation. This controller steps the user through the install process. The method for each step handles both the GET and POST requests. There is no XSS/CSRF protection on the POST processing since the installer is only run once by the administrator. The installation process can be resumed by hitting the first page. The installer will try to figure out where to pick up again. All the logic for the installation process is in this class, but it depends on the core libraries. To do this, we selectively load a subset of the core libraries for the first few steps and then load the entire engine once the database and site settings are configured. In addition, this controller does its own session handling until the database is setup. There is an aborted attempt in the code at creating the data directory for users as a subdirectory of Elgg's root. The idea was to protect this directory through a .htaccess file. The problem is that a malicious user can upload a .htaccess of his own that overrides the protection for his user directory. The best solution is server level configuration that turns off AllowOverride for the data directory. See ticket #3453 for discussion on this.
コード例 #1
0
ファイル: install.php プロジェクト: gzachos/elgg_ellak
<?php

/**
 * Elgg install script
 *
 * @package Elgg
 * @subpackage Core
 */
// check for PHP 4 before we do anything else
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
    echo "Your server's version of PHP (" . PHP_VERSION . ") is too old to run Elgg.\n";
    exit;
}
require_once __DIR__ . "/vendor/autoload.php";
$installer = new ElggInstaller();
$step = get_input('step', 'welcome');
$installer->run($step);
コード例 #2
0
ファイル: Application.php プロジェクト: 007arunwilson/Elgg
 /**
  * Renders a web UI for installing Elgg.
  * 
  * @return void
  */
 public static function install()
 {
     ini_set('display_errors', 1);
     $installer = new \ElggInstaller();
     $step = get_input('step', 'welcome');
     $installer->run($step);
 }
コード例 #3
0
ファイル: sample_installer.php プロジェクト: redvabel/Vabelgg
<?php

/**
 * Sample cli installer script
 */
require_once dirname(dirname(__FILE__)) . "/ElggInstaller.php";
$installer = new ElggInstaller();
$params = array('dbuser' => '', 'dbpassword' => '', 'dbname' => '', 'sitename' => '', 'wwwroot' => '', 'dataroot' => '', 'displayname' => '', 'email' => '', 'username' => '', 'password' => '');
// install and create the .htaccess file
$installer->batchInstall($params, TRUE);
コード例 #4
0
/**
 * Docker CLI Elgg installer script 
 */
$autoload_path = '/var/www/html/vendor/autoload.php';
$autoload_available = (include_once $autoload_path);
if (!$autoload_available) {
    die("Couldn't include '{$autoload_path}'. Did you run `composer install`?");
}
$params = array('dbuser' => getenv('ELGG_DB_USER'), 'dbpassword' => getenv('ELGG_DB_PASS'), 'dbname' => getenv('ELGG_DB_NAME'), 'dbhost' => getenv('ELGG_DB_HOST'), 'dbprefix' => getenv('ELGG_DB_PREFIX'), 'sitename' => getenv('ELGG_SITE_NAME'), 'siteemail' => getenv('ELGG_SITE_EMAIL'), 'wwwroot' => getenv('ELGG_WWW_ROOT'), 'dataroot' => getenv('ELGG_DATA_ROOT'), 'displayname' => getenv('ELGG_DISPLAY_NAME'), 'email' => getenv('ELGG_EMAIL'), 'username' => getenv('ELGG_USERNAME'), 'password' => getenv('ELGG_PASSWORD'), 'path' => getenv('ELGG_PATH'));
if (strlen($params['password']) < 6) {
    echo "Elgg Admin password ({$params['password']}) must be at least 6 characters long.\n";
    exit(1);
}
$createHtaccess = file_exists($params['path'] . '.htaccess') ? false : true;
$installer = new ElggInstaller();
$installer->batchInstall($params, $createHtaccess);
/**
 * Elgg create symbolic links on instalation with composer 
 * See "post-install-cmd": "\\Elgg\\Composer\\PostInstall::execute", for details.
 * Links are created on your local machine.
 * The links need to be changed to the container directories
 */
$path_mod_root = getenv('ELGG_PATH') . 'mod/';
$mods = scandir($path_mod_root);
foreach ($mods as $key => $folder) {
    if (is_link($path_mod_root . $folder)) {
        unlink($path_mod_root . $folder);
    }
}
$path_mod_vendor = getenv('ELGG_PATH') . 'vendor/elgg/elgg/mod/';