5 * Determine whether Civi has been installed.
8 if (!defined('CIVI_SETUP')) {
9 exit("Installation plugins must only be loaded by the installer.\n");
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 $model = $e->getModel();
19 $conn = \Civi\Setup\DbUtil
::connect($model->db
);
21 catch (\Civi\Setup\Exception\SqlException
$exception) {
22 $e->setDatabaseInstalled(FALSE);
26 foreach ($conn->query('SHOW TABLES LIKE "civicrm_%"') as $result) {
30 $e->setDatabaseInstalled($found);
33 throw new \
Exception("The \"db\" is unspecified. Cannot determine whether the database schema file exists.");