���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/backup.tar
���ѧ٧ѧ�
moodle2/restore_activity_results_block_task.class.php 0000644 00000010024 15151264633 0017301 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Define all the backup steps that will be used by the backup_block_task * @package block_activity_results * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @copyright 2015 Stephen Bourget * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Specialised restore task for the activity_results block * (using execute_after_tasks for recoding of target activity) * * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_activity_results_block_task extends restore_block_task { /** * Define (add) particular settings this activity can have */ protected function define_my_settings() { } /** * Define (add) particular steps this activity can have */ protected function define_my_steps() { } /** * Define the associated file areas */ public function get_fileareas() { return array(); // No associated fileareas. } /** * Define special handling of configdata. */ public function get_configdata_encoded_attributes() { return array(); // No special handling of configdata. } /** * This function, executed after all the tasks in the plan * have been executed, will perform the recode of the * target activity for the block. This must be done here * and not in normal execution steps because the activity * can be restored after the block. */ public function after_restore() { global $DB; // Get the blockid. $blockid = $this->get_blockid(); if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) { $config = $this->decode_configdata($configdata); if (!empty($config->activityparentid)) { // Get the mapping and replace it in config. if ($mapping = restore_dbops::get_backup_ids_record($this->get_restoreid(), $config->activityparent, $config->activityparentid)) { // Update the parent module id (the id from mdl_quiz etc...) $config->activityparentid = $mapping->newitemid; // Get the grade_items record to update the activitygradeitemid. $info = $DB->get_record('grade_items', array('iteminstance' => $config->activityparentid, 'itemmodule' => $config->activityparent)); // Update the activitygradeitemid the id from the grade_items table. $config->activitygradeitemid = $info->id; // Encode and save the config. $configdata = base64_encode(serialize($config)); $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid)); } } } } /** * Define the contents in the activity that must be * processed by the link decoder */ static public function define_decode_contents() { return array(); } /** * Define the decoding rules for links belonging * to the activity to be executed by the link decoder */ static public function define_decode_rules() { return array(); } } moodle2/restore_url_activity_task.class.php 0000644 00000007333 15152011443 0015227 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package mod_url * @subpackage backup-moodle2 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/mod/url/backup/moodle2/restore_url_stepslib.php'); // Because it exists (must) /** * url restore task that provides all the settings and steps to perform one * complete restore of the activity */ class restore_url_activity_task extends restore_activity_task { /** * Define (add) particular settings this activity can have */ protected function define_my_settings() { // No particular settings for this activity } /** * Define (add) particular steps this activity can have */ protected function define_my_steps() { // url only has one structure step $this->add_step(new restore_url_activity_structure_step('url_structure', 'url.xml')); } /** * Define the contents in the activity that must be * processed by the link decoder */ static public function define_decode_contents() { $contents = array(); $contents[] = new restore_decode_content('url', array('intro', 'externalurl'), 'url'); return $contents; } /** * Define the decoding rules for links belonging * to the activity to be executed by the link decoder */ static public function define_decode_rules() { $rules = array(); $rules[] = new restore_decode_rule('URLINDEX', '/mod/url/index.php?id=$1', 'course'); $rules[] = new restore_decode_rule('URLVIEWBYID', '/mod/url/view.php?id=$1', 'course_module'); $rules[] = new restore_decode_rule('URLVIEWBYU', '/mod/url/view.php?u=$1', 'url'); return $rules; } /** * Define the restore log rules that will be applied * by the {@link restore_logs_processor} when restoring * url logs. It must return one array * of {@link restore_log_rule} objects */ static public function define_restore_log_rules() { $rules = array(); $rules[] = new restore_log_rule('url', 'add', 'view.php?id={course_module}', '{url}'); $rules[] = new restore_log_rule('url', 'update', 'view.php?id={course_module}', '{url}'); $rules[] = new restore_log_rule('url', 'view', 'view.php?id={course_module}', '{url}'); return $rules; } /** * Define the restore log rules that will be applied * by the {@link restore_logs_processor} when restoring * course logs. It must return one array * of {@link restore_log_rule} objects * * Note this rules are applied when restoring course logs * by the restore final task, but are defined here at * activity level. All them are rules not linked to any module instance (cmid = 0) */ static public function define_restore_log_rules_for_course() { $rules = array(); $rules[] = new restore_log_rule('url', 'view all', 'index.php?id={course}', null); return $rules; } } moodle2/backup_url_stepslib.php 0000644 00000003661 15152011443 0012654 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Define all the backup steps that will be used by the backup_url_activity_task * * @package mod_url * @copyright 2010 onwards Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; /** * Define the complete url structure for backup, with file and id annotations */ class backup_url_activity_structure_step extends backup_activity_structure_step { protected function define_structure() { //the URL module stores no user info // Define each element separated $url = new backup_nested_element('url', array('id'), array( 'name', 'intro', 'introformat', 'externalurl', 'display', 'displayoptions', 'parameters', 'timemodified')); // Build the tree //nothing here for URLs // Define sources $url->set_source_table('url', array('id' => backup::VAR_ACTIVITYID)); // Define id annotations //module has no id annotations // Define file annotations $url->annotate_files('mod_url', 'intro', null); // This file area hasn't itemid // Return the root element (url), wrapped into standard activity structure return $this->prepare_activity_structure($url); } } moodle2/restore_url_stepslib.php 0000644 00000004146 15152011443 0013071 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package mod_url * @subpackage backup-moodle2 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Define all the restore steps that will be used by the restore_url_activity_task */ /** * Structure step to restore one url activity */ class restore_url_activity_structure_step extends restore_activity_structure_step { protected function define_structure() { $paths = array(); $paths[] = new restore_path_element('url', '/activity/url'); // Return the paths wrapped into standard activity structure return $this->prepare_activity_structure($paths); } protected function process_url($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->course = $this->get_courseid(); // Any changes to the list of dates that needs to be rolled should be same during course restore and course reset. // See MDL-9367. // insert the url record $newitemid = $DB->insert_record('url', $data); // immediately after inserting "activity" record, call this $this->apply_activity_instance($newitemid); } protected function after_execute() { // Add url related files, no need to match by itemname (just internally handled context) $this->add_related_files('mod_url', 'intro', null); } } moodle2/backup_url_activity_task.class.php 0000644 00000005072 15152011443 0015007 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Defines backup_url_activity_task class * * @package mod_url * @category backup * @copyright 2010 onwards Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot . '/mod/url/backup/moodle2/backup_url_stepslib.php'); /** * Provides all the settings and steps to perform one complete backup of the activity */ class backup_url_activity_task extends backup_activity_task { /** * No specific settings for this activity */ protected function define_my_settings() { } /** * Defines a backup step to store the instance data in the url.xml file */ protected function define_my_steps() { $this->add_step(new backup_url_activity_structure_step('url_structure', 'url.xml')); } /** * Encodes URLs to the index.php and view.php scripts * * @param string $content some HTML text that eventually contains URLs to the activity instance scripts * @return string the content with the URLs encoded */ static public function encode_content_links($content) { global $CFG; $base = preg_quote($CFG->wwwroot.'/mod/url','#'); //Access a list of all links in a course $pattern = '#('.$base.'/index\.php\?id=)([0-9]+)#'; $replacement = '$@URLINDEX*$2@$'; $content = preg_replace($pattern, $replacement, $content); //Access the link supplying a course module id $pattern = '#('.$base.'/view\.php\?id=)([0-9]+)#'; $replacement = '$@URLVIEWBYID*$2@$'; $content = preg_replace($pattern, $replacement, $content); //Access the link supplying an instance id $pattern = '#('.$base.'/view\.php\?u=)([0-9]+)#'; $replacement = '$@URLVIEWBYU*$2@$'; $content = preg_replace($pattern, $replacement, $content); return $content; } } moodle1/lib.php 0000644 00000010721 15152011443 0007360 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Provides support for the conversion of moodle1 backup to the moodle2 format * * @package mod_url * @copyright 2011 Andrew Davis <andrew@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * URL conversion handler. This resource handler is called by moodle1_mod_resource_handler */ class moodle1_mod_url_handler extends moodle1_resource_successor_handler { /** @var moodle1_file_manager instance */ protected $fileman = null; /** * Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/RESOURCE data * Called by moodle1_mod_resource_handler::process_resource() */ public function process_legacy_resource(array $data, array $raw = null) { // get the course module id and context id $instanceid = $data['id']; $cminfo = $this->get_cminfo($instanceid, 'resource'); $moduleid = $cminfo['id']; $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid); // prepare the new url instance record $url = array(); $url['id'] = $data['id']; $url['name'] = $data['name']; $url['intro'] = $data['intro']; $url['introformat'] = $data['introformat']; $url['externalurl'] = $data['reference']; $url['timemodified'] = $data['timemodified']; // populate display and displayoptions fields $options = array('printintro' => 1); if ($data['options'] == 'frame') { $url['display'] = RESOURCELIB_DISPLAY_FRAME; } else if ($data['options'] == 'objectframe') { $url['display'] = RESOURCELIB_DISPLAY_EMBED; } else if ($data['popup']) { $url['display'] = RESOURCELIB_DISPLAY_POPUP; $rawoptions = explode(',', $data['popup']); foreach ($rawoptions as $rawoption) { list($name, $value) = explode('=', trim($rawoption), 2); if ($value > 0 and ($name == 'width' or $name == 'height')) { $options['popup'.$name] = $value; continue; } } } else { $url['display'] = RESOURCELIB_DISPLAY_AUTO; } $url['displayoptions'] = serialize($options); // populate the parameters field $parameters = array(); if ($data['alltext']) { $rawoptions = explode(',', $data['alltext']); foreach ($rawoptions as $rawoption) { list($variable, $parameter) = explode('=', trim($rawoption), 2); $parameters[$parameter] = $variable; } } $url['parameters'] = serialize($parameters); // convert course files embedded into the intro $this->fileman = $this->converter->get_file_manager($contextid, 'mod_url', 'intro'); $url['intro'] = moodle1_converter::migrate_referenced_files($url['intro'], $this->fileman); // write url.xml $this->open_xml_writer("activities/url_{$moduleid}/url.xml"); $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $moduleid, 'modulename' => 'url', 'contextid' => $contextid)); $this->write_xml('url', $url, array('/url/id')); $this->xmlwriter->end_tag('activity'); $this->close_xml_writer(); // write inforef.xml $this->open_xml_writer("activities/url_{$moduleid}/inforef.xml"); $this->xmlwriter->begin_tag('inforef'); $this->xmlwriter->begin_tag('fileref'); foreach ($this->fileman->get_fileids() as $fileid) { $this->write_xml('file', array('id' => $fileid)); } $this->xmlwriter->end_tag('fileref'); $this->xmlwriter->end_tag('inforef'); $this->close_xml_writer(); } } moodle2/restore_glossary_random_block_task.class.php 0000644 00000007151 15152065107 0017072 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package block_glossary_random * @subpackage backup-moodle2 * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Specialised restore task for the glossary_random block * (using execute_after_tasks for recoding of glossaryid) * * TODO: Finish phpdocs */ class restore_glossary_random_block_task extends restore_block_task { protected function define_my_settings() { } protected function define_my_steps() { } public function get_fileareas() { return array(); // No associated fileareas } public function get_configdata_encoded_attributes() { return array(); // No special handling of configdata } /** * This function, executed after all the tasks in the plan * have been executed, will perform the recode of the * target glossary for the block. This must be done here * and not in normal execution steps because the glossary * may be restored after the block. */ public function after_restore() { global $DB; // Get the blockid $blockid = $this->get_blockid(); // Extract block configdata and update it to point to the new glossary if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) { $config = $this->decode_configdata($configdata); if (!empty($config->glossary)) { if ($glossarymap = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary', $config->glossary)) { // Get glossary mapping and replace it in config $config->glossary = $glossarymap->newitemid; } else if ($this->is_samesite()) { // We are restoring on the same site, check if glossary can be used in the block in this course. $glossaryid = $DB->get_field_sql("SELECT id FROM {glossary} " . "WHERE id = ? AND (course = ? OR globalglossary = 1)", [$config->glossary, $this->get_courseid()]); if (!$glossaryid) { unset($config->glossary); } } else { // The block refers to a glossary not present in the backup file. unset($config->glossary); } // Unset config variables that are no longer used. unset($config->globalglossary); unset($config->courseid); // Save updated config. $configdata = base64_encode(serialize($config)); $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid)); } } } static public function define_decode_contents() { return array(); } static public function define_decode_rules() { return array(); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