Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
 public function testable_decode_remote_request($request)
 {
     return parent::decode_remote_request($request);
 }
Ejemplo n.º 4
0
$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'));
}
Ejemplo n.º 5
0
 public function detect_plugin_component_from_versionphp($code)
 {
     return parent::detect_plugin_component_from_versionphp($code);
 }