civicrm / civicrm-setup
CiviCRM installation library
Installs: 51 810
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 15
Forks: 5
Open Issues: 7
Requires
- psr/log: ~1.0
- symfony/event-dispatcher: ^2.6.13 || ~3.0
README
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:
- Installers call a high-level API (Civi\Setup) which supports all major installation tasks/activities -- such as:
- Check system requirements (
$setup->checkRequirements()
) - Check installation status (
$setup->checkInstalled()
) - Install data files (
$setup->installFiles()
) - Install database (
$setup->installDatabase()
)
- Check system requirements (
- A data-model (Civi\Setup\Model) lists all the standard configuration parameters. This data-model is available when executing each task. For example, it includes:
- The path to CiviCRM's code (
$model->srcPath
) - The system language (
$model->lang
) - The DB credentials (
$model->db
)
- The path to CiviCRM's code (
- Each major task corresponds to an event -- such as:
civi.setup.checkRequirements
civi.setup.checkInstalled
civi.setup.installFiles
civi.setup.installDatabase
- Plugins (
plugins/*/*.civi-setup.php
) work with the model and the events. For example:- The plugin
init/WordPress.civi-setup.php
runs during initialization (civi.setup.init
). It reads the WordPress config (e.g.get_locale()
andDB_HOST
) then updates the model ($model->lang
and$model->db
). - The plugin
installDatabase/SetLanguage.civi-setup.php
runs when installing the database (civi.setup.installDatabase
). It reads the$model->lang
and updates various Civi settings.
- The plugin
Key features:
- The library can be used by other projects -- such as
cv
,civicrm-drupal
,civicrm-wordpress
-- to provide an installation process. - It is a leap. It can coexist with the old installer, and it lives in a separate project/repo which can be deployed optionally.
- Example: The
civicrm-wordpress
integration is phasing-in support for the new installer. By default, it uses the old installer. If you create a filecivicrm/.use-civicrm-setup
, then it will use the new installer.
- Example: The
- It has minimal external dependencies. (The codebase for CiviCRM and its dependencies must be available -- but nothing else is needed.)