Run civix upgrade on oauth
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 16 Jan 2023 21:08:28 +0000 (10:08 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 16 Jan 2023 21:08:28 +0000 (10:08 +1300)
ext/oauth-client/CRM/OAuth/Upgrader.php
ext/oauth-client/CRM/OAuth/Upgrader/Base.php [deleted file]
ext/oauth-client/info.xml
ext/oauth-client/oauth_client.civix.php

index df5fdd0eb55e8ff50d5bff8ac83910cf61e89d55..d196fd8ee6753859276abace9a34e442790a0e69 100644 (file)
@@ -4,7 +4,7 @@ use CRM_OAuth_ExtensionUtil as E;
 /**
  * Collection of upgrade steps.
  */
-class CRM_OAuth_Upgrader extends CRM_OAuth_Upgrader_Base {
+class CRM_OAuth_Upgrader extends CRM_Extension_Upgrader_Base {
 
   /**
    * @see CRM_Utils_Hook::install()
diff --git a/ext/oauth-client/CRM/OAuth/Upgrader/Base.php b/ext/oauth-client/CRM/OAuth/Upgrader/Base.php
deleted file mode 100644 (file)
index ae97dcb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-/**
- * Base class which provides helpers to execute upgrade logic
- */
-class CRM_OAuth_Upgrader_Base extends CRM_Extension_Upgrader_Base {
-}
index 895e05286e8cb5913e09d9653a057abc2fcbb9bb..03f1afa8ed5b3af6c44a8fc4b009d8193593a24e 100644 (file)
@@ -36,6 +36,6 @@
   </mixins>
   <civix>
     <namespace>CRM/OAuth</namespace>
-    <format>22.10.0</format>
+    <format>22.12.1</format>
   </civix>
 </extension>
index 3d9ae5d3f523f062ef5fa5a3b608c0eca9dfb785..91cdf5cfa0fd33d4cdc0d31402d157161e767077 100644 (file)
@@ -24,7 +24,7 @@ class CRM_OAuth_ExtensionUtil {
    *   Translated text.
    * @see ts
    */
-  public static function ts($text, $params = []) {
+  public static function ts($text, $params = []): string {
     if (!array_key_exists('domain', $params)) {
       $params['domain'] = [self::LONG_NAME, NULL];
     }
@@ -41,7 +41,7 @@ class CRM_OAuth_ExtensionUtil {
    *   Ex: 'http://example.org/sites/default/ext/org.example.foo'.
    *   Ex: 'http://example.org/sites/default/ext/org.example.foo/css/foo.css'.
    */
-  public static function url($file = NULL) {
+  public static function url($file = NULL): string {
     if ($file === NULL) {
       return rtrim(CRM_Core_Resources::singleton()->getUrl(self::LONG_NAME), '/');
     }
@@ -84,27 +84,20 @@ use CRM_OAuth_ExtensionUtil as E;
  *
  * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config
  */
-function _oauth_client_civix_civicrm_config(&$config = NULL) {
+function _oauth_client_civix_civicrm_config($config = NULL) {
   static $configured = FALSE;
   if ($configured) {
     return;
   }
   $configured = TRUE;
 
-  $template = CRM_Core_Smarty::singleton();
-
   $extRoot = __DIR__ . DIRECTORY_SEPARATOR;
   $extDir = $extRoot . 'templates';
-
-  if (is_array($template->template_dir)) {
-    array_unshift($template->template_dir, $extDir);
-  }
-  else {
-    $template->template_dir = [$extDir, $template->template_dir];
-  }
+  CRM_Core_Smarty::singleton()->addTemplateDir($extDir);
 
   $include_path = $extRoot . PATH_SEPARATOR . get_include_path();
   set_include_path($include_path);
+  // Based on <compatibility>, this does not currently require mixin/polyfill.php.
 }
 
 /**
@@ -114,35 +107,7 @@ function _oauth_client_civix_civicrm_config(&$config = NULL) {
  */
 function _oauth_client_civix_civicrm_install() {
   _oauth_client_civix_civicrm_config();
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    $upgrader->onInstall();
-  }
-}
-
-/**
- * Implements hook_civicrm_postInstall().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
- */
-function _oauth_client_civix_civicrm_postInstall() {
-  _oauth_client_civix_civicrm_config();
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    if (is_callable([$upgrader, 'onPostInstall'])) {
-      $upgrader->onPostInstall();
-    }
-  }
-}
-
-/**
- * Implements hook_civicrm_uninstall().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
- */
-function _oauth_client_civix_civicrm_uninstall() {
-  _oauth_client_civix_civicrm_config();
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    $upgrader->onUninstall();
-  }
+  // Based on <compatibility>, this does not currently require mixin/polyfill.php.
 }
 
 /**
@@ -150,58 +115,9 @@ function _oauth_client_civix_civicrm_uninstall() {
  *
  * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
  */
-function _oauth_client_civix_civicrm_enable() {
-  _oauth_client_civix_civicrm_config();
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    if (is_callable([$upgrader, 'onEnable'])) {
-      $upgrader->onEnable();
-    }
-  }
-}
-
-/**
- * (Delegated) Implements hook_civicrm_disable().
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
- * @return mixed
- */
-function _oauth_client_civix_civicrm_disable() {
+function _oauth_client_civix_civicrm_enable(): void {
   _oauth_client_civix_civicrm_config();
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    if (is_callable([$upgrader, 'onDisable'])) {
-      $upgrader->onDisable();
-    }
-  }
-}
-
-/**
- * (Delegated) Implements hook_civicrm_upgrade().
- *
- * @param $op string, the type of operation being performed; 'check' or 'enqueue'
- * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks
- *
- * @return mixed
- *   based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
- *   for 'enqueue', returns void
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
- */
-function _oauth_client_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
-  if ($upgrader = _oauth_client_civix_upgrader()) {
-    return $upgrader->onUpgrade($op, $queue);
-  }
-}
-
-/**
- * @return CRM_OAuth_Upgrader
- */
-function _oauth_client_civix_upgrader() {
-  if (!file_exists(__DIR__ . '/CRM/OAuth/Upgrader.php')) {
-    return NULL;
-  }
-  else {
-    return CRM_OAuth_Upgrader_Base::instance();
-  }
+  // Based on <compatibility>, this does not currently require mixin/polyfill.php.
 }
 
 /**