MDL-76055 libraries: Autoload phpxmlrpc and verify it works

Also, we can now safely remove Autoloader.php, because
Moodle PSR-4 autoloader has taken control, so document
and test it too.
This commit is contained in:
Eloy Lafuente (stronk7) 2022-09-20 18:45:47 +02:00
parent c958bd7305
commit a0d916bc86
4 changed files with 60 additions and 36 deletions

View file

@ -1,36 +0,0 @@
<?php
namespace PhpXmlRpc;
/**
* In the unlikely event that you are not using Composer to manage class autoloading, here's an autoloader for this lib.
* For usage, see any file in the demo/client directory
*/
class Autoloader
{
/**
* Registers PhpXmlRpc\Autoloader as an SPL autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
}
/**
* Handles autoloading of classes.
*
* @param string $class A class name.
*/
public static function autoload($class)
{
if (0 !== strpos($class, 'PhpXmlRpc\\')) {
return;
}
if (is_file($file = __DIR__ . str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) {
require $file;
}
}
}

View file

@ -11,6 +11,8 @@ To update:
- Download or checkout it.
- Delete the contents on the lib/phpxmlrpc directory (but this file) completely.
- Copy the /src directory contents of the library to lib/phpxmlrpc.
- Remove the following files:
- Autoloader.php
- Edit this file and update the release and commit details below.
- Edit lib/thirdpartylibs.xml and update the information details too.