joomlagerman / joomla

The J!German translation team provides German translation for Joomla!
https://www.jgerman.de
GNU General Public License v2.0
25 stars 46 forks source link

[5.1] upmerge 2023-12-21 #3063

Closed jgerman-bot closed 8 months ago

jgerman-bot commented 9 months ago

New language relevant PR in upstream repo: https://github.com/joomla/joomla-cms/pull/42556 Here are the upstream changes:

Click to expand the diff! ```diff diff --git a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php index 2fec11100701b..29d3ac7614940 100644 --- a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php +++ b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php @@ -119,6 +119,15 @@ class HtmlView extends BaseHtmlView */ protected $reasonNoDownload = ''; + /** + * Details on failed PHP or DB version requirements to be shown in the emptystate layout when there is no download + * + * @var \stdClass PHP and database requirements from the update manifest + * + * @since __DEPLOY_VERSION__ + */ + protected $detailsNoDownload; + /** * List of non core critical plugins * @@ -199,8 +208,9 @@ public function display($tpl = null) } else { // No download available if ($hasUpdate) { - $this->messagePrefix = '_NODOWNLOAD'; - $this->reasonNoDownload = 'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON'; + $this->messagePrefix = '_NODOWNLOAD'; + $this->reasonNoDownload = 'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON'; + $this->detailsNoDownload = $this->updateInfo['object']->get('otherUpdateInfo'); } $this->setLayout('noupdate'); diff --git a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/noupdate.php b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/noupdate.php index 6336b732f970c..5a4c9bc3d552a 100644 --- a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/noupdate.php +++ b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/noupdate.php @@ -15,11 +15,35 @@ use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Session\Session; -$uploadLink = 'index.php?option=com_joomlaupdate&view=upload'; +$uploadLink = 'index.php?option=com_joomlaupdate&view=upload'; +$reasonNoDownload = ''; + +if (!empty($this->reasonNoDownload)) { + $reasonNoDownload = Text::_($this->reasonNoDownload); + + if (isset($this->detailsNoDownload->php)) { + $reasonNoDownload .= Text::sprintf( + 'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_PHP', + $this->detailsNoDownload->php->used, + $this->detailsNoDownload->php->required + ); + } + + if (isset($this->detailsNoDownload->db)) { + $reasonNoDownload .= Text::sprintf( + 'COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_DATABASE', + Text::_('JLIB_DB_SERVER_TYPE_' . $this->detailsNoDownload->db->type), + $this->detailsNoDownload->db->used, + $this->detailsNoDownload->db->required + ); + } + + $reasonNoDownload .= Text::_('COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_ACTION'); +} $displayData = [ 'textPrefix' => 'COM_JOOMLAUPDATE' . $this->messagePrefix, - 'content' => Text::_($this->reasonNoDownload) . Text::sprintf($this->langKey, $this->updateSourceKey), + 'content' => $reasonNoDownload . Text::sprintf($this->langKey, $this->updateSourceKey), 'formURL' => 'index.php?option=com_joomlaupdate&view=joomlaupdate', 'helpURL' => 'https://docs.joomla.org/Special:MyLanguage/Updating_from_an_existing_version', 'icon' => 'icon-loop joomlaupdate', diff --git a/administrator/language/en-GB/com_joomlaupdate.ini b/administrator/language/en-GB/com_joomlaupdate.ini index cd9e5d3e37332..17fca2758a9b6 100644 --- a/administrator/language/en-GB/com_joomlaupdate.ini +++ b/administrator/language/en-GB/com_joomlaupdate.ini @@ -44,7 +44,10 @@ COM_JOOMLAUPDATE_MINIMUM_STABILITY_STABLE="Stable" COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_APPEND="Upload and Update" COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_BUTTON_ADD="Retry check for update" COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_CONTENT="An update to Joomla %1$s was found, but it wasn't possible to fetch the download URL for that update. Either the update to Joomla %1$s is not available for your stability level or there is a problem with the Joomla Update Server.
Please try to download the update package from the official Joomla download page and use the Upload and Update function." -COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON="An update to Joomla %1$s was found but your web server doesn't meet the minimum requirements. Please contact your web host to update your server.
" +COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON="An update to Joomla %1$s was found but your web server doesn't meet the minimum requirements.
" +COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_ACTION="Please contact your web host to update your server.
" +COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_DATABASE="Your %1$s version \"%2$s\" is lower than \"%3$s\".
" +COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_REASON_PHP="Your PHP version \"%1$s\" is lower than \"%2$s\".
" COM_JOOMLAUPDATE_NODOWNLOAD_EMPTYSTATE_TITLE="This site can't be updated to Joomla %1$s" COM_JOOMLAUPDATE_OVERVIEW="Joomla Update" COM_JOOMLAUPDATE_PREUPDATE_CHECK_CAPTION="Server settings to check before update." diff --git a/libraries/src/Installer/Adapter/FileAdapter.php b/libraries/src/Installer/Adapter/FileAdapter.php index 499b702814760..3f122feedc493 100644 --- a/libraries/src/Installer/Adapter/FileAdapter.php +++ b/libraries/src/Installer/Adapter/FileAdapter.php @@ -172,7 +172,11 @@ protected function finaliseInstall() */ protected function finaliseUninstall(): bool { - File::delete(JPATH_MANIFESTS . '/files/' . $this->extension->element . '.xml'); + $manifest = JPATH_MANIFESTS . '/files/' . $this->extension->element . '.xml'; + + if (is_file($manifest)) { + File::delete($manifest); + } $extensionId = $this->extension->extension_id; @@ -283,7 +287,10 @@ protected function removeExtensionFiles() $folderList[] = $targetFolder . '/' . $eFileName; } else { $fileName = $targetFolder . '/' . $eFileName; - File::delete($fileName); + + if (is_file($fileName)) { + File::delete($fileName); + } } } } diff --git a/libraries/src/Installer/Adapter/LibraryAdapter.php b/libraries/src/Installer/Adapter/LibraryAdapter.php index 1d9f0e6f8b441..f3eeacb7518d6 100644 --- a/libraries/src/Installer/Adapter/LibraryAdapter.php +++ b/libraries/src/Installer/Adapter/LibraryAdapter.php @@ -274,7 +274,11 @@ public function prepareDiscoverInstall() protected function removeExtensionFiles() { $this->parent->removeFiles($this->getManifest()->files, -1); - File::delete(JPATH_MANIFESTS . '/libraries/' . $this->extension->element . '.xml'); + $manifest = JPATH_MANIFESTS . '/libraries/' . $this->extension->element . '.xml'; + + if (is_file($manifest)) { + File::delete($manifest); + } // @todo: Change this so it walked up the path backwards so we clobber multiple empties // If the folder is empty, let's delete it diff --git a/libraries/src/Installer/Adapter/PackageAdapter.php b/libraries/src/Installer/Adapter/PackageAdapter.php index 022802d6f181c..eb7875212dd89 100644 --- a/libraries/src/Installer/Adapter/PackageAdapter.php +++ b/libraries/src/Installer/Adapter/PackageAdapter.php @@ -328,7 +328,11 @@ protected function finaliseUninstall(): bool $update->delete($uid); } - File::delete(JPATH_MANIFESTS . '/packages/' . $this->extension->element . '.xml'); + $file = JPATH_MANIFESTS . '/packages/' . $this->extension->element . '.xml'; + + if (is_file($file)) { + File::delete($file); + } $folder = $this->parent->getPath('extension_root'); diff --git a/libraries/src/Installer/Installer.php b/libraries/src/Installer/Installer.php index 02a4868fe3ddc..fdc98c9f102a2 100644 --- a/libraries/src/Installer/Installer.php +++ b/libraries/src/Installer/Installer.php @@ -531,12 +531,16 @@ public function abort($msg = null, $type = null) switch ($step['type']) { case 'file': // Remove the file - $stepval = File::delete($step['path']); + if (is_file($step['path']) && !($stepval = File::delete($step['path']))) { + Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $step['path']), Log::WARNING, 'jerror'); + } break; case 'folder': // Remove the folder - $stepval = Folder::delete($step['path']); + if (Folder::exists($step['path']) && !($stepval = Folder::delete($step['path']))) { + Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $step['path']), Log::WARNING, 'jerror'); + } break; case 'query': @@ -1437,11 +1441,19 @@ public function parseFiles(\SimpleXMLElement $element, $cid = 0, $oldFiles = nul $deletions = $this->findDeletedFiles($oldEntries, $element->children()); foreach ($deletions['folders'] as $deleted_folder) { - Folder::delete($destination . '/' . $deleted_folder); + $folder = $destination . '/' . $deleted_folder; + + if (Folder::exists($folder) && !Folder::delete($folder)) { + Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $folder), Log::WARNING, 'jerror'); + } } foreach ($deletions['files'] as $deleted_file) { - File::delete($destination . '/' . $deleted_file); + $file = $destination . '/' . $deleted_file; + + if (is_file($file) && !File::delete($file)) { + Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $file), Log::WARNING, 'jerror'); + } } } } diff --git a/libraries/src/Installer/InstallerScript.php b/libraries/src/Installer/InstallerScript.php index 23bb71499f6c7..28da7035a4f52 100644 --- a/libraries/src/Installer/InstallerScript.php +++ b/libraries/src/Installer/InstallerScript.php @@ -317,7 +317,7 @@ public function removeFiles() { if (!empty($this->deleteFiles)) { foreach ($this->deleteFiles as $file) { - if (file_exists(JPATH_ROOT . $file) && !File::delete(JPATH_ROOT . $file)) { + if (is_file(JPATH_ROOT . $file) && !File::delete(JPATH_ROOT . $file)) { echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $file) . '
'; } } diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php index 8b277e78046ac..8c1d275393cad 100644 --- a/libraries/src/Updater/Update.php +++ b/libraries/src/Updater/Update.php @@ -203,13 +203,21 @@ class Update protected $currentUpdate; /** - * Object containing the latest update data + * Object containing the latest update data which meets the PHP and DB version requirements * * @var \stdClass * @since 3.0.0 */ protected $latest; + /** + * Object containing details if the latest update does not meet the PHP and DB version requirements + * + * @var \stdClass + * @since __DEPLOY_VERSION__ + */ + protected $otherUpdateInfo; + /** * The minimum stability required for updates to be taken into account. The possible values are: * 0 dev Development snapshots, nightly builds, pre-release versions and so on @@ -355,6 +363,10 @@ public function _endElement($parser, $name) && $product == $this->currentUpdate->targetplatform->name && preg_match('/^' . $this->currentUpdate->targetplatform->version . '/', $this->get('jversion.full', JVERSION)) ) { + // Collect information on updates which do not meet PHP and DB version requirements + $otherUpdateInfo = new \stdClass(); + $otherUpdateInfo->version = $this->currentUpdate->version->_data; + $phpMatch = false; // Check if PHP version supported via tag, assume true if tag isn't present @@ -362,6 +374,12 @@ public function _endElement($parser, $name) $phpMatch = true; } + if (!$phpMatch) { + $otherUpdateInfo->php = new \stdClass(); + $otherUpdateInfo->php->required = $this->currentUpdate->php_minimum->_data; + $otherUpdateInfo->php->used = PHP_VERSION; + } + $dbMatch = false; // Check if DB & version is supported via tag, assume supported if tag isn't present @@ -385,6 +403,13 @@ public function _endElement($parser, $name) if (isset($supportedDbs->$dbType)) { $minimumVersion = $supportedDbs->$dbType; $dbMatch = version_compare($dbVersion, $minimumVersion, '>='); + + if (!$dbMatch) { + $otherUpdateInfo->db = new \stdClass(); + $otherUpdateInfo->db->type = $dbType; + $otherUpdateInfo->db->required = $minimumVersion; + $otherUpdateInfo->db->used = $dbVersion; + } } } else { // Set to true if the tag is not set @@ -409,6 +434,11 @@ public function _endElement($parser, $name) ) { $this->latest = $this->currentUpdate; } + } elseif ( + !isset($this->otherUpdateInfo) + || version_compare($otherUpdateInfo->version, $this->otherUpdateInfo->version, '>') + ) { + $this->otherUpdateInfo = $otherUpdateInfo; } } break; ```
tecpromotion commented 8 months ago

see e34a03254fcc96a99bfffe80fa6bab7c3be27305