514 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
361dfe8145
MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces:
- https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
- https://www.php.net/manual/en/reflectionproperty.setaccessible.php
- https://www.php.net/manual/en/reflectionmethod.setaccessible.php

As of PHP 8.1.0, calling this method has no effect; all methods are
invokable by default. So, let's remove all uses from core, they are
no-op.
2024-03-10 21:15:00 +01:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
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.
2024-02-28 23:33:26 +01:00
meirzamoodle
d1c27bba15 MDL-78256 lib: Code adjustments to the Zipstream 3.1.0 2024-02-12 16:56:37 +07:00
Jun Pataleta
3606ebad4a
Merge branch 'MDL-80247' of https://github.com/paulholden/moodle 2024-02-01 11:39:06 +08:00
Ferran Recio
f4adbc8a11 MDL-79029 behat: replace deprecated behat steps 2024-01-22 11:12:28 +01:00
Paul Holden
f3846ef735
MDL-80247 files: multi-byte aware filename shortening in exporter.
Also correctly extract the original file extension.

Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
Co-authored-by: Mazitov Artem <maz@2i.tusur.ru>
2024-01-04 13:20:14 +00:00
Paul Holden
7143cf4cbc
MDL-79397 reportbuilder: update existing entity table definitions. 2023-12-07 17:19:01 +00:00
Paul Holden
0d9b79fb20
MDL-79216 files: new report filter type for filesize data. 2023-12-01 09:39:01 +00:00
Andrew Nicols
75587e23c6
MDL-79890 core: Update uses of array_keys with multiple params
These now call the newly minted `moodle_array_keys_filter` method.
2023-11-15 09:14:40 +08:00
Paul Holden
72e0fcb156
MDL-79200 files: mimetype filter, plus icon column in report entity. 2023-10-20 13:52:37 +01:00
Jun Pataleta
94bc2cd38b
MDL-79551 versions: bump all versions and requires near release 2023-10-04 13:57:17 +08:00
Mikel Martín
8af68bbe09 MDL-78558 core_courseformat: Activity cards UI improvements
- Fix action menu and completion button size
- New 'Add activity' button styles
- Fix restriction container styles
- Fix action menu and groupmode button styles
- Fix hover styles for action menu and groupmode button
- Fix groupmode spacing styles
- Homogenize completion button colours
- Fix inplaceeditable and badge positioning
- Fix export filesize related behat
- Homogenize activity/section availability
- New add topic styles
2023-09-07 09:34:43 +02:00
Paul Holden
ce1db1499d
MDL-78741 files: context report entity data for path and parent.
Allows for better aggregation/grouping of file data by context tree.
2023-08-24 08:02:08 +01:00
Paul Holden
33a63ca639
MDL-76295 reportbuilder: implement default datasource sorting.
Update all existing report sources to use the new default sorting
API from 064eccd4, updating existing tests to assert behaviour.
2023-08-23 15:32:50 +01:00
Sara Arjona
7430208d56
MDL-78884 files: Deprecate size parameter for icons
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.
2023-08-23 07:30:16 +02:00
Paul Holden
d8df4ad675
MDL-78117 reportbuilder: use context entity in report sources.
Deprecate existing columns, to be replaced by corresponding elements
from the new entity.
2023-08-02 08:05:50 +01:00
Paul Holden
c720c21aca
MDL-78454 files: add contenthash column/filter to file report entity. 2023-06-20 08:51:32 +01:00
Sara Arjona
af164ce9c7 MDL-78207 resource: Move file type to activity badge
One of the resource settings, the file type, has been moved to the
activity badge near the activity name.
The rest of the information will be displayed using the afterlink
feature.

