Commit Graph

169 Commits

Author SHA1 Message Date
Dan Marsden fb9d6e718d MDL-86376 core: Make public static functions more resilient
a
2025-10-16 20:45:50 +13:00
Sara Arjona dd0321926c Merge branch 'MDL-81664-main' of https://github.com/andrewnicols/moodle 2025-03-12 07:48:04 +01:00
Andrew Nicols d478ce6683 MDL-81664 core: Upgrade phpoffice/phpspreadsheet 2025-03-12 12:22:03 +08:00
Daniel Ziegenberg c23d5edb0f MDL-83334 core: Remove deprecated constant E_STRICT
One of the error levels PHP previously emitted was E_STRICT, on code
that was not strictly correct to ensure interoperability and forward
compatibility. PHP 7.0 converted the majority of existing E_STRICT
warnings to E_NOTICE, and since PHP 8.0, all E_STRICT notices have
changed to E_NOTICE.

Because all of the E_STRICT notices are upgraded to E_NOTICE since PHP
8.0, PHP 8.4 deprecates the E_STRICT constant.

The E_STRICT constant is deprecated in PHP 8.4. Using the constant
anywhere in PHP code now emits a deprecation notice in PHP 8.4 and
later.

The E_STRICT constant will be removed in PHP 9.0.

PHP core and core extensions since PHP 8.0 and later do not emit
E_STRICT notices at all. It is safe to assume that any PHP applications
that run on PHP 8.0 and later will never encounter E_STRICT notices, and
error reporting and handling can be safely updated to ignore E_STRICT
notices.

See: https://php.watch/versions/8.4/E_STRICT-deprecated

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2025-03-04 20:38:04 +01:00
Andrew Nicols 98b28fe13d MDL-81664 core: Import composer/pcre into core 2025-02-28 08:52:25 +08:00
Daniel Ziegenberg b2e791a56b MDL-82825 libraries: Remove php-enum library
It was a dependency of zipstream, but is no longer required as this
functionality has been replaced by native PHP functionality.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2025-02-21 10:11:47 +01:00
Andrew Nicols 2d9c877f58 MDL-79843 core: Fully reset the component cache for some tests 2025-01-29 14:39:50 +08:00
Sara Arjona 54ed733f98 Merge branch 'MDL-73700_remove-all-the-old-php-version-checks-from-core' of https://github.com/ziegenberg/moodle 2025-01-28 19:43:36 +01:00
Daniel Ziegenberg 224a7d2aac MDL-73700 core: remove old PHP version check
As MDL-73016 set the minimum supported PHP version for Moodle 4.4 and up
to PHP 8.1 we can now safely remove this check. It was introduced with
MDL-75945  because a new signature was introduced to ImagePolygon
functions from PHP 8.1 with the previous signature deprecated in 8.1.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2025-01-28 18:57:52 +01:00
Jake Dallimore 6b1a63189b MDL-79843 core: add plugintype deprecation support to core component
By default, for backward-compatibility, these plugin types and plugins
are not returned from existing APIs.
2025-01-28 14:42:19 +08:00
Andrew Nicols 84532b7667 MDL-83705 core: Update subplugins.json relative to plugin 2024-12-19 09:03:00 +07:00
Andrew Nicols 6ab400b733 MDL-83703 core: Remove support for subplugins.php 2024-12-02 10:08:28 +08:00
Andrew Nicols b8c3c13467 MDL-82824 core: Order the PSR4 component list 2024-11-04 11:58:47 +08:00
Andrew Nicols 670121daa3 MDL-82824 core: Add missing composer/PSR for various libs
Add missing aws-sdk composer.json
Add missing composer/PSR4 for SimplePie
Add missing composer/PSR4 for others
Add missing composer/PSR4 for markdown
Add missing composer/PSR4 for PHP-CSS-Parser
Add missing composer/PSR4 for Mustache
Add missing composer/PSR4 for RTLCSS
Add missing composer/PSR4 for SCSSPHP
Add missing composer/PSR4 for OpenSpout
Add missing composer/PSR4 for LTI
Add missing composer/PSR4 for GeoPattern
Add missing composer/PSR4 for CFPropertylist
Add missing composer/PSR4 for ZipStream
Add missing composer/PSR4 for PSR-20
Add missing composer/PSR4 for phpxmlrpc
Add missing composer/PSR4 for WebAuthn
2024-11-04 11:52:07 +08:00
Andrew Nicols 16bacf8134 MDL-82824 core: Add/correct missing autoload functions 2024-11-04 11:49:47 +08:00
Andrew Nicols 7fe199c58b MDL-82824 core: Standardise PSR-4 paths to remove trailing / 2024-11-04 11:49:47 +08:00
Andrew Nicols e918f86624 MDL-82824 core: Standardise MaxMind classes 2024-11-04 11:49:47 +08:00
Andrew Nicols 58acf94c96 MDL-81924 core: Include Spatie\Cloneable
Originally implemented as MDL-80960.
2024-09-23 09:45:26 +07:00
Jun Pataleta 23a7976a4b MDL-82740 core: Consider theme when checking for monologo icons 2024-09-19 20:47:18 +08:00
Jun Pataleta 4fcff065bb Merge branch 'MDL-82828-main' of https://github.com/andrewnicols/moodle 2024-09-02 17:52:12 +08:00
Andrew Nicols bac9672b7f MDL-82158 core: Ensure that the class map contains cache classes 2024-08-20 15:49:10 +08:00
Andrew Nicols 4ef233d993 MDL-82828 core: Update Html2Text to version 4.3.2 2024-08-20 11:14:29 +08:00
Andrew Nicols 08f8b58945 MDL-82747 core: Register composer autoload files
Unfortunately PHP does not provide any means to autoload the files that
a functions is located in, even if they are in an namespace.

