JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[5.2] Error handling on extension update #606

Open joomlapl-bot opened 3 weeks ago

joomlapl-bot commented 3 weeks ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/43321 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/components/com_installer/src/Model/UpdateModel.php b/administrator/components/com_installer/src/Model/UpdateModel.php index 92c472a1e2ac5..2cd000b8ca4a0 100644 --- a/administrator/components/com_installer/src/Model/UpdateModel.php +++ b/administrator/components/com_installer/src/Model/UpdateModel.php @@ -24,6 +24,7 @@ use Joomla\Database\Exception\ExecutionFailureException; use Joomla\Database\ParameterType; use Joomla\Database\QueryInterface; +use Joomla\Filesystem\Path; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects @@ -358,10 +359,24 @@ public function update($uids, $minimumStability = Updater::STABILITY_STABLE) $update->set('extra_query', $updateSiteInstance->extra_query); } - $this->preparePreUpdate($update, $instance); - - // Install sets state and enqueues messages - $res = $this->install($update); + try { + $this->preparePreUpdate($update, $instance); + + // Install sets state and enqueues messages + $res = $this->install($update); + } catch (\Throwable $t) { + $res = false; + + Factory::getApplication()->enqueueMessage( + Text::sprintf( + 'COM_INSTALLER_UPDATE_ERROR', + $instance->name, + $t->getMessage(), + (JDEBUG ? str_replace(JPATH_ROOT, 'JROOT', Path::clean($t->getFile())) . ':' . $t->getLine() : '') + ), + 'error' + ); + } if ($res) { $instance->delete($uid); diff --git a/administrator/language/en-GB/com_installer.ini b/administrator/language/en-GB/com_installer.ini index 48f7bf5477eb2..f93f2d1d4e51f 100644 --- a/administrator/language/en-GB/com_installer.ini +++ b/administrator/language/en-GB/com_installer.ini @@ -258,6 +258,7 @@ COM_INSTALLER_UNINSTALL_ERROR="Error uninstalling %s." COM_INSTALLER_UNINSTALL_ERROR_LOCKED_EXTENSION="The extension \"%1$s\" (ID %2$s) is locked and cannot be uninstalled." COM_INSTALLER_UNINSTALL_SUCCESS="Uninstalling the %s was successful." COM_INSTALLER_UNPACK_ERROR="Failed to extract file: %s" +COM_INSTALLER_UPDATE_ERROR="Error updating: %1$s
%2$s
%3$s
" COM_INSTALLER_UPDATE_FILTER_SEARCH_DESC="Search in extension name. Prefix with ID:, UID: or EID: to search for an update ID, update site ID or extension ID." COM_INSTALLER_UPDATE_FILTER_SEARCH_LABEL="Search Extensions with Updates" COM_INSTALLER_UPDATE_FORM_EDIT="Edit Update Site" ```