civicrm-setup
is a library for writing a CiviCRM installer. It aims to support multiple installers, such as the CLI command cv
(cv core:install
and cv core:uninstall
) or per-CMS web-based installers (e.g. for civicrm-drupal
or civicrm-wordpress
).
General design:
$setup->checkRequirements()
)$setup->checkInstalled()
)$setup->installFiles()
)$setup->installDatabase()
)$model->srcPath
)$model->lang
)$model->db
)civi.setup.checkRequirements
civi.setup.checkInstalled
civi.setup.installFiles
civi.setup.installDatabase
plugins/*/*.civi-setup.php
) work with the model and the events. For example:
init/WordPress.civi-setup.php
runs during initialization (civi.setup.init
). It reads the WordPress config (e.g.get_locale()
and DB_HOST
) then updates the model ($model->lang
and $model->db
).installDatabase/SetLanguage.civi-setup.php
runs when installing the database (civi.setup.installDatabase
). It reads the $model->lang
and updates various Civi settings.Key features:
cv
, civicrm-drupal
, civicrm-wordpress
-- to provide an installation process.civicrm-wordpress
integration is phasing-in support for the new installer. By default, it uses the old installer. If you create a file civicrm/.use-civicrm-setup
, then it will use the new installer.