However, for now, the activity page still displays all the information
together (that's why resource_get_optional_details() supports now one
new parameter, $showtype, to define whether the file type should be
displayed or not).
2023-06-13 12:09:58 +02:00
Eloy Lafuente (stronk7)
061c9d7ba0 MDL-77940 versions: bump all versions and requires near release
version = 2023042400 release version
requires= 2023041800 current rc1 version
2023-04-18 18:08:09 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Sara Arjona
1f9ed85d71 Merge branch 'MDL-77807' of https://github.com/paulholden/moodle 2023-04-03 11:53:12 +02:00
Paul Holden
fc2cfd8695
MDL-77807 files: normalise file entity size/type column fields.
The `filename` field was only used by each to determine whether the
file was itself a directory, and it's presence meant that aggregation
of each column wasn't working properly.
2023-03-30 20:40:24 +01:00
Meirza
a36fcf48a9 MDL-77347 files: Added class properties that are not declared.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-03-27 15:58:22 +07:00
Angelia Dela Cruz
09dd28488a MDL-76499 behat: Resource Behat tests optimised
Replace steps that manually add resource instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.

Co-authored-by: David Woloszyn <david.woloszyn@moodle.com>
2023-02-03 11:02:26 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Jun Pataleta
00bae8b8a4 MDL-76403 versions: bump all versions and requires near release 2022-11-23 09:45:23 +08:00
Paul Holden
8176a6c690 Merge branch 'MDL-76011-master' of https://github.com/abgreeve/moodle 2022-11-10 11:49:30 +00:00
Eloy Lafuente (stronk7)
d590b08dfa MDL-75880 phpunit: fix all @coversDefaultClass missing @covers
Because @coversDefaultClass doesn't indicate any coverage (it's
just an alias to avoid having to write the class name in @covers),
this commit fixes all the files that were using that annotation
and missing any @covers.

Basically, replacing one by the other and done.
2022-11-04 16:51:20 +01:00
Sara Arjona
b8ae747056 Merge branch 'MDL-75535' of https://github.com/paulholden/moodle 2022-11-04 11:01:41 +08:00
Adrian Greeve
2b2b4e63a2 MDL-76011 lib: Updated the zip writer to retain the modified date. 2022-10-27 14:46:31 +08:00
Jun Pataleta
a0e33d87ac Merge branch 'MDL-74910-master' of https://github.com/cameron1729/moodle 2022-10-20 13:57:40 +08:00
Cameron Ball
38c89c5343 MDL-74910 core_files: Remove unused query param 2022-10-20 13:57:39 +08:00
Kateryna Degtyariova
70bd5a2161 MDL-74910 core_files: Additional unit tests for get_conversions_for_file 2022-10-20 13:57:39 +08:00
Cameron Ball
c9da36d731 MDL-74910 core_files: Return SQL to initial state
MDL-73727 aimed to improve the performance of the
get_conversions_for_file SQL. Unfortunately it also
changed the behvaiour of the SQL.

On further investigation, there is nothing wrong with
the SQL. This patch returns it back to its initial state.
2022-10-20 13:57:39 +08:00
Paul Holden
5d385d4bcb MDL-75535 files: implement files datasource for custom reporting.
Create file entity, joining to existing user entity to provide data
for the reportbuilder editor.
2022-10-19 15:04:09 +01:00
Kevin Pham
027b6f73d6 MDL-49795 file: Add missing metadata providers for file_conversion 2022-08-03 15:17:05 +10:00
Paul Holden
52992d993c MDL-73568 admin: show accepted types for stored file config settings.
Re-factor existing code to make use of file manager class that renders
these details for us by default.

Co-authored-by: Simey Lameze <simey@moodle.com>
2022-06-24 10:13:09 +01:00
Kevin Pham
f984566b15 MDL-73727 core_files: Add subquery to avoid a seq scan on larger sites
- Formatted the query to meet SQL coding styles
- Add index on {files} to prevent performance regression
- Fork the SQL query based on DB family based on support
2022-05-30 13:38:45 +10:00
Eloy Lafuente (stronk7)
9f53b0e965 MDL-73971 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- Some fixtures, initially defined in the test files have been
  moved to new files in fixtures subdirectory, leaving the unit
  test files clearer:
  - moodle2_course_format_test.php
