Skip to content
Snippets Groups Projects
Select Git revision
  • f9dd6b398b98a5532aad1875b45fde95d34e4967
  • master default protected
2 results

monitoring-exitcodes.sls

Blame
  • restore_lifecycle_workflow.php 8.58 KiB
    <?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/>.
    
    /**
     * Class to restore a workflow.
     * @package    tool_lifecycle
     * @copyright  2017 Tobias Reischmann WWU
     * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    namespace tool_lifecycle\local\backup;
    
    use tool_lifecycle\local\entity\step_subplugin;
    use tool_lifecycle\local\entity\trigger_subplugin;
    use tool_lifecycle\local\entity\workflow;
    use tool_lifecycle\local\manager\workflow_manager;
    use tool_lifecycle\local\manager\step_manager;
    use tool_lifecycle\local\manager\trigger_manager;
    use tool_lifecycle\local\manager\settings_manager;
    use tool_lifecycle\settings_type;
    
    defined('MOODLE_INTERNAL') || die();
    
    /**
     * Class to restore a workflow.
     * @package    tool_lifecycle
     * @copyright  2017 Tobias Reischmann WWU
     * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    class restore_lifecycle_workflow {
    
        /** @var $workflow workflow */
        private $workflow;
        /** @var $steps step_subplugin[] */
        private $steps = [];
        /** @var $trigger trigger_subplugin[] */
        private $trigger = [];
        /** @var $settings array */
        private $settings = [];
        /** @var $errors string[] errors that occurred during restore.*/
        private $errors = [];
        /** @var $writer \XMLWriter */
        private $reader;
    
        /**
         * Restore_lifecycle_workflow constructor.
         * @param string $xmldata XML-Data the workflow should be restored from.
         */
        public function __construct($xmldata) {
            $this->reader = new \XMLReader();
            $this->reader->XML($xmldata);
    
        }
    
        /**
         * Executes the restore process. It loads the workflow with all steps and triggers from the xml data.
         * If all data is valid, it restores the workflow with all subplugins and settings.
         * Otherwise an array with error strings is returned.