diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/.DS_Store differ diff --git a/mixin/mgd-php@1.0.0.mixin.php b/mixin/mgd-php@1.0.0.mixin.php deleted file mode 100644 index 39d45b14abcfbd711b4594c72293dca7b49069e5..0000000000000000000000000000000000000000 --- a/mixin/mgd-php@1.0.0.mixin.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/** - * Auto-register "**.mgd.php" files. - * - * @mixinName mgd-php - * @mixinVersion 1.0.0 - * - * @param CRM_Extension_MixInfo $mixInfo - * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like. - * @param \CRM_Extension_BootCache $bootCache - * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like. - */ -return function ($mixInfo, $bootCache) { - - /** - * @param \Civi\Core\Event\GenericHookEvent $e - * @see CRM_Utils_Hook::managed() - */ - Civi::dispatcher()->addListener('hook_civicrm_managed', function ($event) use ($mixInfo) { - // When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically. - if (!$mixInfo->isActive()) { - return; - } - - $mgdFiles = CRM_Utils_File::findFiles($mixInfo->getPath(), '*.mgd.php'); - sort($mgdFiles); - foreach ($mgdFiles as $file) { - $es = include $file; - foreach ($es as $e) { - if (empty($e['module'])) { - $e['module'] = $mixInfo->longName; - } - if (empty($e['params']['version'])) { - $e['params']['version'] = '3'; - } - $event->entities[] = $e; - } - } - }); - -}; diff --git a/mixin/polyfill.php b/mixin/polyfill.php deleted file mode 100644 index 17ba1df3bec461c87f0fa7d75e21700a7ec43dee..0000000000000000000000000000000000000000 --- a/mixin/polyfill.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -/** - * When deploying on systems that lack mixin support, fake it. - * - * @mixinFile polyfill.php - * - * This polyfill does some (persnickity) deduplication, but it doesn't allow upgrades or shipping replacements in core. - * - * Note: The polyfill.php is designed to be copied into extensions for interoperability. Consequently, this file is - * not used 'live' by `civicrm-core`. However, the file does need a canonical home, and it's convenient to keep it - * adjacent to the actual mixin files. - * - * @param string $longName - * @param string $shortName - * @param string $basePath - */ -return function ($longName, $shortName, $basePath) { - // Construct imitations of the mixin services. These cannot work as well (e.g. with respect to - // number of file-reads, deduping, upgrading)... but they should be OK for a few months while - // the mixin services become available. - - // List of active mixins; deduped by version - $mixinVers = []; - foreach ((array) glob($basePath . '/mixin/*.mixin.php') as $f) { - [$name, $ver] = explode('@', substr(basename($f), 0, -10)); - if (!isset($mixinVers[$name]) || version_compare($ver, $mixinVers[$name], '>')) { - $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, 1) . ';'); - 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/mixin/smarty-v2@1.0.1.mixin.php b/mixin/smarty-v2@1.0.1.mixin.php deleted file mode 100644 index 5972dbdc57ffd6badbb1eb84f628700ea9727b09..0000000000000000000000000000000000000000 --- a/mixin/smarty-v2@1.0.1.mixin.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/** - * Auto-register "templates/" folder. - * - * @mixinName smarty-v2 - * @mixinVersion 1.0.1 - * @since 5.59 - * - * @param CRM_Extension_MixInfo $mixInfo - * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like. - * @param \CRM_Extension_BootCache $bootCache - * On newer deployments, this will be an instance of MixInfo. On older deployments, Civix may polyfill with a work-a-like. - */ -return function ($mixInfo, $bootCache) { - $dir = $mixInfo->getPath('templates'); - if (!file_exists($dir)) { - return; - } - - $register = function() use ($dir) { - // This implementation has a theoretical edge-case bug on older versions of CiviCRM where a template could - // be registered more than once. - CRM_Core_Smarty::singleton()->addTemplateDir($dir); - }; - - // Let's figure out what environment we're in -- so that we know the best way to call $register(). - - if (!empty($GLOBALS['_CIVIX_MIXIN_POLYFILL'])) { - // Polyfill Loader (v<=5.45): We're already in the middle of firing `hook_config`. - if ($mixInfo->isActive()) { - $register(); - } - return; - } - - if (CRM_Extension_System::singleton()->getManager()->extensionIsBeingInstalledOrEnabled($mixInfo->longName)) { - // New Install, Standard Loader: The extension has just been enabled, and we're now setting it up. - // System has already booted. New templates may be needed for upcoming installation steps. - $register(); - return; - } - - // Typical Pageview, Standard Loader: Defer the actual registration for a moment -- to ensure that Smarty is online. - \Civi::dispatcher()->addListener('hook_civicrm_config', function() use ($mixInfo, $register) { - if ($mixInfo->isActive()) { - $register(); - } - }); - -}; diff --git a/wpcivi_upgrader.sh b/wpcivi_upgrader.sh new file mode 100755 index 0000000000000000000000000000000000000000..efe867426a0bf97d2f3a88cbb2b2deb7b103245e --- /dev/null +++ b/wpcivi_upgrader.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# call REST API from internalwp.jmaconsulting.biz and return a list of extensions +# foreach get each extension key +# run civix upgrade +# run git push and create a new MR + +# ======================= MAIN ================================== +echo "=========welcome to wpcivi-upgrader.=========" +# get all extension information from internalwp.jmaconsulting.biz through curl with user name and password +# extensionInfo=$(curl -X GET --header "Content-Type: application/json" "https://internalwp.jmaconsulting.biz/civicrm/ajax/api4/JmaExtensions/get?_authx=Basic+bWFyeTpKbWFpbnRlcm5hbDIwMjMh") + +# # ===================== GIT SCRIPT ==================== +# echo "=========Started upgrading process========" + +# if ! [ -z "$extensionInfo" ] +# then + # define parameters + #get current date + currentDate=$(date '+%Y-%m-%d') + #feature branch name + featureBranchName="civix-upgrade-${currentDate}" + # #output extension data into a json file + # echo "${extensionInfo}" > ../all_extensions.json + #read each json line + jq -r '.values[] | "\(.main_branch),\(.extension_key),\(.name),\(.link_to_repo)"' "../all_extensions.json" | + while IFS= read -r each_extension; do + # main branch name + mainBranchName=$(echo "$each_extension" | cut -d ',' -f1) + #extension key + extensionKey=$(echo "$each_extension" | cut -d ',' -f2) + #extension name + extensionName=$(echo "$each_extension" | cut -d ',' -f3) + #link to repo + linkToRepo=$(echo "$each_extension" | cut -d ',' -f4) + #commit comments + requestCommit="upgrade civix ${extensionName} ${currentDate}" + #if extension exists then cd extension directory else git clone + if [ ! -D "$extensionKey" ] + then + git clone $linkToRepo + fi + cd $extensionKey + git pull + git checkout -b $featureBranchName origin/$mainBranchName + civix upgrade + git add . + git commit -m "${requestCommit}" + git push -u origin $featureBranchName -o merge_request.create -o merge_request.target=$mainBranchName -o merge_request.merge_when_pipeline_succeeds -o merge_request.remove_source_branch -o merge_request.title="${requestCommit}" + echo "done" + done + echo "done" +# else +# echo "No extension in the internalwp.jmaconsulting.biz" +# fi + +echo "=========Finished upgrading process=========" +exit \ No newline at end of file