diff --git a/wire/modules/Process/ProcessModule/ProcessModule.module b/wire/modules/Process/ProcessModule/ProcessModule.module
index b25e652b..91769c57 100644
--- a/wire/modules/Process/ProcessModule/ProcessModule.module
+++ b/wire/modules/Process/ProcessModule/ProcessModule.module
@@ -319,18 +319,6 @@ class ProcessModule extends Process {
}
}
- if($input->post('remove')) {
- $session->CSRF->validate();
- $removeName = $input->post('remove');
- foreach($modules->findMissingModules() as $missingInfo) {
- if($removeName !== $missingInfo['name']) continue;
- $modules->removeModuleEntry($missingInfo['name']);
- $this->message($this->_('Removed module from database') . ' - ' . $missingInfo['name']);
- break;
- }
- $session->redirect('./');
- }
-
if($input->post('download') && $input->post('download_name')) {
$session->CSRF->validate();
return $this->downloadConfirm($input->post('download_name'));
@@ -551,7 +539,10 @@ class ProcessModule extends Process {
$rootPath = $this->wire()->config->paths->root;
foreach($missing as $name => $item) {
$missingArray[$name] = $modules->isInstalled($name);
- $missingFiles[$name] = $this->_('Missing file:') . ' ' . str_replace($rootPath, '/', $item['file']);
+ $missingFiles[$name] = sprintf(
+ $this->_('Missing module file(s) in: %s'),
+ dirname(str_replace($rootPath, '/', $item['file'])) . '/'
+ );
}
$tab = $this->wire(new InputfieldWrapper());
$tab->attr('id', 'tab_missing_modules');
@@ -561,12 +552,11 @@ class ProcessModule extends Process {
$markup = $modules->get('InputfieldMarkup');
$markup->value = $this->renderListTable($missingArray, array(
- 'allowRemove' => true,
'allowInstall' => false,
'allowType' => true,
'summaries' => $missingFiles,
));
- $markup->label = $this->_('Modules in database that are not found on the file system');
+ $markup->label = $this->_('Modules in database that are not found on the file system. Click any module name below for options to fix.');
$markup->icon = 'warning';
$tab->add($markup);
$form->add($tab);
@@ -780,7 +770,6 @@ class ProcessModule extends Process {
* `allowClasses` (bool) Whether to show module class names (default=false)
* `allowType` (bool): Whether to show if module is site or core (default=false)
* `allowInstall` (bool): Whether or not install is allowed (default=true)
- * `allowRemove` (bool): Allow remove from database? (default=false) for missing entries
* `summaries` (array): Replacement summary info indexed by module name (default=[])
* @return string
*
@@ -794,7 +783,6 @@ class ProcessModule extends Process {
'allowClasses' => false,
'allowType' => false,
'allowInstall' => true,
- 'allowRemove' => false,
'summaries' => array(),
);
@@ -850,7 +838,7 @@ class ProcessModule extends Process {
$class = $configurable ? 'ConfigurableModule' : '';
if(!empty($info['permanent'])) $class .= ($class ? ' ' : '') . 'PermanentModule';
if($class) $title = "$title";
- $version = $this->formatVersion(isset($info['version']) ? $info['version'] : 0);
+ $version = empty($info['version']) ? '?' : $this->formatVersion($info['version']);
if($options['allowType']) $version .= "
" . ($info['core'] ? $this->labels['core'] : $this->labels['site']) . "";
if(!empty($options['summaries'][$name])) $info['summary'] = $options['summaries'][$name];
$summary = empty($info['summary']) ? '' : $sanitizer->entities1($info['summary']);
@@ -939,16 +927,6 @@ class ProcessModule extends Process {
" "; // Text for 'Settings' button
}
}
-
- if($options['allowRemove']) $buttons .=
- "";
if($buttons) $buttons = "$buttons";
@@ -1392,28 +1370,40 @@ class ProcessModule extends Process {
*/
protected function renderEdit($moduleName, $moduleInfo) {
+ $wire = $this->wire();
+ $adminTheme = $wire->adminTheme;
+ $languages = $wire->languages;
+ $sanitizer = $wire->sanitizer;
+ $modules = $wire->modules;
+ $session = $wire->session;
+ $config = $wire->config;
+ $input = $wire->input;
+
$out = '';
- $moduleId = $this->modules->getModuleID($moduleName);
- $languages = $this->wire('languages');
- $submitSave = $this->input->post('submit_save_module');
+ $moduleId = $modules->getModuleID($moduleName);
+ $submitSave = $input->post('submit_save_module');
$collapseInfo = '';
- if($submitSave || $this->wire('input')->get('collapse_info') || $this->wire('input')->get('modal')) {
+
+ if($submitSave || $input->get('collapse_info') || $input->get('modal')) {
$collapseInfo = '&collapse_info=1';
}
+
if(!$moduleId) {
$this->error("Unknown module");
- $this->session->redirect('./');
+ $session->redirect('./');
return '';
}
- if($this->wire('input')->get('refresh') == $moduleName) {
- $this->wire('modules')->resetCache();
- $this->session->redirect("./edit?name=$moduleName$collapseInfo");
+
+ if($input->get('refresh') == $moduleName) {
+ $modules->resetCache();
+ $session->redirect("./edit?name=$moduleName$collapseInfo");
return '';
}
+
$sinfo = self::getModuleInfo();
- $flags = $this->modules->getFlags($moduleName);
+ $flags = $modules->getFlags($moduleName);
$allowDisabledFlag =
- ($this->wire('config')->debug && $this->wire('config')->advanced && ($flags & Modules::flagsAutoload)) ||
+ ($config->debug && $config->advanced && ($flags & Modules::flagsAutoload)) ||
($flags & Modules::flagsDisabled);
$this->breadcrumb('./', $sinfo['title']);
@@ -1421,16 +1411,20 @@ class ProcessModule extends Process {
$this->browserTitle(sprintf($this->_('Module: %s'), $moduleInfo['title']));
/** @var InputfieldForm $form */
- $form = $this->modules->get("InputfieldForm");
+ $form = $modules->get("InputfieldForm");
$form->attr('id', 'ModuleEditForm');
$form->attr('action', "edit?name=$moduleName$collapseInfo");
$form->attr('method', 'post');
- $dependents = $this->modules->getRequiredBy($moduleName, true);
- $requirements = $this->modules->getRequires($moduleName, false, true);
+ $dependents = $modules->getRequiredBy($moduleName, true);
+ $requirements = $modules->getRequires($moduleName, false, true);
$dependentsStr = '';
$requirementsStr = '';
- foreach($dependents as $name) $dependentsStr .= ($dependentsStr ? ', ' : '') . "$name";
+
+ foreach($dependents as $name) {
+ $dependentsStr .= ($dependentsStr ? ', ' : '') . "$name";
+ }
+
foreach($requirements as $name) {
if(preg_match('/^([^<>!=]+)([<>!=]+.*)$/', $name, $matches)) {
$name = $matches[1];
@@ -1444,10 +1438,11 @@ class ProcessModule extends Process {
}
// identify duplicates
- $duplicates = $this->modules->duplicates()->getDuplicates($moduleName);
+ $duplicates = $modules->duplicates()->getDuplicates($moduleName);
+
if(count($duplicates['files'])) {
/** @var InputfieldRadios $field */
- $field = $this->modules->get('InputfieldRadios');
+ $field = $modules->get('InputfieldRadios');
$field->attr('name', '_use_duplicate');
$field->label = $this->_('Module file to use');
$field->icon = 'files-o';
@@ -1459,45 +1454,79 @@ class ProcessModule extends Process {
$form->add($field);
}
- $fields = $this->wire('modules')->getModuleConfigInputfields($moduleName, $form);
+ $fields = $modules->getModuleConfigInputfields($moduleName, $form);
if($fields) {
foreach($fields as $field) {
$form->add($field);
}
}
+
+ $filename = $modules->getModuleFile($moduleName, array('guess' => true, 'fast' => false));
+ $filenameUrl = str_replace($config->paths->root, $config->urls->root, $filename);
+ $filenameExists = file_exists($filename);
+ $filenameNote = '';
- // uninstall checkbox
- $field = $this->modules->get("InputfieldCheckbox");
- $field->attr('id+name', 'uninstall');
- $field->attr('value', $moduleName);
- $field->collapsed = Inputfield::collapsedYes;
- $field->icon = 'times-circle';
- $field->label = $this->_x("Uninstall", 'checkbox');
+ if($filenameExists) {
+ // Uninstall checkbox
+ /** @var InputfieldCheckbox $field Uninstall checkbox */
+ $field = $modules->get("InputfieldCheckbox");
+ $field->attr('id+name', 'uninstall');
+ $field->attr('value', $moduleName);
+ $field->collapsed = Inputfield::collapsedYes;
+ $field->icon = 'times-circle';
+ $field->label = $this->_x("Uninstall", 'checkbox');
- $reason = $this->modules->isUninstallable($moduleName, true);
- $uninstallable = $reason === true;
+ $reason = $modules->isUninstallable($moduleName, true);
+ $uninstallable = $reason === true;
- if($uninstallable) {
- $field->description = $this->_("Uninstall this module? After uninstalling, you may remove the modules files from the server if it is not in use by any other modules."); // Uninstall field description
- if(count($moduleInfo['installs'])) {
- $uninstalls = $this->wire('modules')->getUninstalls($moduleName);
- if(count($uninstalls)) $field->notes = $this->_("This will also uninstall other modules") . " - " . implode(', ', $uninstalls); // Text that precedes a list of modules that are also uninstalled
+ if($uninstallable) {
+ $field->description = $this->_("Uninstall this module? After uninstalling, you may remove the modules files from the server if it is not in use by any other modules."); // Uninstall field description
+ if(count($moduleInfo['installs'])) {
+ $uninstalls = $modules->getUninstalls($moduleName);
+ if(count($uninstalls)) {
+ $field->notes = $this->_("This will also uninstall other modules") . " - " . implode(', ', $uninstalls); // Text that precedes a list of modules that are also uninstalled
+ }
+ }
+
+ } else {
+ $field->attr('disabled', 'disabled');
+ $field->label .= " " . $this->_("(Disabled)");
+ $field->description = $this->_("Can't uninstall module") . " - " . $reason; // Text that precedes a reason why the module can't be uninstalled
+ $dependents2 = $modules->getRequiresForUninstall($moduleName);
+ if(count($dependents2)) {
+ $field->notes = $this->_("You must first uninstall other modules") . " - " . implode(', ', $dependents2); // Text that precedes a list of modules that must be uninstalled first
+ }
}
- } else {
- $field->attr('disabled', 'disabled');
- $field->label .= " " . $this->_("(Disabled)");
- $field->description = $this->_("Can't uninstall module") . " - " . $reason; // Text that precedes a reason why the module can't be uninstalled
- $dependents2 = $this->modules->getRequiresForUninstall($moduleName);
- if(count($dependents2)) $field->notes = $this->_("You must first uninstall other modules") . " - " . implode(', ', $dependents2); // Text that precedes a list of modules that must be uninstalled first
- }
+ $form->add($field);
- $form->append($field);
+ } else {
+ // Delete from datasbase checkbox
+ $uninstallable = false;
+ $filenameUrl = dirname($filenameUrl) . '/';
+ $filenameNote =
+ "