aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-05-02 14:32:14 +0200
committerJoas Schilling <nickvergessen@gmx.de>2015-05-02 14:35:26 +0200
commitbdad879508d7d3d36119d0d106682c213ff61f35 (patch)
tree3619f50b41ded4591535be1924d26418910f9268 /phpBB/phpbb
parente0180991bfb2d1b3fe6c01065f1741ff77948aa2 (diff)
downloadforums-bdad879508d7d3d36119d0d106682c213ff61f35.tar
forums-bdad879508d7d3d36119d0d106682c213ff61f35.tar.gz
forums-bdad879508d7d3d36119d0d106682c213ff61f35.tar.bz2
forums-bdad879508d7d3d36119d0d106682c213ff61f35.tar.xz
forums-bdad879508d7d3d36119d0d106682c213ff61f35.zip
[ticket/13807] Allow filtering template events
PHPBB3-13807
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/event/md_exporter.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php
index f7021875f3..d5de56525a 100644
--- a/phpBB/phpbb/event/md_exporter.php
+++ b/phpBB/phpbb/event/md_exporter.php
@@ -24,6 +24,12 @@ class md_exporter
/** @var string phpBB Root Path */
protected $root_path;
+ /** @var string The minimum version for the events to return */
+ protected $min_version;
+
+ /** @var string The maximum version for the events to return */
+ protected $max_version;
+
/** @var string */
protected $filter;
@@ -36,8 +42,10 @@ class md_exporter
/**
* @param string $phpbb_root_path
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
+ * @param string $min_version
+ * @param string $max_version
*/
- public function __construct($phpbb_root_path, $extension = null)
+ public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null)
{
$this->root_path = $phpbb_root_path;
$this->path = $this->root_path;
@@ -49,6 +57,8 @@ class md_exporter
$this->events = array();
$this->events_by_file = array();
$this->filter = $this->current_event = '';
+ $this->min_version = $min_version;
+ $this->max_version = $max_version;
}
/**
@@ -152,6 +162,11 @@ class md_exporter
$files = $this->validate_file_list($file_details);
$since = $this->validate_since($since);
+ if (!$this->version_is_filtered($since))
+ {
+ continue;
+ }
+
$this->events[$event_name] = array(
'event' => $this->current_event,
'files' => $files,
@@ -164,6 +179,17 @@ class md_exporter
}
/**
+ * The version to check
+ *
+ * @param string $version
+ */
+ protected function version_is_filtered($version)
+ {
+ return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<='))
+ && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>='));
+ }
+
+ /**
* Format the php events as a wiki table
* @return string Number of events found
*/