Getting this error when executing moosh file-upload --filename=169.mbz /app/moodledata/backup.mdz
Notice: Undefined variable: filepath in /app/vendor/tmuras/moosh/Moosh/Command/Moodle23/File/FileUpload.php on line 71
Default exception handler: Cannot read file. Either the file does not exist or there is a permission problem. Debug:
Error code: storedfilecannotread
Expected behaviour
File is uploaded to moodle and no error messages or notices about undeclared variables.
Steps to reproduce
Try to upload a file by providing its absolute path, e.g moosh file-upload --filename=169.mbz /app/moodledata/backup.mdz
Looking at the code in FileUpload.php $filepath variable is only set when the specified file does not start with a leading forward slash. In addition, $arguments[0] is used to reference the filepath throughout the code so suggest its more consistent to just use that throughout.
Actual behaviour
Getting this error when executing
moosh file-upload --filename=169.mbz /app/moodledata/backup.mdz
Expected behaviour
File is uploaded to moodle and no error messages or notices about undeclared variables.
Steps to reproduce
Try to upload a file by providing its absolute path, e.g
moosh file-upload --filename=169.mbz /app/moodledata/backup.mdz
Looking at the code in
FileUpload.php
$filepath variable is only set when the specified file does not start with a leading forward slash. In addition, $arguments[0] is used to reference the filepath throughout the code so suggest its more consistent to just use that throughout.