Commit Graph

152 Commits

Author SHA1 Message Date
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
Andrew Nicols 12dcde3fae MDL-80072 core: Add PSR-11 interfaces 2024-02-09 15:03:57 +08:00
raortegar f81d6ed426 MDL-78511 lib: Include JmesPath library
JMESPath library is required by AWS SDK for PHP library
2023-12-08 15:27:05 +01:00
raortegar 9b98f78d2a MDL-78511 lib: Include aws-sdk library
Include AWS SDK for PHP library.
This library is used in SMS factor from MFA project
2023-12-08 15:27:05 +01:00
Andrew Nicols 846892ab07 MDL-79697 core: Coding style updates 2023-11-15 21:24:31 +08:00
Andrew Nicols db556a4ce8 MDL-79697 core: PSR-4 NS can be spread across multiple dirs
The PSR-4 specification does not preclude a single namespaces from
having multiple sources. This is the case for several PSR standards
including standard packagist packages distributed by PSR:

- PSR-7 - HTTP Message Interfaces: \Psr\Http\Message
- PSR-17 - HTTP Factories: \Psr\Http\Message
- PSR-15 - http-server-handler: \Psr\Http\Server
- PSR-15 - http-server-middleware: \Psr\Http\Server
2023-11-15 21:23:27 +08:00
Petr Skoda 99a7a7c782 MDL-74954 core: add Hooks based on PSR-14 2023-05-20 11:03:46 +02:00
Andrew Nicols 31f82832b6 MDL-65471 core: Sort directories before hashing 2023-04-06 15:41:00 +08:00
Peter Burnett 027c770eab MDL-65471 upgrade: framework to reduce maintenance mode 2023-04-06 11:38:26 +10:00
Jun Pataleta e95e290532 MDL-77783 core: Validate sublugins.json
* Validate the decoded subplugins.json before processing it.
* Log errors if subplugins.json is invalid or if plugintypes is not
defined.
2023-03-29 09:29:36 +08:00
Jun Pataleta cd0afd5c76 MDL-77105 core: Method to determine whether a plugin has monolog icons 2023-03-27 13:32:09 +08:00
Andrew Nicols 8ae5ebb507 MDL-77163 cachestore_mongodb: Remve from core 2023-02-28 22:24:04 +08:00
Safat 59a9987719 MDL-76135 core: Add guzzle cache middleware 2023-01-30 13:05:27 +11:00
Safat 7c5363eed3 MDL-76135 core: Implement the Guzzle library in core
This commit will implement the Guzzle library in core
to make it usable in different locations.

Co-Authored-By: Andrew Nicols <andrew@nicols.co.uk>
Co-Authored-By: Safat Shahin <safat.shahin@moodle.com>
2023-01-30 13:05:27 +11:00
Andrew Nicols 93ab932211 MDL-76362 core: plugin names must be strings to be valid 2023-01-23 09:15:55 +08:00
Marina Glancy b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Meirza 3b4bc74692 MDL-76219 lib: Remove Box\Spout library 2023-01-05 16:04:37 +07:00
Meirza b2b17b9d9b MDL-76219 lib: Add the OpenSpout 3.7.3 library 2023-01-04 09:47:06 +07:00