Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Replacement warnings #109

Merged
merged 5 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/system/classes/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,16 @@ protected function populateDisabledPluginsFromDb()
}
}

/**
* Returns the plugin replacements defined in $this->replacementMap
*
* @return array
*/
public function getReplacementMap()
{
return $this->replacementMap;
}

/**
* Evaluates and initializes the plugin replacements defined in $this->replacementMap
*
Expand Down
7 changes: 7 additions & 0 deletions modules/system/classes/UpdateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ public function update()
}
}

// Set replacement warning messages
foreach ($this->pluginManager->getReplacementMap() as $alias => $plugin) {
$this->addMessage($plugin, Lang::get('system::lang.updates.update_warnings_plugin_replace_cli', [
'alias' => '<info>' . $alias . '</info>'
]));
}

// Print messages returned by migrations / seeders
$this->printMessages();

Expand Down
9 changes: 9 additions & 0 deletions modules/system/controllers/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@ protected function getWarnings()
}
}

$replacementMap = PluginManager::instance()->getReplacementMap();

foreach ($replacementMap as $alias => $plugin) {
$warnings[] = Lang::get('system::lang.updates.update_warnings_plugin_replace', [
'plugin' => '<strong>' . $plugin . '</strong>',
'alias' => '<strong>' . $alias . '</strong>'
]);
}

return $warnings;
}

Expand Down
2 changes: 2 additions & 0 deletions modules/system/lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@
'core_set_build' => 'Setting build number',
'update_warnings_title' => 'Some issues have been detected and require attention:',
'update_warnings_plugin_missing' => 'The :parent_code plugin requires :code to be installed before it will work',
'update_warnings_plugin_replace' => 'The :plugin plugin replaces :alias, please remove :alias to ensure the are no conflicts',
mjauvin marked this conversation as resolved.
Show resolved Hide resolved
'update_warnings_plugin_replace_cli' => 'This plugin replaces :alias, please remove :alias to ensure the are no conflicts',
LukeTowers marked this conversation as resolved.
Show resolved Hide resolved
'changelog' => 'Changelog',
'changelog_view_details' => 'View details',
'plugins' => 'Plugins',
Expand Down