Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
/lib/ -> installlib.php (source)

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

Functions to support installation process

Copyright: 2009 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 545 lines (19 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 10 functions


Functions that are not part of a class:

install_guess_wwwroot()   X-Ref
Tries to detect the right www root setting.

return: string detected www root

install_ini_get_bool($ini_get_arg)   X-Ref
Copy of @see{ini_get_bool()}

param: string $ini_get_arg
return: bool

install_init_dataroot($dataroot, $dirpermissions)   X-Ref
Creates dataroot if not exists yet,
makes sure it is writable, add lang directory
and add .htaccess just in case it works.

param: string $dataroot full path to dataroot
param: int $dirpermissions
return: bool success

install_helpbutton($url, $title='')   X-Ref
Print help button

param: string $url
param: string $titel
return: void

install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions)   X-Ref
This is in function because we want the /install.php to parse in PHP4

param: object $database
param: string $dbhsot
param: string $dbuser
param: string $dbpass
param: string $dbname
param: string $prefix
param: mixed $dboptions
return: string

install_generate_configphp($database, $cfg)   X-Ref
Returns content of config.php file.

Uses PHP_EOL for generating proper end of lines for the given platform.

param: moodle_database $database database instance
param: object $cfg copy of $CFG
return: string

install_print_help_page($help)   X-Ref
Prints complete help page used during installation.
Does not return.

param: string $help

install_print_header($config, $stagename, $heading, $stagetext, $stageclass = "alert-info")   X-Ref
Prints installation page header, we can not use weblib yet in installer.

param: stdClass $config
param: string $stagename
param: string $heading
param: string $stagetext
param: string $stageclass
return: void

install_print_footer($config, $reload=false)   X-Ref
Prints installation page header, we can not use weblib yet in installer.

param: stdClass $config
param: bool $reload print reload button instead of next
return: void

install_cli_database(array $options, $interactive)   X-Ref
Install Moodle DB,
config.php must exist, there must not be any tables in db yet.

param: array $options adminpass is mandatory
param: bool $interactive
return: void