MDL-49329 admin: Introduce new \core\update\api client class
authorDavid Mudrák <david@moodle.com>
Tue, 29 Sep 2015 23:59:52 +0000 (01:59 +0200)
committerDavid Mudrák <david@moodle.com>
Thu, 8 Oct 2015 21:32:03 +0000 (23:32 +0200)
commit48900324b306e8294e4704d08b3b6c7aa7e15331
tree542a030bf478077bcc503f88b21938b872806b9b
parent7eb87eff652527ccc1603939c69b6ca1583b7b46
MDL-49329 admin: Introduce new \core\update\api client class

The purpose of this class is to provide a general client for all APIs
available at https://download.moodle.org/api/ (e.g. available updates,
plugin info, plugins list etc). Currently, fetching data from this API
is done separately at several places. This leads to code duplication and
harder maintenance (I know it well).

Additionally, the existing client was implemented as
tool_installaddon_pluginfo_client in the admin/tool/installaddon/ scope.
I will soon need to use the same functionality in the
core_plugin_manager and it would hurt my karma if the core was depending
on a class provided by a admin tool plugin (even if it is standard one).

So, there is new \core\update\api client implementing the version 1.3 of
the pluginfo API. There is a TODO note left for remaining services.
admin/tool/installaddon/classes/installer.php
admin/tool/installaddon/classes/pluginfo_client.php [deleted file]
admin/tool/installaddon/renderer.php
lib/classes/update/api.php [new file with mode: 0644]
lib/tests/fixtures/testable_update_api.php [new file with mode: 0644]
lib/tests/update_api_test.php [new file with mode: 0644]