Before this change, file type errors were reported like system errors. Now,
they are reported in a plain dialoue, which is more like how it works for
drag-drop upload.
Also, before this, after an upload errors, you were left with a blank
filepicker dialogue. Now, the upload form is redisplayed.
This 'fix' is basically a work-around, but one that is already used in
some places. Now it is used in all similar places.
Exactly what causes the current file path in a file manager to become
unset is still unclear to me, but it seems to be an obscure race
condition that is very hard to reproduce.
However, when it happens, currently we are effectively defaulting to
path '/undefined/'. Using '/' is never worse, and is infinitely better
in the case where the filepicker does not allow folders to be used
(which includes important cases like essay questions in a quiz, which
some people use for exams!). In that case, falling back to non-top-level
path leads to dataloss.
Also, this is all historic JavaScript which will get replaced in the
grand de-YUI-fication, so I think a pragmatic fix is justified here.
W3C WebDriver Element::Click, Element::Clear, and Element::SendKeys all
state that the WebDriver implementation (chromedriver, geckodriver,
edgedriver) should scroll the element into view if it is not already
visible.
It is wrong for us to check if the element is visible or not before
calling these as it may not be but will during the click/clear/type
event.
This commit includes more changes, all them also adding the :void
return type to unit tests missing them.
The difference is that all these changes, while also detected
perfectly by the moodle.PHPUnit.TestReturnType sniff, were not
auto-fixed (like the previous commit ones), because all them
do include some "return" statement and, for safety, we don't
fix them.
All the cases have been visually inspected and confirmed that
the existing "return" statements always belong to anon
functions within the test body and not the test own return statement.
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.
All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
This change reverts much of MDL-74641, removing the erroneous userquota
checks from zip_packer. Now, during extraction, the zip_packer will exit
with an error status when it encounters a file which is larger than its
advertised size, and NOT when it determines the size of the extracted
files have exceeded the userquota (which only applies to private files
and which was used incorrectly here). It also reverts changes to the
draftfiles_ajax.php file, restoring the original (pre-MDL-74641) error
handling.
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration
It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.
So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing
All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.
Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
We should not rely solely on the provided size information.
Therefore the system needs to recalculate the size of each file in the zip file,
whether small or big.
The changes also cover the filemanager.js file if an error appears.
There are checks to urls that attempt to limit recurrsion when
parse_file is called. This is problematic for css import urls that
can call an indefinite amount of nested import urls. An import limit
has been introduced to address this. Fragments have also been removed.
The $CFG->svgicons setting was introduced in Moodle 2.4 due to incomplete
SVG support in certain web browsers.
The landscape has evolved significantly since then, and all modern browsers
now handle SVG files correctly.
The $CFG->svgicons settings has been removed and the supports_svg() method
has been updated with currently supported browsers (IE support was removed
in Moodle 3.10).
The *.png files in pix/f folder have been removed, so their references
need to be updated to use the proper SVG file or a different icon, as
happened with logo_uri for oauth2 services.
The parameter $size of the following functions has been deprecated and is not used any more:
- file_extension_icon
- file_file_icon
- file_folder_icon
- file_mimetype_icon
- mimeinfo_from_type
- url_guess_icon
That way, the sized icons (xxxxxxx-yyy.png) can be removed and replaced by SVG, to make it easier
to keep them updated because once they are replaced, there will only be one single file for each
MIME icon.