Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
/lib/ -> installlib.php (source)

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

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: 543 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()}

return: bool
param: string $ini_get_arg

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.

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

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

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

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

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

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.

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

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.

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

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

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

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

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