mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/13807] Allow filtering template events
PHPBB3-13807
This commit is contained in:
parent
e0180991bf
commit
bdad879508
1 changed files with 27 additions and 1 deletions
|
@ -24,6 +24,12 @@ class md_exporter
|
||||||
/** @var string phpBB Root Path */
|
/** @var string phpBB Root Path */
|
||||||
protected $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 */
|
/** @var string */
|
||||||
protected $filter;
|
protected $filter;
|
||||||
|
|
||||||
|
@ -36,8 +42,10 @@ class md_exporter
|
||||||
/**
|
/**
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param mixed $extension String 'vendor/ext' to filter, null for phpBB core
|
* @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->root_path = $phpbb_root_path;
|
||||||
$this->path = $this->root_path;
|
$this->path = $this->root_path;
|
||||||
|
@ -49,6 +57,8 @@ class md_exporter
|
||||||
$this->events = array();
|
$this->events = array();
|
||||||
$this->events_by_file = array();
|
$this->events_by_file = array();
|
||||||
$this->filter = $this->current_event = '';
|
$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);
|
$files = $this->validate_file_list($file_details);
|
||||||
$since = $this->validate_since($since);
|
$since = $this->validate_since($since);
|
||||||
|
|
||||||
|
if (!$this->version_is_filtered($since))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->events[$event_name] = array(
|
$this->events[$event_name] = array(
|
||||||
'event' => $this->current_event,
|
'event' => $this->current_event,
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
|
@ -163,6 +178,17 @@ class md_exporter
|
||||||
return sizeof($this->events);
|
return sizeof($this->events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Format the php events as a wiki table
|
||||||
* @return string Number of events found
|
* @return string Number of events found
|
||||||
|
|
Loading…
Add table
Reference in a new issue