Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
/lib/db/ -> install.php (source)

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

This file is executed right after the install.xml For more information, take a look to the documentation available: - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}

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

Defines 1 function


Functions that are not part of a class:

xmldb_main_install()   X-Ref
Main post-install tasks to be executed after the BD schema is available

This function is automatically executed after Moodle core DB has been
created at initial install. It's in charge of perform the initial tasks
not covered by the {@link install.xml} file, like create initial users,
roles, templates, moving stuff from other plugins...

Note that the function is only invoked once, at install time, so if new tasks
are needed in the future, they will need to be added both here (for new sites)
and in the corresponding {@link upgrade.php} file (for existing sites).

All plugins within Moodle (modules, blocks, reports...) support the existence of
their own install.php file, using the "Frankenstyle" component name as
defined at {@link http://docs.moodle.org/dev/Frankenstyle}, for example:
- {@link xmldb_page_install()}. (modules don't require the plugintype ("mod_") to be used.
- {@link xmldb_enrol_meta_install()}.
- {@link xmldb_workshopform_accumulative_install()}.
- ....

Finally, note that it's also supported to have one uninstall.php file that is
executed also once, each time one plugin is uninstalled (before the DB schema is
deleted). Those uninstall files will contain one function, using the "Frankenstyle"
naming conventions, like {@link xmldb_enrol_meta_uninstall()} or {@link xmldb_workshop_uninstall()}.