diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index db7b1840996d5..12601eb970dd0 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -1519,7 +1519,6 @@ public function deleteUnexistingFiles() '/media/editors/tinymce/skins/lightgray/fonts/tinymce.dev.svg', '/media/editors/tinymce/skins/lightgray/img/wline.gif', '/media/mod_languages/images/km_kr.gif', - '/media/mod_languages/images/si_LK.gif', '/plugins/editors/codemirror/styles.css', '/plugins/editors/codemirror/styles.min.css', @@ -1539,7 +1538,6 @@ public function deleteUnexistingFiles() '/libraries/simplepie/idn/idna_convert.class.php', '/libraries/simplepie/idn/npdata.ser', '/libraries/simplepie/simplepie.php', - '/media/mod_languages/images/si_lk.gif', '/media/system/js/permissions.min.js', '/plugins/editors/tinymce/fields/skins.php', '/plugins/user/profile/fields/dob.php', @@ -2324,6 +2322,8 @@ public function deleteUnexistingFiles() { JFile::delete(JPATH_ROOT . '/administrator/manifests/packages/pkg_weblinks.xml'); } + + $this->fixFilenameCasing(); } /** @@ -2657,4 +2657,67 @@ private function cleanJoomlaCache() $model->setState('client_id', 1); $model->clean(); } + + /** + * Renames or removes incorrectly cased files. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function fixFilenameCasing() + { + $files = array( + 'libraries/src/Filesystem/Support/Stringcontroller.php' => 'libraries/src/Filesystem/Support/StringController.php', + 'libraries/vendor/paragonie/sodium_compat/src/Core/Xsalsa20.php' => 'libraries/vendor/paragonie/sodium_compat/src/Core/XSalsa20.php', + 'media/mod_languages/images/si_LK.gif' => 'media/mod_languages/images/si_lk.gif', + ); + + foreach ($files as $old => $expected) + { + $oldRealpath = realpath(JPATH_ROOT . '/' . $old); + + // On Unix without incorrectly cased file. + if ($oldRealpath === false) + { + continue; + } + + $oldBasename = basename($oldRealpath); + $newRealpath = realpath(JPATH_ROOT . '/' . $expected); + $newBasename = basename($newRealpath); + $expectedBasename = basename($expected); + + // On Windows or Unix with only the incorrectly cased file. + if ($newBasename !== $expectedBasename) + { + // Rename the file. + rename(JPATH_ROOT . '/' . $old, JPATH_ROOT . '/' . $old . '.tmp'); + rename(JPATH_ROOT . '/' . $old . '.tmp', JPATH_ROOT . '/' . $expected); + + continue; + } + + // There might still be an incorrectly cased file on other OS than Windows. + if ($oldBasename === basename($old)) + { + // Check if case-insensitive file system, eg on OSX. + if (fileinode($oldRealpath) === fileinode($newRealpath)) + { + // Check deeper because even realpath or glob might not return the actual case. + if (!in_array($expectedBasename, scandir(dirname($newRealpath)))) + { + // Rename the file. + rename(JPATH_ROOT . '/' . $old, JPATH_ROOT . '/' . $old . '.tmp'); + rename(JPATH_ROOT . '/' . $old . '.tmp', JPATH_ROOT . '/' . $expected); + } + } + else + { + // On Unix with both files: Delete the incorrectly cased file. + unlink(JPATH_ROOT . '/' . $old); + } + } + } + } } diff --git a/libraries/src/Filesystem/Streams/StreamString.php b/libraries/src/Filesystem/Streams/StreamString.php index 167447fbfab18..f48006c5a3ab8 100644 --- a/libraries/src/Filesystem/Streams/StreamString.php +++ b/libraries/src/Filesystem/Streams/StreamString.php @@ -10,7 +10,7 @@ defined('JPATH_PLATFORM') or die; -use Joomla\CMS\Filesystem\Support\Stringcontroller; +use Joomla\CMS\Filesystem\Support\StringController; /** * String Stream Wrapper diff --git a/libraries/src/Filesystem/Support/Stringcontroller.php b/libraries/src/Filesystem/Support/StringController.php similarity index 100% rename from libraries/src/Filesystem/Support/Stringcontroller.php rename to libraries/src/Filesystem/Support/StringController.php diff --git a/libraries/vendor/paragonie/sodium_compat/src/Core/Xsalsa20.php b/libraries/vendor/paragonie/sodium_compat/src/Core/XSalsa20.php similarity index 100% rename from libraries/vendor/paragonie/sodium_compat/src/Core/Xsalsa20.php rename to libraries/vendor/paragonie/sodium_compat/src/Core/XSalsa20.php