From ce436af4df86e59c212c33414a81937ab3fe3e86 Mon Sep 17 00:00:00 2001 From: agileware-iris Date: Wed, 24 Sep 2025 18:42:22 +0000 Subject: [PATCH] CIVIBLD-287 [AUTO] civix upgraded Files changed: D mixin/polyfill.php M moretokens.civix.php --- mixin/polyfill.php | 101 ------------------------------------------- moretokens.civix.php | 13 ++---- 2 files changed, 3 insertions(+), 111 deletions(-) delete mode 100644 mixin/polyfill.php diff --git a/mixin/polyfill.php b/mixin/polyfill.php deleted file mode 100644 index be40364..0000000 --- a/mixin/polyfill.php +++ /dev/null @@ -1,101 +0,0 @@ -')) { - $mixinVers[$name] = $ver; - } - } - $mixins = []; - foreach ($mixinVers as $name => $ver) { - $mixins[] = "$name@$ver"; - } - - // Imitate CRM_Extension_MixInfo. - $mixInfo = new class() { - - /** - * @var string - */ - public $longName; - - /** - * @var string - */ - public $shortName; - - public $_basePath; - - public function getPath($file = NULL) { - return $this->_basePath . ($file === NULL ? '' : (DIRECTORY_SEPARATOR . $file)); - } - - public function isActive() { - return \CRM_Extension_System::singleton()->getMapper()->isActiveModule($this->shortName); - } - - }; - $mixInfo->longName = $longName; - $mixInfo->shortName = $shortName; - $mixInfo->_basePath = $basePath; - - // Imitate CRM_Extension_BootCache. - $bootCache = new class() { - - public function define($name, $callback) { - $envId = \CRM_Core_Config_Runtime::getId(); - $oldExtCachePath = \Civi::paths()->getPath("[civicrm.compile]/CachedExtLoader.{$envId}.php"); - $stat = stat($oldExtCachePath); - $file = Civi::paths()->getPath('[civicrm.compile]/CachedMixin.' . md5($name . ($stat['mtime'] ?? 0)) . '.php'); - if (file_exists($file)) { - return include $file; - } - else { - $data = $callback(); - file_put_contents($file, '<' . "?php\nreturn " . var_export($data, TRUE) . ';'); - return $data; - } - } - - }; - - // Imitate CRM_Extension_MixinLoader::run() - // Parse all live mixins before trying to scan any classes. - global $_CIVIX_MIXIN_POLYFILL; - foreach ($mixins as $mixin) { - // If the exact same mixin is defined by multiple exts, just use the first one. - if (!isset($_CIVIX_MIXIN_POLYFILL[$mixin])) { - $_CIVIX_MIXIN_POLYFILL[$mixin] = include_once $basePath . '/mixin/' . $mixin . '.mixin.php'; - } - } - foreach ($mixins as $mixin) { - // If there's trickery about installs/uninstalls/resets, then we may need to register a second time. - if (!isset(\Civi::$statics[$longName][$mixin])) { - \Civi::$statics[$longName][$mixin] = 1; - $func = $_CIVIX_MIXIN_POLYFILL[$mixin]; - $func($mixInfo, $bootCache); - } - } -}; diff --git a/moretokens.civix.php b/moretokens.civix.php index 6a97202..e0d166a 100644 --- a/moretokens.civix.php +++ b/moretokens.civix.php @@ -79,13 +79,6 @@ public static function findClass($suffix) { use CRM_Moretokens_ExtensionUtil as E; -function _moretokens_civix_mixin_polyfill() { - if (!class_exists('CRM_Extension_MixInfo')) { - $polyfill = __DIR__ . '/mixin/polyfill.php'; - (require $polyfill)(E::LONG_NAME, E::SHORT_NAME, E::path()); - } -} - /** * (Delegated) Implements hook_civicrm_config(). * @@ -101,7 +94,7 @@ function _moretokens_civix_civicrm_config($config = NULL) { $extRoot = __DIR__ . DIRECTORY_SEPARATOR; $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); set_include_path($include_path); - _moretokens_civix_mixin_polyfill(); + // Based on , this does not currently require mixin/polyfill.php. } /** @@ -111,7 +104,7 @@ function _moretokens_civix_civicrm_config($config = NULL) { */ function _moretokens_civix_civicrm_install() { _moretokens_civix_civicrm_config(); - _moretokens_civix_mixin_polyfill(); + // Based on , this does not currently require mixin/polyfill.php. } /** @@ -121,7 +114,7 @@ function _moretokens_civix_civicrm_install() { */ function _moretokens_civix_civicrm_enable(): void { _moretokens_civix_civicrm_config(); - _moretokens_civix_mixin_polyfill(); + // Based on , this does not currently require mixin/polyfill.php. } /**