- Rename wrong named test:
  - baseoptiogroup_test = baseoptigroup_test
2022-05-06 18:29:11 +02:00
Jun Pataleta
70f6b1605b MDL-74471 versions: bump all versions and requires near release 2022-04-13 10:37:36 +08:00
Mathew May
b0532aedd8 MDL-72092 behat: Add private files block where needed 2022-03-01 19:13:20 +08:00
Eloy Lafuente (stronk7)
100bc51f1d MDL-73485 phpunit: externallib, generator and filter tescase names
All externallib_test, generator_test and filter_test classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to tests under testing/tests:

1) The core_testing component doesn't exist.
2) But testing/tests are allowed because there is a suite pointing to it (phpunit.xml).
3) So, the only possible namespace for them is "core".
4) And to avoid problems with other core testcases (under lib/tests)
   they have been renamed to have testing_xxxx as prefix.

Finally, also modified calendar/tests/events/events_test.php because it uses
some renamed (core_calendar_externallib_testcase => \core_calendar\externallib_test)
classes.
2022-01-21 19:48:23 +01:00
Eloy Lafuente (stronk7)
e4a2d9c1d4 MDL-73348 phpunit: normalize all privacy provider tests
As far as now all them have correct privacy level2 namespace:
- Move them to "privacy" subdir.
- Rename the files to "provider_test.php", this includes old
  privacy_test.php and privacy_provider_test.php files
- Rename the testcase to provider_test too (to match file name)

Also, change some relative paths and comments to point to new
locations.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
57e6fb7ad9 MDL-73348 phpunit: privacy and privacy_provider testcase names
All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
2021-12-17 14:21:02 +01:00
Eloy Lafuente (stronk7)
deb0e76eee MDL-73278 phpunit: Rename already namespaced classes to match file name
These are the only cases 100% safe to apply the renaming of the
testcase class names to match the file names.

All other cases are not safe, because they are missing namespace
and may enter into name conflicts. Adding namespaces is not as
simple as imagined because it implies to, also, add a good number
of modifications to core. See the issue for more details.
2021-12-07 23:54:29 +01:00
Mathew May
b983003e2e MDL-70197 navigation: Remove old navigation elements and migrate behat 2021-11-29 15:47:42 +08:00
sam marshall
e332d1849d MDL-72643 core: Improve display_size
Allows display_size to use a fixed unit for easy comparison of
multiple results, and fixed decimal places for the same reason.

Improves behaviour by using consistent decimal places and a
consistent space before the unit (the previous one only has a space
before 'bytes', not before 'KB').

Of existing uses, all the ones that displayed a 'maxbytes' type
configuration setting (which are likely to have an 'exact' size
and would be better shown as 512 KB rather than 512.0 KB) have been
changed to use 0 decimal places, to preserve previous behaviour.
All the uses which were showing an actual file or memory size have
been left as default (1 decimal place).
2021-09-27 16:52:33 +01:00
Sara Arjona
3f2f2e85bb MDL-72115 course: Rename Miscellaneous category
The "Miscellaneous" course category has been renamed to Category 1.
Besides, the description field has been set from FORMAT_MOODLE to
FORMAT_HTML.
2021-09-13 08:36:17 +02:00
Eloy Lafuente (stronk7)
9d6aa39985 MDL-71583 versions: Add all the missing full-stops to version/requires
It seems that the new phpcs3 checker is now controlling those
line comments that previously were ignored.

This commit just looks for all the cases and bulk-add
them when needed. The bash script (mac) used to add all them is:

while read -r line; do
    arr=(${line//:/ })
    if [[ -n ${arr[0]} ]] && [[ -n ${arr[1]} ]]; then
        echo "  file ${arr[0]}, line ${arr[1]}"
        sed -i "${arr[1]}s/\$/\./" ${arr[0]}
    fi
done < <(find . -name version.php | xargs ag --nomultiline '>(version|requires) *=.*//.*[^;\.]$')
2021-05-11 20:11:07 +02:00