15 Commits

Author SHA1 Message Date
David Mudrák
3e6a8aeb7c MDL-38509 Unify curl class usage in the add-on installer tool
Both classes using cURL features now access it via the core curl wrapper
class. Credit goes to Dan Poltawski for spotting the previous discrepancy
during the integration review.
2013-04-02 23:11:01 +02:00
David Mudrák
c9c4d0b24e MDL-38509 Fix false unit test failures in the add-on installer
Previously, the testable validator's get_plugintype_location() used to
return path to a directory that itself did not need to be writable. This
was causing false failures. This patch reimplements the testable
validator's get_plugintype_location() method so that it returns a path
inside $CFG->tempdir which is always writable.

Also, to make all test methods consistent, all of them now use the
testable_tool_installaddon_validator class. Before this patch, some test
methods used the testable class and some used the parent class.
2013-04-02 16:58:12 +02:00
David Mudrák
b2a138a20f MDL-38509 Escalate the maturity level of the plugin
The API is considered stable now and there should not be a need to
change it.
2013-03-29 01:30:00 +01:00
David Mudrák
af96f120e9 MDL-38509 Add ability to install add-ons from the remote repository
There is a new hook in the index.php file. If valid HTTP parameter
installaddonrequest is detected, the installer asks the administrator to
confirm the request.

If confirmed, the installer calls download.moodle.org/api/1.2/pluginfo.php
service to get information about the given plugin version. The essential
data are the URL of the ZIP to download and the MD5 hash of the ZIP.
These data must be fetched via HTTPS to protect against MiM attack.

If the ZIP is downloaded and the MD5 content hash is correct, the user
is redirected to the previously implemented ZIP validation page, as if
the ZIP was uploaded manually.

The valid format of the installaddonrequest is documented via the
test_decode_remote_request() unit test method.
2013-03-29 00:16:06 +01:00
David Mudrák
399ddcc73e MDL-38509 Move the tool node in the navigation
The "Install add-ons" should appear just below Site administration >
Plugins, before the "Activity modules".
2013-03-28 11:54:07 +01:00
David Mudrák
b7f6442670 MDL-38509 Fix the communication protocol with Moodle plugins directory
Implements the behaviour currently specified at
http://docs.moodle.org/dev/On-click_add-on_installation
2013-03-28 11:54:06 +01:00
David Mudrák
59a2cc8d38 MDL-38509 Add the script that finally deploys the validated ZIP contents 2013-03-28 11:54:06 +01:00
David Mudrák
a143984a36 MDL-38509 Add strings for the new admin tool 2013-03-28 11:54:06 +01:00
David Mudrák
cbd125e85d MDL-38509 Implement the ZIP package validation page
The script validate.php expects a ZIP file stored in a temporary
location. It extracts the ZIP (optionally renaming the root directory)
and executes the validator. Then it renders the validator log messages
and continue buttons.
2013-03-28 11:54:06 +01:00
David Mudrák
07083b230b MDL-38509 Add new tool_installaddon_installer::extract_installfromzip_file() method 2013-03-28 11:54:06 +01:00
David Mudrák
585b64a607 MDL-38509 Save uploaded ZIP into a temporary location and redirect to validator 2013-03-28 11:54:06 +01:00
David Mudrák
30bec5ba8d MDL-38509 Add new tool_installaddon_installer::get_plugintype_root() method 2013-03-28 11:54:06 +01:00
David Mudrák
a4fcf56f0a MDL-38509 Implement the plugin ZIP package validator
The validator code contains (modified) fragments of the
local_plugins_archive_validator class copyrighted by Marina Glancy that
is part of the local_plugins plugin. It operates over an extracted
copy of the ZIP file.
2013-03-28 11:54:06 +01:00
David Mudrák
ddab904ba8 MDL-38509 Check for writable plugin type location in install from ZIP form
Standard mform validation is implemented as well as progressively
enhanced AJAX version.
2013-03-28 11:54:05 +01:00
David Mudrák
0056f2a37b MDL-38509 Initial version of the new admin tool to install add-ons 2013-03-28 11:54:05 +01:00