From 044175df042032c1298928c59b0cd0246f78f663 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 4 Aug 2023 11:39:52 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1492 --- .../modules/Process/ProcessModule/ProcessModule.module | 10 +++++----- .../Process/ProcessModule/ProcessModuleInstall.php | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/wire/modules/Process/ProcessModule/ProcessModule.module b/wire/modules/Process/ProcessModule/ProcessModule.module index 8034f838..333c1f1e 100644 --- a/wire/modules/Process/ProcessModule/ProcessModule.module +++ b/wire/modules/Process/ProcessModule/ProcessModule.module @@ -11,7 +11,7 @@ * This version also lifts several pieces of code from Soma's Modules Manager * specific to the parts involved with downloading modules from the directory. * - * ProcessWire 3.x, Copyright 2022 by Ryan Cramer + * ProcessWire 3.x, Copyright 2023 by Ryan Cramer * https://processwire.com * * @todo add support for module configuration inputfields with useLanguages option @@ -1294,7 +1294,7 @@ class ProcessModule extends Process { $destinationDir = $this->wire()->config->paths->siteModules . $className . '/'; - $completedDir = $this->installer()->downloadModule($url, $destinationDir); + $completedDir = $this->installer()->downloadModuleFromDirectory($url, $destinationDir); if($completedDir) { return $this->buildDownloadSuccessForm($className)->render(); } else { @@ -1510,7 +1510,7 @@ class ProcessModule extends Process { if(!$user->isSuperuser()) throw new WirePermissionException('Superuser required'); if(!$config->advanced) throw new WireException('This feature requires config.advanced=true;'); - $moduleData = $modules->getModuleConfigData($moduleName); + $moduleData = $modules->getConfig($moduleName); $sinfo = self::getModuleInfo(); $this->headline(sprintf($this->_('%s raw config data'), $moduleName)); @@ -1771,7 +1771,7 @@ class ProcessModule extends Process { if($languages && $fields) { // multi-language support for Inputfield with useLanguages==true // we populate the language values from module config data so module doesn't have to do this - $data = $modules->getModuleConfigData($moduleName); + $data = $modules->getConfig($moduleName); foreach($fields->getAll() as $field) { if(!$field->getSetting('useLanguages')) continue; foreach($languages as $language) { @@ -1789,7 +1789,7 @@ class ProcessModule extends Process { // check for submitted form if($submitSave) { - if(is_null($data)) $data = $modules->getModuleConfigData($moduleName); + if(is_null($data)) $data = $modules->getConfig($moduleName); $form->processInput($input->post); $updatedNames = array(); diff --git a/wire/modules/Process/ProcessModule/ProcessModuleInstall.php b/wire/modules/Process/ProcessModule/ProcessModuleInstall.php index 58d9096f..b5b603ba 100644 --- a/wire/modules/Process/ProcessModule/ProcessModuleInstall.php +++ b/wire/modules/Process/ProcessModule/ProcessModuleInstall.php @@ -167,7 +167,7 @@ class ProcessModuleInstall extends Wire { if(!$modulePath) $modulePath = $this->wire()->config->paths->siteModules; $tempDir = $this->getTempDir(); - foreach($files as $key => $f) { + foreach($files as $f) { // determine which file should be responsible for the name if(strpos($f, '/') !== false) { $dir = dirname($f); @@ -454,7 +454,7 @@ class ProcessModuleInstall extends Wire { if(count($files)) { $file = $tempDir . reset($files); $destinationDir = $this->unzipModule($file, $destinationDir); - if($destinationDir) $this->modules->resetCache(); + if($destinationDir) $this->modules->refresh(); } else { $this->error($this->_('No uploads found')); @@ -502,7 +502,7 @@ class ProcessModuleInstall extends Wire { $destinationDir = $this->unzipModule($file, $destinationDir); if($destinationDir) { $success = true; - $this->modules->resetCache(); + $this->modules->refresh(); } } catch(\Exception $e) { @@ -576,4 +576,3 @@ class ProcessModuleInstall extends Wire { } } -