getExtensionDir() . '/sql/*_install.sql'); if (is_array($files)) { foreach ($files as $file) { CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file); } } $files = glob($this->getExtensionDir() . '/sql/*_install.mysql.tpl'); if (is_array($files)) { foreach ($files as $file) { $this->executeSqlTemplate($file); } } $files = glob($this->getExtensionDir() . '/xml/*_install.xml'); if (is_array($files)) { foreach ($files as $file) { $this->executeCustomDataFileByAbsPath($file); } } if (is_callable([$this, 'install'])) { $this->install(); } } /** * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall */ public function onPostInstall() { $revisions = $this->getRevisions(); if (!empty($revisions)) { $this->setCurrentRevision(max($revisions)); } if (is_callable([$this, 'postInstall'])) { $this->postInstall(); } } /** * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_unnstall */ public function onUninstall() { $files = glob($this->getExtensionDir() . '/sql/*_uninstall.mysql.tpl'); if (is_array($files)) { foreach ($files as $file) { $this->executeSqlTemplate($file); } } if (is_callable([$this, 'uninstall'])) { $this->uninstall(); } $files = glob($this->getExtensionDir() . '/sql/*_uninstall.sql'); if (is_array($files)) { foreach ($files as $file) { CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file); } } } /** * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable */ public function onEnable() { // stub for possible future use if (is_callable([$this, 'enable'])) { $this->enable(); } } /** * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable */ public function onDisable() { // stub for possible future use if (is_callable([$this, 'disable'])) { $this->disable(); } } /** * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade */ public function onUpgrade($op, CRM_Queue_Queue $queue = NULL) { switch ($op) { case 'check': return [$this->hasPendingRevisions()]; case 'enqueue': $this->setQueue($queue); return $this->enqueuePendingRevisions(); default: } } }