Extensions - Define the upgrader interface
authorTim Otten <totten@civicrm.org>
Sat, 17 Apr 2021 11:28:04 +0000 (04:28 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 21 Apr 2021 06:28:25 +0000 (23:28 -0700)
CRM/Extension/Upgrader/Interface.php [new file with mode: 0644]

diff --git a/CRM/Extension/Upgrader/Interface.php b/CRM/Extension/Upgrader/Interface.php
new file mode 100644 (file)
index 0000000..c8ad824
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * An "upgrader" is a class that handles the DB install+upgrade lifecycle
+ * for an extension.
+ */
+interface CRM_Extension_Upgrader_Interface {
+
+  /**
+   * @param array $params
+   *   - string $key: Long form name ('org.example.myext')
+   */
+  public function init(array $params);
+
+  /**
+   * Notify the upgrader about a key lifecycle event, such as installation or uninstallation.
+   *
+   * Each event corresponds to a hook, such as `hook_civicrm_install` or `hook_civicrm_upgrade`.
+   *
+   * @param string $event
+   *   One of the following: 'install', 'onPostInstall', 'enable', 'disable', 'uninstall', 'upgrade'
+   * @param array $params
+   *   Any data that would ordinarily be provided via the equivalent hook.
+   *
+   * @return mixed
+   */
+  public function notify(string $event, array $params = []);
+
+}