MDL-39854 use classloader in add-on installer tool
This commit is contained in:
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class tool_installaddon_installer {
|
||||
|
||||
/** @var tool_installaddon_installfromzip */
|
||||
/** @var tool_installaddon_installfromzip_form */
|
||||
protected $installfromzipform = null;
|
||||
|
||||
/**
|
||||
@@ -87,12 +87,9 @@ class tool_installaddon_installer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return tool_installaddon_installfromzip
|
||||
* @return tool_installaddon_installfromzip_form
|
||||
*/
|
||||
public function get_installfromzip_form() {
|
||||
global $CFG;
|
||||
require_once(dirname(__FILE__).'/installfromzip_form.php');
|
||||
|
||||
if (!is_null($this->installfromzipform)) {
|
||||
return $this->installfromzipform;
|
||||
}
|
||||
@@ -100,22 +97,22 @@ class tool_installaddon_installer {
|
||||
$action = $this->index_url();
|
||||
$customdata = array('installer' => $this);
|
||||
|
||||
$this->installfromzipform = new tool_installaddon_installfromzip($action, $customdata);
|
||||
$this->installfromzipform = new tool_installaddon_installfromzip_form($action, $customdata);
|
||||
|
||||
return $this->installfromzipform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the ZIP file from the {@link tool_installaddon_installfromzip} form
|
||||
* Saves the ZIP file from the {@link tool_installaddon_installfromzip_form} form
|
||||
*
|
||||
* The file is saved into the given temporary location for inspection and eventual
|
||||
* deployment. The form is expected to be submitted and validated.
|
||||
*
|
||||
* @param tool_installaddon_installfromzip $form
|
||||
* @param tool_installaddon_installfromzip_form $form
|
||||
* @param string $targetdir full path to the directory where the ZIP should be stored to
|
||||
* @return string filename of the saved file relative to the given target
|
||||
*/
|
||||
public function save_installfromzip_file(tool_installaddon_installfromzip $form, $targetdir) {
|
||||
public function save_installfromzip_file(tool_installaddon_installfromzip_form $form, $targetdir) {
|
||||
|
||||
$filename = clean_param($form->get_new_filename('zipfile'), PARAM_FILE);
|
||||
$form->save_file('zipfile', $targetdir.'/'.$filename);
|
||||
|
||||
@@ -33,7 +33,7 @@ require_once($CFG->libdir.'/formslib.php');
|
||||
* @copyright 2013 David Mudrak <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_installaddon_installfromzip extends moodleform {
|
||||
class tool_installaddon_installfromzip_form extends moodleform {
|
||||
|
||||
/**
|
||||
* Defines the form elements
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
require(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once(dirname(__FILE__).'/classes/installer.php');
|
||||
require_once(dirname(__FILE__).'/classes/validator.php');
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
require(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once(dirname(__FILE__).'/classes/installer.php');
|
||||
|
||||
admin_externalpage_setup('tool_installaddon_index');
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ define('AJAX_SCRIPT', true);
|
||||
|
||||
require(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once(dirname(__FILE__).'/classes/installer.php');
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/installaddon/classes/installer.php');
|
||||
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link tool_installaddon_installer} class
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/installaddon/classes/validator.php');
|
||||
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link tool_installaddon_installer} class
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
require(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once(dirname(__FILE__).'/classes/installer.php');
|
||||
require_once(dirname(__FILE__).'/classes/validator.php');
|
||||
|
||||
navigation_node::override_active_url(new moodle_url('/admin/tool/installaddon/index.php'));
|
||||
admin_externalpage_setup('tool_installaddon_validate');
|
||||
|
||||
Reference in New Issue
Block a user