Click to expand the diff!
```diff
diff --git a/administrator/language/en-GB/com_media.ini b/administrator/language/en-GB/com_media.ini
index 99eb221fc9573..26ae6e64dc30a 100644
--- a/administrator/language/en-GB/com_media.ini
+++ b/administrator/language/en-GB/com_media.ini
@@ -17,11 +17,17 @@ COM_MEDIA_CHANGE_ORDERING="Change Ordering"
COM_MEDIA_CONFIGURATION="Media: Options"
COM_MEDIA_CONFIRM_DELETE_MODAL="Delete"
COM_MEDIA_CONFIRM_DELETE_MODAL_HEADING="Confirm Delete"
+COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS="Copy file is not possible as destination file already exists"
+COM_MEDIA_COPY_FILE_NOT_POSSIBLE="Copy file is not possible"
+COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS="Copy folder is not possible as destination folder already exists"
+COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE="Copy folder is not possible as destination folder is a file and can not be deleted"
+COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE="Copy folder is not possible"
COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder"
COM_MEDIA_CREATE_NEW_FOLDER_ERROR="Error creating folder."
COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS="Folder created."
COM_MEDIA_DECREASE_GRID="Decrease grid size"
COM_MEDIA_DELETE_ERROR="Error deleting the item."
+COM_MEDIA_DELETE_NOT_POSSIBLE="Delete not possible!"
COM_MEDIA_DELETE_SUCCESS="Item deleted."
COM_MEDIA_DROP_FILE="Drop file(s) to Upload"
COM_MEDIA_EDIT="Media Edit"
@@ -78,6 +84,12 @@ COM_MEDIA_MEDIA_MIME_TYPE="MIME Type"
COM_MEDIA_MEDIA_NAME="Name"
COM_MEDIA_MEDIA_SIZE="Size"
COM_MEDIA_MEDIA_TYPE="Type"
+COM_MEDIA_MOVE_FILE_ALREADY_EXISTS="Move file is not possible as destination file already exists"
+COM_MEDIA_MOVE_FILE_EXTENSION_INVALID="Move file is not possible as the extension is invalid"
+COM_MEDIA_MOVE_FILE_NOT_POSSIBLE="Move file is not possible"
+COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS="Move folder is not possible as destination folder already exists"
+COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED="Move folder to an existing destination failed"
+COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE="Move folder is not possible as destination folder is a file and can not be deleted"
COM_MEDIA_NAME="Name"
COM_MEDIA_ORDER_ASC="Ascending"
COM_MEDIA_ORDER_BY="Order By"
diff --git a/language/en-GB/com_media.ini b/language/en-GB/com_media.ini
index a42f0d7161988..fe2c8ea49ba62 100644
--- a/language/en-GB/com_media.ini
+++ b/language/en-GB/com_media.ini
@@ -23,6 +23,11 @@ COM_MEDIA_CLEAR_LIST="Clear List"
COM_MEDIA_CONFIGURATION="Media: Options"
COM_MEDIA_CONFIRM_DELETE_MODAL="Delete"
COM_MEDIA_CONFIRM_DELETE_MODAL_HEADING="Confirm Delete"
+COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS="Copy file is not possible as destination file already exists"
+COM_MEDIA_COPY_FILE_NOT_POSSIBLE="Copy file is not possible"
+COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS="Copy folder is not possible as destination folder already exists"
+COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE="Copy folder is not possible as destination folder is a file and can not be deleted"
+COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE="Copy folder is not possible"
COM_MEDIA_CREATE_FOLDER="Create Folder"
COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder"
COM_MEDIA_CREATE_NEW_FOLDER_ERROR="Error creating folder."
@@ -30,6 +35,7 @@ COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS="Folder created."
COM_MEDIA_CURRENT_PROGRESS="Current progress"
COM_MEDIA_DECREASE_GRID="Decrease grid size"
COM_MEDIA_DELETE_ERROR="Error deleting the item."
+COM_MEDIA_DELETE_NOT_POSSIBLE="Delete not possible!"
COM_MEDIA_DELETE_SUCCESS="Item deleted."
COM_MEDIA_DETAIL_VIEW="Detail View"
COM_MEDIA_DIRECTORY="Folder"
@@ -89,6 +95,12 @@ COM_MEDIA_MEDIA_MIME_TYPE="MIME Type"
COM_MEDIA_MEDIA_NAME="Name"
COM_MEDIA_MEDIA_SIZE="Size"
COM_MEDIA_MEDIA_TYPE="Type"
+COM_MEDIA_MOVE_FILE_ALREADY_EXISTS="Move file is not possible as destination file already exists"
+COM_MEDIA_MOVE_FILE_EXTENSION_INVALID="Move file is not possible as the extension is invalid"
+COM_MEDIA_MOVE_FILE_NOT_POSSIBLE="Move file is not possible"
+COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS="Move folder is not possible as destination folder already exists"
+COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED="Move folder to an existing destination failed"
+COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE="Move folder is not possible as destination folder is a file and can not be deleted"
COM_MEDIA_NAME="Image Name"
COM_MEDIA_NO_IMAGES_FOUND="No Images Found"
COM_MEDIA_NOT_SET="Not Set"
diff --git a/plugins/filesystem/local/src/Adapter/LocalAdapter.php b/plugins/filesystem/local/src/Adapter/LocalAdapter.php
index f9ef48152753b..4962c7e6655b7 100644
--- a/plugins/filesystem/local/src/Adapter/LocalAdapter.php
+++ b/plugins/filesystem/local/src/Adapter/LocalAdapter.php
@@ -345,7 +345,7 @@ public function delete(string $path)
}
if (!$success) {
- throw new \Exception('Delete not possible!');
+ throw new \Exception(Text::_('COM_MEDIA_DELETE_NOT_POSSIBLE'));
}
}
@@ -517,11 +517,11 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for
}
if (file_exists($destinationPath) && !$force) {
- throw new \Exception('Copy file is not possible as destination file already exists');
+ throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS'));
}
if (!File::copy($sourcePath, $destinationPath)) {
- throw new \Exception('Copy file is not possible');
+ throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE'));
}
}
@@ -540,15 +540,15 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for
private function copyFolder(string $sourcePath, string $destinationPath, bool $force = false)
{
if (file_exists($destinationPath) && !$force) {
- throw new \Exception('Copy folder is not possible as destination folder already exists');
+ throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS'));
}
if (is_file($destinationPath) && !File::delete($destinationPath)) {
- throw new \Exception('Copy folder is not possible as destination folder is a file and can not be deleted');
+ throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE'));
}
if (!Folder::copy($sourcePath, $destinationPath, '', $force)) {
- throw new \Exception('Copy folder is not possible');
+ throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE'));
}
}
@@ -622,15 +622,15 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for
}
if (!MediaHelper::checkFileExtension(pathinfo($destinationPath, PATHINFO_EXTENSION))) {
- throw new \Exception('Move file is not possible as the extension is invalid');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_EXTENSION_INVALID'));
}
if (file_exists($destinationPath) && !$force) {
- throw new \Exception('Move file is not possible as destination file already exists');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_ALREADY_EXISTS'));
}
if (!File::move($sourcePath, $destinationPath)) {
- throw new \Exception('Move file is not possible');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_NOT_POSSIBLE'));
}
}
@@ -649,18 +649,18 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for
private function moveFolder(string $sourcePath, string $destinationPath, bool $force = false)
{
if (file_exists($destinationPath) && !$force) {
- throw new \Exception('Move folder is not possible as destination folder already exists');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS'));
}
if (is_file($destinationPath) && !File::delete($destinationPath)) {
- throw new \Exception('Move folder is not possible as destination folder is a file and can not be deleted');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE'));
}
if (is_dir($destinationPath)) {
// We need to bypass exception thrown in JFolder when destination exists
// So we only copy it in forced condition, then delete the source to simulate a move
if (!Folder::copy($sourcePath, $destinationPath, '', true)) {
- throw new \Exception('Move folder to an existing destination failed');
+ throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED'));
}
// Delete the source
```
New language relevant PR in upstream repo: https://github.com/joomla/joomla-cms/pull/43694 Here are the upstream changes:
Click to expand the diff!
```diff diff --git a/administrator/language/en-GB/com_media.ini b/administrator/language/en-GB/com_media.ini index 99eb221fc9573..26ae6e64dc30a 100644 --- a/administrator/language/en-GB/com_media.ini +++ b/administrator/language/en-GB/com_media.ini @@ -17,11 +17,17 @@ COM_MEDIA_CHANGE_ORDERING="Change Ordering" COM_MEDIA_CONFIGURATION="Media: Options" COM_MEDIA_CONFIRM_DELETE_MODAL="Delete" COM_MEDIA_CONFIRM_DELETE_MODAL_HEADING="Confirm Delete" +COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS="Copy file is not possible as destination file already exists" +COM_MEDIA_COPY_FILE_NOT_POSSIBLE="Copy file is not possible" +COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS="Copy folder is not possible as destination folder already exists" +COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE="Copy folder is not possible as destination folder is a file and can not be deleted" +COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE="Copy folder is not possible" COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder" COM_MEDIA_CREATE_NEW_FOLDER_ERROR="Error creating folder." COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS="Folder created." COM_MEDIA_DECREASE_GRID="Decrease grid size" COM_MEDIA_DELETE_ERROR="Error deleting the item." +COM_MEDIA_DELETE_NOT_POSSIBLE="Delete not possible!" COM_MEDIA_DELETE_SUCCESS="Item deleted." COM_MEDIA_DROP_FILE="Drop file(s) to Upload" COM_MEDIA_EDIT="Media Edit" @@ -78,6 +84,12 @@ COM_MEDIA_MEDIA_MIME_TYPE="MIME Type" COM_MEDIA_MEDIA_NAME="Name" COM_MEDIA_MEDIA_SIZE="Size" COM_MEDIA_MEDIA_TYPE="Type" +COM_MEDIA_MOVE_FILE_ALREADY_EXISTS="Move file is not possible as destination file already exists" +COM_MEDIA_MOVE_FILE_EXTENSION_INVALID="Move file is not possible as the extension is invalid" +COM_MEDIA_MOVE_FILE_NOT_POSSIBLE="Move file is not possible" +COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS="Move folder is not possible as destination folder already exists" +COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED="Move folder to an existing destination failed" +COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE="Move folder is not possible as destination folder is a file and can not be deleted" COM_MEDIA_NAME="Name" COM_MEDIA_ORDER_ASC="Ascending" COM_MEDIA_ORDER_BY="Order By" diff --git a/language/en-GB/com_media.ini b/language/en-GB/com_media.ini index a42f0d7161988..fe2c8ea49ba62 100644 --- a/language/en-GB/com_media.ini +++ b/language/en-GB/com_media.ini @@ -23,6 +23,11 @@ COM_MEDIA_CLEAR_LIST="Clear List" COM_MEDIA_CONFIGURATION="Media: Options" COM_MEDIA_CONFIRM_DELETE_MODAL="Delete" COM_MEDIA_CONFIRM_DELETE_MODAL_HEADING="Confirm Delete" +COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS="Copy file is not possible as destination file already exists" +COM_MEDIA_COPY_FILE_NOT_POSSIBLE="Copy file is not possible" +COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS="Copy folder is not possible as destination folder already exists" +COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE="Copy folder is not possible as destination folder is a file and can not be deleted" +COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE="Copy folder is not possible" COM_MEDIA_CREATE_FOLDER="Create Folder" COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder" COM_MEDIA_CREATE_NEW_FOLDER_ERROR="Error creating folder." @@ -30,6 +35,7 @@ COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS="Folder created." COM_MEDIA_CURRENT_PROGRESS="Current progress" COM_MEDIA_DECREASE_GRID="Decrease grid size" COM_MEDIA_DELETE_ERROR="Error deleting the item." +COM_MEDIA_DELETE_NOT_POSSIBLE="Delete not possible!" COM_MEDIA_DELETE_SUCCESS="Item deleted." COM_MEDIA_DETAIL_VIEW="Detail View" COM_MEDIA_DIRECTORY="Folder" @@ -89,6 +95,12 @@ COM_MEDIA_MEDIA_MIME_TYPE="MIME Type" COM_MEDIA_MEDIA_NAME="Name" COM_MEDIA_MEDIA_SIZE="Size" COM_MEDIA_MEDIA_TYPE="Type" +COM_MEDIA_MOVE_FILE_ALREADY_EXISTS="Move file is not possible as destination file already exists" +COM_MEDIA_MOVE_FILE_EXTENSION_INVALID="Move file is not possible as the extension is invalid" +COM_MEDIA_MOVE_FILE_NOT_POSSIBLE="Move file is not possible" +COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS="Move folder is not possible as destination folder already exists" +COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED="Move folder to an existing destination failed" +COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE="Move folder is not possible as destination folder is a file and can not be deleted" COM_MEDIA_NAME="Image Name" COM_MEDIA_NO_IMAGES_FOUND="No Images Found" COM_MEDIA_NOT_SET="Not Set" diff --git a/plugins/filesystem/local/src/Adapter/LocalAdapter.php b/plugins/filesystem/local/src/Adapter/LocalAdapter.php index f9ef48152753b..4962c7e6655b7 100644 --- a/plugins/filesystem/local/src/Adapter/LocalAdapter.php +++ b/plugins/filesystem/local/src/Adapter/LocalAdapter.php @@ -345,7 +345,7 @@ public function delete(string $path) } if (!$success) { - throw new \Exception('Delete not possible!'); + throw new \Exception(Text::_('COM_MEDIA_DELETE_NOT_POSSIBLE')); } } @@ -517,11 +517,11 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for } if (file_exists($destinationPath) && !$force) { - throw new \Exception('Copy file is not possible as destination file already exists'); + throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE_FILE_ALREADY_EXISTS')); } if (!File::copy($sourcePath, $destinationPath)) { - throw new \Exception('Copy file is not possible'); + throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE')); } } @@ -540,15 +540,15 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for private function copyFolder(string $sourcePath, string $destinationPath, bool $force = false) { if (file_exists($destinationPath) && !$force) { - throw new \Exception('Copy folder is not possible as destination folder already exists'); + throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_ALREADY_EXISTS')); } if (is_file($destinationPath) && !File::delete($destinationPath)) { - throw new \Exception('Copy folder is not possible as destination folder is a file and can not be deleted'); + throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE')); } if (!Folder::copy($sourcePath, $destinationPath, '', $force)) { - throw new \Exception('Copy folder is not possible'); + throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE')); } } @@ -622,15 +622,15 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for } if (!MediaHelper::checkFileExtension(pathinfo($destinationPath, PATHINFO_EXTENSION))) { - throw new \Exception('Move file is not possible as the extension is invalid'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_EXTENSION_INVALID')); } if (file_exists($destinationPath) && !$force) { - throw new \Exception('Move file is not possible as destination file already exists'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_ALREADY_EXISTS')); } if (!File::move($sourcePath, $destinationPath)) { - throw new \Exception('Move file is not possible'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_NOT_POSSIBLE')); } } @@ -649,18 +649,18 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for private function moveFolder(string $sourcePath, string $destinationPath, bool $force = false) { if (file_exists($destinationPath) && !$force) { - throw new \Exception('Move folder is not possible as destination folder already exists'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_ALREADY_EXISTS')); } if (is_file($destinationPath) && !File::delete($destinationPath)) { - throw new \Exception('Move folder is not possible as destination folder is a file and can not be deleted'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE')); } if (is_dir($destinationPath)) { // We need to bypass exception thrown in JFolder when destination exists // So we only copy it in forced condition, then delete the source to simulate a move if (!Folder::copy($sourcePath, $destinationPath, '', true)) { - throw new \Exception('Move folder to an existing destination failed'); + throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_EXISTING_DESTINATION_FAILED')); } // Delete the source ```