[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/backup/controller/ -> base_controller.class.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Base class with shared stuff between backup controller and restore
  19   * controller.
  20   *
  21   * @package core_backup
  22   * @copyright 2013 The Open University
  23   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  abstract class base_controller extends backup implements loggable {
  26      /**
  27       * @var \core\progress\base Progress reporting object.
  28       */
  29      protected $progress;
  30  
  31      /**
  32       * @var base_logger Logging chain object (moodle, inline, fs, db, syslog)
  33       */
  34      protected $logger;
  35  
  36      /**
  37       * Gets the progress reporter, which can be used to report progress within
  38       * the backup or restore process.
  39       *
  40       * @return \core\progress\base Progress reporting object
  41       */
  42      public function get_progress() {
  43          return $this->progress;
  44      }
  45  
  46      /**
  47       * Sets the progress reporter.
  48       *
  49       * @param \core\progress\base $progress Progress reporting object
  50       */
  51      public function set_progress(\core\progress\base $progress) {
  52          $this->progress = $progress;
  53      }
  54  
  55      /**
  56       * Gets first logger in logging chain.
  57       *
  58       * @return base_logger Logger
  59       */
  60      public function get_logger() {
  61          return $this->logger;
  62      }
  63  
  64      /**
  65       * Inserts a new logger at end of logging chain.
  66       *
  67       * @param base_logger $logger New logger to add
  68       */
  69      public function add_logger(base_logger $logger) {
  70          $existing = $this->logger;
  71          while ($existing->get_next()) {
  72              $existing = $existing->get_next();
  73          }
  74          $existing->set_next($logger);
  75      }
  76  
  77      /**
  78       * Logs data to the logger chain.
  79       *
  80       * @see loggable::log()
  81       */
  82      public function log($message, $level, $a = null, $depth = null, $display = false) {
  83          backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
  84      }
  85  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1