aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/console
diff options
context:
space:
mode:
authorOliver Schramm <oliver.schramm97@gmail.com>2015-10-26 01:39:52 +0100
committerOliver Schramm <oliver.schramm97@gmail.com>2015-10-26 01:39:52 +0100
commit25e2b17837f5b1c2330d07a86f88b25bb55d96c1 (patch)
tree565d21196a663847f932e1e9b5907c4015f54313 /phpBB/phpbb/console
parent33500fd3728f6e3444d5479b09b941b2570ff47c (diff)
downloadforums-25e2b17837f5b1c2330d07a86f88b25bb55d96c1.tar
forums-25e2b17837f5b1c2330d07a86f88b25bb55d96c1.tar.gz
forums-25e2b17837f5b1c2330d07a86f88b25bb55d96c1.tar.bz2
forums-25e2b17837f5b1c2330d07a86f88b25bb55d96c1.tar.xz
forums-25e2b17837f5b1c2330d07a86f88b25bb55d96c1.zip
[ticket/14257] Add text_reparser manager
PHPBB3-14257
Diffstat (limited to 'phpBB/phpbb/console')
-rw-r--r--phpBB/phpbb/console/command/reparser/reparse.php54
1 files changed, 10 insertions, 44 deletions
diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php
index 6fac3db854..575e447a78 100644
--- a/phpBB/phpbb/console/command/reparser/reparse.php
+++ b/phpBB/phpbb/console/command/reparser/reparse.php
@@ -23,11 +23,6 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class reparse extends \phpbb\console\command\command
{
/**
- * @var \phpbb\config\db_text
- */
- protected $config_text;
-
- /**
* @var InputInterface
*/
protected $input;
@@ -48,6 +43,11 @@ class reparse extends \phpbb\console\command\command
protected $reparse_lock;
/**
+ * @var \phpbb\textreparser\manager
+ */
+ protected $reparser_manager;
+
+ /**
* @var \phpbb\di\service_collection
*/
protected $reparsers;
@@ -65,13 +65,13 @@ class reparse extends \phpbb\console\command\command
* @param \phpbb\config\db_text $config_text
* @param \phpbb\lock\db $reparse_lock
*/
- public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers, \phpbb\config\db_text $config_text, \phpbb\lock\db $reparse_lock)
+ public function __construct(\phpbb\user $user, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers)
{
require_once __DIR__ . '/../../../../includes/functions_content.php';
- $this->config_text = $config_text;
- $this->reparsers = $reparsers;
$this->reparse_lock = $reparse_lock;
+ $this->reparser_manager = $reparser_manager;
+ $this->reparsers = $reparsers;
parent::__construct($user);
}
@@ -177,8 +177,6 @@ class reparse extends \phpbb\console\command\command
throw new runtime_exception('REPARSE_LOCK_ERROR', array(), null, 1);
}
- $this->load_resume_data();
-
$name = $input->getArgument('reparser-name');
if (isset($name))
{
@@ -234,15 +232,6 @@ class reparse extends \phpbb\console\command\command
}
/**
- * Load the resume data from the database
- */
- protected function load_resume_data()
- {
- $resume_data = $this->config_text->get('reparser_resume');
- $this->resume_data = (empty($resume_data)) ? array() : unserialize($resume_data);
- }
-
- /**
* Reparse all text handled by given reparser within given range
*
* @param string $name Reparser name
@@ -250,6 +239,7 @@ class reparse extends \phpbb\console\command\command
protected function reparse($name)
{
$reparser = $this->reparsers[$name];
+ $this->resume_data = $this->reparser_manager->get_resume_data($name);
if ($this->input->getOption('dry-run'))
{
$reparser->disable_save();
@@ -288,34 +278,10 @@ class reparse extends \phpbb\console\command\command
$current = $start - 1;
$progress->setProgress($max + 1 - $start);
- $this->update_resume_data($name, $current);
+ $this->reparser_manager->update_resume_data($name, $min, $current, $size, !$this->input->getOption('dry-run'));
}
$progress->finish();
$this->io->newLine(2);
}
-
- /**
- * Save the resume data to the database
- */
- protected function save_resume_data()
- {
- $this->config_text->set('reparser_resume', serialize($this->resume_data));
- }
-
- /**
- * Save the resume data to the database
- *
- * @param string $name Reparser name
- * @param string $current Current ID
- */
- protected function update_resume_data($name, $current)
- {
- $this->resume_data[$name] = array(
- 'range-min' => $this->get_option($name, 'range-min'),
- 'range-max' => $current,
- 'range-size' => $this->get_option($name, 'range-size'),
- );
- $this->save_resume_data();
- }
}