protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
        global $CFG;

        foreach ($files as $file => $status) {
            if ($status !== true) {
                throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
            }

            $source = $sourcedir.'/'.$file;
            $target = $targetdir.'/'.$file;

            if (is_dir($source)) {
                continue;

            } else {
                if (!is_dir(dirname($target))) {
                    mkdir(dirname($target), $CFG->directorypermissions, true);
                }
                rename($source, $target);
            }
        }
    }
protected function move_extracted_plugin_files($sourcedir, $targetdir, array $files) {
        global $CFG;

        foreach ($files as $file => $status) {
            if ($status !== true) {
                throw new moodle_exception('corrupted_archive_structure', 'core_plugin', '', $file, $status);
            }

            $source = $sourcedir.'/'.$file;
            $target = $targetdir.'/'.$file;

            if (is_dir($source)) {
                continue;

            } else {
                if (!is_dir(dirname($target))) {
                    mkdir(dirname($target), $CFG->directorypermissions, true);
                }
                rename($source, $target);
            }
        }
    }
protected function move_extracted_plugin_files ( $ sourcedir , $ targetdir , array $ files ) { global $ CFG ; foreach ( $ files as $ file => $ status ) { if ( $ status !== true ) { throw new moodle_exception ( 'corrupted_archive_structure' , 'core_plugin' , '' , $ file , $ status ) ; } $ source = $ sourcedir . '/' . $ file ; $ target = $ targetdir . '/' . $ file ; if ( is_dir ( $ source ) ) { continue ; } else { if ( ! is_dir ( dirname ( $ target ) ) ) { mkdir ( dirname ( $ target ) , $ CFG -> directorypermissions , true ) ; } rename ( $ source , $ target ) ; } } }
Moves the extracted contents of the plugin ZIP into the target location.

@param string $sourcedir full path to the directory the ZIP file was extracted to
@param mixed $targetdir full path to the directory where the files should be moved to
@param array $files list of extracted files
Moves the extracted contents of the plugin ZIP into the target location .