See Release Notes
Long Term Support Release
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * @package moodlecore 20 * @subpackage backup-helper 21 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 require_once($CFG->dirroot.'/backup/util/xml/parser/processors/grouped_parser_processor.class.php'); 26 27 /** 28 * helper implementation of grouped_parser_processor that will 29 * return all the information present in the moodle_backup.xml file 30 * accumulating it for later generation of controller->info 31 * 32 * TODO: Complete phpdocs 33 */ 34 class restore_moodlexml_parser_processor extends grouped_parser_processor { 35 36 protected $accumchunks; 37 38 public function __construct() { 39 $this->accumchunks = array(); 40 parent::__construct(); 41 // Let's add all the paths we are interested on 42 $this->add_path('/moodle_backup/information', true); // Everything will be grouped below this 43 $this->add_path('/moodle_backup/information/details/detail'); 44 $this->add_path('/moodle_backup/information/contents/activities/activity'); 45 $this->add_path('/moodle_backup/information/contents/sections/section'); 46 $this->add_path('/moodle_backup/information/contents/course'); 47 $this->add_path('/moodle_backup/information/settings/setting'); 48 } 49 50 protected function dispatch_chunk($data) { 51 $this->accumchunks[] = $data; 52 } 53 54 protected function notify_path_start($path) { 55 // nothing to do 56 } 57 58 protected function notify_path_end($path) { 59 // nothing to do 60 } 61 62 public function get_all_chunks() { 63 return $this->accumchunks; 64 } 65 66 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body