Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accounting for non standard plugin packages when using plugin-install #478

Merged
merged 2 commits into from
May 30, 2024

Conversation

ghost
Copy link

@ghost ghost commented May 30, 2024

Some plugins .zip file decompress in non standard directory (e.g. : zip file for atto_multilang2 decompresses into moodle-atto_multilang2-; mod_hvp decompresses into 2 dir "hvp" and "__MACOSX")

I managed this by unpacking the zip file into the moosh tempdir, and then moving it to the right path with the correct dir name.

Tell me if there is anything wrong with these changes

Some plugins .zip file decompress in non standard directory (e.g : zip file for atto_multilang2 decompresses into moodle-atto_multilang2-<version>; mod_hvp decompresses into 2 dir hvp and __MACOSX)
Copy link
Owner

@tmuras tmuras left a comment

Choose a reason for hiding this comment

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

  1. I don't think we want to clear all downloaded plugins:
    run_external_command("rm -rf $tempdir/*");

what's the reason for this deletion?

  1. Please add check if uncompresseddir is a valid directory (it could be that version.php is not found at all)
    $uncompresseddir = exec("find $tempdir -name 'version.php' | rev | cut -d'/' -f 2- | rev");
    run_external_command("mv $uncompresseddir $targetpath");

I removed the deletion of $tempdir content. I needed a clean directory to unpack the plugin to avoid finding the wrong version.php file. I instead create a subdirectory for this purpose.

I thought clearing the $tempdir wouldn't be a problem since the downloaded content was removed after being unpacked anyway.

the check for the validity of uncompresseddir is added
@ghost
Copy link
Author

ghost commented May 30, 2024

I removed the deletion of $tempdir content. I needed a clean directory to unpack the plugin to avoid finding the wrong version.php file. I instead create a subdirectory for this purpose.

I thought clearing the $tempdir wouldn't be a problem since the downloaded content was removed after being unpacked anyway.

the check for the validity of uncompresseddir is added

@tmuras
Copy link
Owner

tmuras commented May 30, 2024 via email

@tmuras tmuras merged commit 5d1e9ec into tmuras:master May 30, 2024
5 checks passed
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.

1 participant