Implements main plugin features.
More...
|
static | instance () |
| Factory method returning an instance of this class. More...
|
|
Implements main plugin features.
- Copyright
- 2013 David Mudrak david.nosp@m.@moo.nosp@m.dle.c.nosp@m.om
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
tool_installaddon_installer::__construct |
( |
| ) |
|
|
protected |
◆ decode_remote_request()
tool_installaddon_installer::decode_remote_request |
( |
|
$request | ) |
|
|
protected |
Decode the request from the Moodle Plugins directory.
- Parameters
-
string | $request | submitted via 'installaddonrequest' HTTP parameter |
- Return values
-
stdClass|bool | false on error, object otherwise |
◆ detect_plugin_component()
tool_installaddon_installer::detect_plugin_component |
( |
|
$zipfilepath | ) |
|
Detect the given plugin's component name.
Only plugins that declare valid $plugin->component value in the version.php are supported.
- Parameters
-
string | $zipfilepath | full path to the saved ZIP file |
- Return values
-
string|bool | declared component name or false if unable to detect |
◆ detect_plugin_component_from_versionphp()
tool_installaddon_installer::detect_plugin_component_from_versionphp |
( |
|
$code | ) |
|
|
protected |
Return the plugin component declared in its version.php file.
- Parameters
-
string | $code | the contents of the version.php file |
- Return values
-
string|bool | declared plugin component or false if unable to detect |
◆ encode_site_information()
tool_installaddon_installer::encode_site_information |
( |
array |
$info | ) |
|
|
protected |
Encodes the given array in a way that can be safely appended as HTTP GET param.
Be ware! The recipient may rely on the exact way how the site information is encoded. Do not change anything here unless you know what you are doing and understand all consequences! (Don't you love warnings like that, too? :-p)
- Parameters
-
- Return values
-
◆ extract_versionphp_file()
tool_installaddon_installer::extract_versionphp_file |
( |
|
$zipfilepath, |
|
|
|
$targetdir |
|
) |
| |
|
protected |
Extracts the version.php from the given plugin ZIP file into the target directory.
- Parameters
-
string | $zipfilepath | full path to the saved ZIP file |
string | $targetdir | full path to extract the file to |
- Return values
-
string|bool | path to the version.php within the $targetpath; false on error (e.g. not found) |
◆ get_addons_repository_url()
tool_installaddon_installer::get_addons_repository_url |
( |
| ) |
|
Returns URL to the repository that addons can be searched in and installed from.
- Return values
-
◆ get_installfromzip_form()
tool_installaddon_installer::get_installfromzip_form |
( |
| ) |
|
◆ get_plugin_types_menu()
tool_installaddon_installer::get_plugin_types_menu |
( |
| ) |
|
Returns localised list of available plugin types.
- Return values
-
array | (string)plugintype => (string)plugin name |
◆ get_site_fullname()
tool_installaddon_installer::get_site_fullname |
( |
| ) |
|
|
protected |
- Return values
-
string | this site full name |
◆ get_site_major_version()
tool_installaddon_installer::get_site_major_version |
( |
| ) |
|
|
protected |
- Return values
-
string | major version like 2.5, 2.6 etc. |
◆ get_site_url()
tool_installaddon_installer::get_site_url |
( |
| ) |
|
|
protected |
◆ handle_remote_request()
Hook method to handle the remote request to install an add-on.
This is used as a callback when the admin picks a plugin version in the Moodle Plugins directory and is redirected back to their site to install it.
This hook is called early from admin/tool/installaddon/index.php page so that it has opportunity to take over the UI and display the first confirmation screen.
- Parameters
-
◆ index_url()
tool_installaddon_installer::index_url |
( |
array |
$params = null | ) |
|
Returns the URL to the main page of this admin tool.
- Parameters
-
- Return values
-
◆ instance()
static tool_installaddon_installer::instance |
( |
| ) |
|
|
static |
Factory method returning an instance of this class.
- Return values
-
◆ make_installfromzip_storage()
tool_installaddon_installer::make_installfromzip_storage |
( |
| ) |
|
Makes a unique writable storage for uploaded ZIP packages.
We need the saved ZIP to survive across multiple requests so that it can be used by the plugin manager after the installation is confirmed. In other words, we cannot use make_request_directory() here.
- Return values
-
string | full path to the directory |
◆ should_send_site_info()
tool_installaddon_installer::should_send_site_info |
( |
| ) |
|
|
protected |
Decide if the encoded site information should be sent to the add-ons repository site.
For now, we just return true. In the future, we may want to implement some privacy aware logic (based on site/user preferences for example).
- Return values
-
The documentation for this class was generated from the following file: