aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-05-28 14:16:11 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-05-28 14:16:11 +0200
commit615761fdf160be9339a80c3945ae1297976c1a1e (patch)
treee1fef2e166bdef34a3d16f73f54de775aa862a82 /phpBB/phpbb/event
parenta8ec353a4f3595781523903a615c2148081c7fb4 (diff)
parentef39f3a9ab1985d78ffa368b210af9ab638cbae8 (diff)
downloadforums-615761fdf160be9339a80c3945ae1297976c1a1e.tar
forums-615761fdf160be9339a80c3945ae1297976c1a1e.tar.gz
forums-615761fdf160be9339a80c3945ae1297976c1a1e.tar.bz2
forums-615761fdf160be9339a80c3945ae1297976c1a1e.tar.xz
forums-615761fdf160be9339a80c3945ae1297976c1a1e.zip
Merge branch '3.1.x'
Diffstat (limited to 'phpBB/phpbb/event')
-rw-r--r--phpBB/phpbb/event/md_exporter.php89
-rw-r--r--phpBB/phpbb/event/php_exporter.php1
2 files changed, 87 insertions, 3 deletions
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php
index 05e898a157..e042d0a5d1 100644
--- a/phpBB/phpbb/event/md_exporter.php
+++ b/phpBB/phpbb/event/md_exporter.php
@@ -157,20 +157,64 @@ class md_exporter
}
list($file_details, $details) = explode("\n* Since: ", $details, 2);
- list($since, $description) = explode("\n* Purpose: ", $details, 2);
+
+ $changed_versions = array();
+ if (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($since, $details) = explode("\n* Changed: ", $details, 2);
+ while (strpos($details, "\n* Changed: ") !== false)
+ {
+ list($changed, $details) = explode("\n* Changed: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ list($changed, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions[] = $changed;
+ }
+ else
+ {
+ list($since, $description) = explode("\n* Purpose: ", $details, 2);
+ $changed_versions = array();
+ }
$files = $this->validate_file_list($file_details);
$since = $this->validate_since($since);
+ $changes = array();
+ foreach ($changed_versions as $changed)
+ {
+ list($changed_version, $changed_description) = $this->validate_changed($changed);
+
+ if (isset($changes[$changed_version]))
+ {
+ throw new \LogicException("Duplicate change information found for event '{$this->current_event}'");
+ }
+
+ $changes[$changed_version] = $changed_description;
+ }
+ $description = trim($description, "\n") . "\n";
if (!$this->version_is_filtered($since))
{
- continue;
+ $is_filtered = false;
+ foreach ($changes as $version => $null)
+ {
+ if ($this->version_is_filtered($version))
+ {
+ $is_filtered = true;
+ break;
+ }
+ }
+
+ if (!$is_filtered)
+ {
+ continue;
+ }
}
$this->events[$event_name] = array(
'event' => $this->current_event,
'files' => $files,
'since' => $since,
+ 'changed' => $changes,
'description' => $description,
);
}
@@ -182,6 +226,7 @@ class md_exporter
* The version to check
*
* @param string $version
+ * @return bool
*/
protected function version_is_filtered($version)
{
@@ -269,7 +314,7 @@ class md_exporter
*/
public function validate_since($since)
{
- if (!preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $since))
+ if (!$this->validate_version($since))
{
throw new \LogicException("Invalid since information found for event '{$this->current_event}'");
}
@@ -278,6 +323,44 @@ class md_exporter
}
/**
+ * Validate "Changed" Information
+ *
+ * @param string $changed
+ * @return string
+ * @throws \LogicException
+ */
+ public function validate_changed($changed)
+ {
+ if (strpos($changed, ' ') !== false)
+ {
+ list($version, $description) = explode(' ', $changed, 2);
+ }
+ else
+ {
+ $version = $changed;
+ $description = '';
+ }
+
+ if (!$this->validate_version($version))
+ {
+ throw new \LogicException("Invalid changed information found for event '{$this->current_event}'");
+ }
+
+ return array($version, $description);
+ }
+
+ /**
+ * Validate "version" Information
+ *
+ * @param string $version
+ * @return bool True if valid, false otherwise
+ */
+ public function validate_version($version)
+ {
+ return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version);
+ }
+
+ /**
* Validate the files list
*
* @param string $file_details
diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php
index 8cffa4620f..d2ab0595c0 100644
--- a/phpBB/phpbb/event/php_exporter.php
+++ b/phpBB/phpbb/event/php_exporter.php
@@ -293,6 +293,7 @@ class php_exporter
* The version to check
*
* @param string $version
+ * @return bool
*/
protected function version_is_filtered($version)
{