Skip to content

Added functionality for changing file names and their URI#35

Open
SHU8HAM1 wants to merge 1 commit into
mjordan:mainfrom
SHU8HAM1:Rename-Files
Open

Added functionality for changing file names and their URI#35
SHU8HAM1 wants to merge 1 commit into
mjordan:mainfrom
SHU8HAM1:Rename-Files

Conversation

@SHU8HAM1
Copy link
Copy Markdown

Added helper functions to change file name and URI from Islandora Workbench

@SHU8HAM1
Copy link
Copy Markdown
Author

The pull request to the workbench that uses this module: mjordan/islandora_workbench#931


if (!file_exists($source_file_uri)) {
// Show an error if no file on disc.
return 'No file exists in this';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to have this error message say "No file with name XX exists in the XXX filesystem."

$file->setFileUri($filepath_new);
$status = $file->save();

return new JsonResponse(['message' => 'File renamed successfully', 'new_filename' => $filename_new]);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message should contain both the original and new filename. Also, can we add this entry to the Drupal logger?

@mjordan
Copy link
Copy Markdown
Owner

mjordan commented Apr 24, 2025

To be consistent with a large PR I merged last week, can you please:

  1. Add a test for the new controller (see https://github.com/mjordan/islandora_workbench_integration/tree/main/tests/src/Functional)
  2. Make sure your new code passes the lint test (https://github.com/mjordan/islandora_workbench_integration/blob/main/.github/workflows/lint-test.yml)
  3. Make sure your new code supports Drupal 11.

Thanks!

@SHU8HAM1
Copy link
Copy Markdown
Author

Hi @mjordan , thanks for the feedback, I'll address all the concerns and get back to you when I make the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants