Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

   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   * Log iterator reader interface.
  19   *
  20   * @package    core
  21   * @copyright  2015 David Monllao
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace core\log;
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  /**
  30   * Log iterator reader interface.
  31   *
  32   * Replaces sql_select_reader adding functions
  33   * to return iterators.
  34   *
  35   * @since      Moodle 2.9
  36   * @package    core
  37   * @copyright  2015 David Monllao
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  interface sql_reader extends reader {
  41  
  42      /**
  43       * Fetch records using given criteria.
  44       *
  45       * @param string $selectwhere
  46       * @param array $params
  47       * @param string $sort
  48       * @param int $limitfrom
  49       * @param int $limitnum
  50       * @return \core\event\base[]
  51       */
  52      public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum);
  53  
  54      /**
  55       * Return number of events matching given criteria.
  56       *
  57       * @param string $selectwhere
  58       * @param array $params
  59       * @return int
  60       */
  61      public function get_events_select_count($selectwhere, array $params);
  62  
  63      /**
  64       * Fetch records using the given criteria returning an traversable list of events.
  65       *
  66       * Note that the returned object is Traversable, not Iterator, as we are returning
  67       * EmptyIterator if we know there are no events, and EmptyIterator does not implement
  68       * Countable {@link https://bugs.php.net/bug.php?id=60577} so valid() should be checked
  69       * in any case instead of a count().
  70       *
  71       * Also note that the traversable object contains a recordset and it is very important
  72       * that you close it after using it.
  73       *
  74       * @param string $selectwhere
  75       * @param array $params
  76       * @param string $sort
  77       * @param int $limitfrom
  78       * @param int $limitnum
  79       * @return \Traversable|\core\event\base[] Returns an iterator containing \core\event\base objects.
  80       */
  81      public function get_events_select_iterator($selectwhere, array $params, $sort, $limitfrom, $limitnum);
  82  
  83      /**
  84       * Returns an event from the log data.
  85       *
  86       * @param stdClass $data Log data
  87       * @return \core\event\base
  88       */
  89      public function get_log_event($data);
  90  }