/** * Renders the widget for uploading the add-on ZIP package * * @return string */ protected function index_page_upload() { $form = $this->installer->get_installfromzip_form(); ob_start(); $form->display(); $out = ob_get_clean(); $out = $this->box($out, 'generalbox', 'installfromzipbox'); return $out; }
public function test_detect_plugin_component() { global $CFG; $installer = tool_installaddon_installer::instance(); $zipfile = $CFG->libdir . '/tests/fixtures/update_validator/zips/bar.zip'; $this->assertEquals('foo_bar', $installer->detect_plugin_component($zipfile)); $zipfile = $CFG->libdir . '/tests/fixtures/update_validator/zips/invalidroot.zip'; $this->assertFalse($installer->detect_plugin_component($zipfile)); }
public function testable_decode_remote_request($request) { return parent::decode_remote_request($request); }
$zipcontentpath = $CFG->tempdir.'/tool_installaddon/'.$jobid.'/contents'; if (!is_dir($zipcontentpath)) { debugging('Invalid location of the extracted ZIP package: '.s($zipcontentpath), DEBUG_DEVELOPER); redirect(new moodle_url('/admin/tool/installaddon/index.php'), get_string('invaliddata', 'core_error')); } if (!is_dir($zipcontentpath.'/'.$pluginname)) { debugging('Invalid location of the plugin root directory: '.$zipcontentpath.'/'.$pluginname, DEBUG_DEVELOPER); redirect(new moodle_url('/admin/tool/installaddon/index.php'), get_string('invaliddata', 'core_error')); } $installer = tool_installaddon_installer::instance(); if (!$installer->is_plugintype_writable($plugintype)) { debugging('Plugin type location not writable', DEBUG_DEVELOPER); redirect(new moodle_url('/admin/tool/installaddon/index.php'), get_string('invaliddata', 'core_error')); } $plugintypepath = $installer->get_plugintype_root($plugintype); if (file_exists($plugintypepath.'/'.$pluginname)) { debugging('Target location already exists', DEBUG_DEVELOPER); redirect(new moodle_url('/admin/tool/installaddon/index.php'), get_string('invaliddata', 'core_error')); }
public function detect_plugin_component_from_versionphp($code) { return parent::detect_plugin_component_from_versionphp($code); }