aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textreparser/base.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-07-06 01:43:43 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-07-06 23:45:20 +0200
commit7ccb6389124c5e990abaa917a6684fc3f4d072db (patch)
tree41ed0ef6d95a77643f0499b34fdc81364e05505a /phpBB/phpbb/textreparser/base.php
parentca5d4fd31031a47cc3a485457473b82660b84ed1 (diff)
downloadforums-7ccb6389124c5e990abaa917a6684fc3f4d072db.tar
forums-7ccb6389124c5e990abaa917a6684fc3f4d072db.tar.gz
forums-7ccb6389124c5e990abaa917a6684fc3f4d072db.tar.bz2
forums-7ccb6389124c5e990abaa917a6684fc3f4d072db.tar.xz
forums-7ccb6389124c5e990abaa917a6684fc3f4d072db.zip
[ticket/13987] Add --dry-run option to reparser CLI
PHPBB3-13987
Diffstat (limited to 'phpBB/phpbb/textreparser/base.php')
-rw-r--r--phpBB/phpbb/textreparser/base.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/phpBB/phpbb/textreparser/base.php b/phpBB/phpbb/textreparser/base.php
index ed6c2376c7..6a366d659b 100644
--- a/phpBB/phpbb/textreparser/base.php
+++ b/phpBB/phpbb/textreparser/base.php
@@ -170,20 +170,21 @@ abstract class base implements reparser_interface
/**
* {@inheritdoc}
*/
- public function reparse_range($min_id, $max_id)
+ public function reparse_range($min_id, $max_id, $dry_run = false)
{
foreach ($this->get_records_by_range($min_id, $max_id) as $record)
{
- $this->reparse_record($record);
+ $this->reparse_record($record, $dry_run);
}
}
/**
* Reparse given record
*
- * @param array $record Associative array containing the record's data
+ * @param array $record Associative array containing the record's data
+ * @param integer $dry_run If TRUE, do not save the changes
*/
- protected function reparse_record(array $record)
+ protected function reparse_record(array $record, $dry_run)
{
$record = $this->add_missing_fields($record);
$flags = ($record['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0;
@@ -212,8 +213,8 @@ abstract class base implements reparser_interface
$unparsed['enable_url_bbcode']
);
- // Save the new text if it has changed
- if ($text !== $record['text'])
+ // Save the new text if it has changed and it's not a dry run
+ if ($text !== $record['text'] && !$dry_run)
{
$record['text'] = $text;
$this->save_record($record);