3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
14 use Civi\Core\Event\SystemInstallEvent
;
17 * Class InstallationCanary
20 class InstallationCanary
{
23 * Check whether the install has run before.
25 * Circa v4.7.betaX, we introduced a new mechanism for tracking installation
26 * and firing a post-install event. However, it's fairly difficult to test the
27 * edge-cases directly, so this canary should fire if there are any problems
28 * in the design/implementation of the installation-tracker.
30 * This should not exist. It should be removed in a future version.
32 * @param \Civi\Core\Event\SystemInstallEvent $event
33 * @throws \CRM_Core_Exception
35 public static function check(SystemInstallEvent
$event) {
36 if (\CRM_Core_DAO
::checkTableExists('civicrm_install_canary')) {
37 throw new \
CRM_Core_Exception("Found installation canary. This suggests that something went wrong with tracking installation process. Please post to forum or JIRA.");
39 \Civi
::log()->info('Creating canary table');
40 \CRM_Core_DAO
::executeQuery('CREATE TABLE civicrm_install_canary (id int(10) unsigned NOT NULL) ENGINE=InnoDB');