To work around this, Composer makes use of an `autoload.files` section
in the `composer.json` file. Shortly after the Composer autoloader is
registered with the `spl_autoload_register` call it also includes any
files listed in this section.

Moodle does not do this and really we should be doing so.

This change adds a section to the autoloader registration method which
loads all of the files defined in any third-party library included in
our `lib` directory which contains any `composer.json` file with such a
stanza.
2024-08-14 21:57:20 +08:00
Andrew Nicols be3482f339 MDL-82747 core: Provide a standard way to register the Autoloader 2024-08-12 13:49:37 +08:00
Andrew Nicols 1b7d08465c MDL-81031 core: Add routing 2024-08-06 16:01:07 +08:00
Andrew Nicols 0c143ff7ce MDL-81031 core: Add Slim Framework 2024-08-06 16:01:06 +08:00
Andrew Nicols 712dc98c7e MDL-81031 core: Move phpspreadsheet to autoload properly 2024-08-06 16:01:06 +08:00
Andrew Nicols 3782af5a13 MDL-81031 core: Move psr\simple-cache 2024-08-06 16:01:06 +08:00
Andrew Nicols 9ca271e42d MDL-81031 core: Add PSR interfaces for PSRs 3, 7, 11, and 15 2024-08-06 16:01:05 +08:00
Andrew Nicols 2c6910cb77 MDL-81031 core: Use ::class for PSR namespacing 2024-08-06 16:00:43 +08:00
Andrew Nicols 29e7140e30 MDL-82427 filter_*: Move text filters to autoloaded location
Note: No backwards-compatability layer is included for manual inclusion
of filter.php as this is not a public API.  Inclusion should have always
been through the filter manager, and the filter's own unit tests.
2024-07-23 11:33:42 +08:00
Andrew Nicols 9b95650f18 MDL-66903 core: Check PHPUNIT_TEST defined before using 2024-07-15 13:46:09 +07:00
Andrew Nicols 0270c90dc0 MDL-66903 core: Introduce \core\component::resetto replace hacks
Traditionally we have done this using reflection and it would be better
to do this in a 'proper' fashion in case we ever need to change how it
works.
2024-07-15 13:07:42 +08:00
Andrew Nicols 25df1ed645 MDL-66903 core: Move core_component to \core\component 2024-07-15 13:07:42 +08:00
Andrew Nicols 406dcd2566 MDL-66903 testing: Add support for a \tests\ namespace during tests
This commit:
- introduces a \tests\ sub-namespace for use in unit tests only
- the path to this the tests/classes directory of the owning parent
- files here are excluded from unit test runs

This is agreed per policy in MDL-80855.
2024-07-15 13:07:36 +08:00
Jun Pataleta 1306c52855 Merge branch 'MDL-81960-main' of https://github.com/andrewnicols/moodle 2024-06-27 12:16:18 +08:00
Andrew Nicols 097b3fbee3 MDL-81960 core: Move moodle_url tests to correct location 2024-06-27 11:35:31 +08:00
Jun Pataleta e84daab7dd Merge branch 'MDL-82183-main-squashed' of https://github.com/andrewnicols/moodle 2024-06-27 08:49:13 +08:00
Andrew Nicols 2fff48b07c MDL-82183 core: Migrate all output classes to autoloaded 2024-06-26 23:00:31 +08:00
Paul Holden cc30087d84 MDL-81920 lang: move language string class into autoload namespace. 2024-06-26 14:23:11 +01:00
Andrew Nicols 585b060462 MDL-82183 core: Do not load subsystem db/legacyclasses.php
Subsystems do not support the notion of a `db` folder. Instead we must
conflate the lib/db/legacyclasses.php syntax to allow it to support
paths as either a string, or an array with [subsystem, path].
2024-06-24 14:43:47 +08:00
Andrew Nicols 434c191ff3 MDL-82156 core: Check that key classes are present for classloader 2024-06-14 12:28:55 +08:00
Andrew Nicols ca985c79c6 MDL-82156 core: Move core_component cache validity check to own method 2024-06-14 12:28:55 +08:00
Andrew Nicols 0abb2e6b9a MDL-81919 core: Update moved file namespaces 2024-06-10 12:13:00 +08:00
Andrew Nicols 302b94c2b7 MDL-81919 core: Add support for autoloading legacy classes 2024-06-10 10:04:08 +08:00
Andrew Nicols dae36f6cfa MDL-81063 core: Add helper to get component name from classname 2024-04-10 12:41:31 +08:00
Andrew Nicols 29fc61c2a5 MDL-81063 core: Add option to get core in list of components 2024-04-10 12:41:31 +08:00
Andrew Nicols 298c13ac3b MDL-80838 core: Add PSR-20/Clock support
This commit adds the PSR-20 ClockInterface to core, with a
moodle-specific extension to the Interface at `\core\clock`, and a
standard clock at `\core\system_clock`.

Further clocks are provided as `\incrementing_clock` and `\frozen_clock`
which are available to unit tests using:

- `$this->mock_clock_with_incrementing(?int $starttime = null);`
- `$this->mock_clock_with_frozen(?int $time = null);`

For the incrementing clock, every call to fetch the time will bump the
current time by one second.

For the frozen clock the time will not change, but can be modified with:
- `$clock->set_to(int $time);`; and
- `$clock->bump(int $seconds = 1);`
2024-04-02 10:24:54 +08:00
Huong Nguyen 6bddb8626f MDL-80207 core: Remove Horde library 2024-02-20 09:36:24 +07:00
Andrew Nicols 192a7797ab MDL-80072 core: Add php-di codebase 2024-02-12 11:11:15 +08:00