Merge pull request #19594 from eileenmcnaughton/535m
[civicrm-core.git] / setup / plugins / checkInstalled / CheckInstalledFiles.civi-setup.php
1 <?php
2 /**
3 * @file
4 *
5 * Determine whether Civi has been installed.
6 */
7
8 if (!defined('CIVI_SETUP')) {
9 exit("Installation plugins must only be loaded by the installer.\n");
10 }
11
12 \Civi\Setup::dispatcher()
13 ->addListener('civi.setup.checkInstalled', function (\Civi\Setup\Event\CheckInstalledEvent $e) {
14 \Civi\Setup::log()->info(sprintf('[%s] Handle %s', basename(__FILE__), 'checkInstalled'));
15
16 $model = $e->getModel();
17
18 if ($model->settingsPath) {
19 $e->setSettingInstalled(file_exists($model->settingsPath));
20 }
21 else {
22 throw new \Exception("The \"settingsPath\" is unspecified. Cannot determine whether the settings file exists.");
23 }
24 });