aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/console/command/reparser/reparse.php99
-rw-r--r--phpBB/phpbb/cron/task/text_reparser/reparser.php168
-rw-r--r--phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/announce_global_permission.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/dev.php36
-rw-r--r--phpBB/phpbb/db/migration/data/v320/font_awesome_update.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/icons_alt.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/log_post_id.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/notifications_board.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/text_reparser.php101
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320a1.php44
-rw-r--r--phpBB/phpbb/install/console/command/install/config/show.php2
-rw-r--r--phpBB/phpbb/install/console/command/install/install.php4
-rw-r--r--phpBB/phpbb/install/controller/helper.php2
-rw-r--r--phpBB/phpbb/install/installer.php15
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php2
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php8
-rw-r--r--phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php2
-rw-r--r--phpBB/phpbb/install/module/update_filesystem/task/update_files.php10
-rw-r--r--phpBB/phpbb/textreparser/manager.php128
22 files changed, 579 insertions, 83 deletions
diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php
index 63124b4b8c..ddc97a1d1d 100644
--- a/phpBB/phpbb/console/command/reparser/reparse.php
+++ b/phpBB/phpbb/console/command/reparser/reparse.php
@@ -13,6 +13,7 @@
namespace phpbb\console\command\reparser;
+use phpbb\exception\runtime_exception;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
@@ -22,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;
@@ -42,12 +38,22 @@ class reparse extends \phpbb\console\command\command
protected $output;
/**
+ * @var \phpbb\lock\db
+ */
+ protected $reparse_lock;
+
+ /**
+ * @var \phpbb\textreparser\manager
+ */
+ protected $reparser_manager;
+
+ /**
* @var \phpbb\di\service_collection
*/
protected $reparsers;
/**
- * @var array Reparser names as keys, and their last $current ID as values
+ * @var array The reparser's last $current ID as values
*/
protected $resume_data;
@@ -55,14 +61,16 @@ class reparse extends \phpbb\console\command\command
* Constructor
*
* @param \phpbb\user $user
+ * @param \phpbb\lock\db $reparse_lock
+ * @param \phpbb\textreparser\manager $reparser_manager
* @param \phpbb\di\service_collection $reparsers
- * @param \phpbb\config\db_text $config_text
*/
- public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers, \phpbb\config\db_text $config_text)
+ 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->reparse_lock = $reparse_lock;
+ $this->reparser_manager = $reparser_manager;
$this->reparsers = $reparsers;
parent::__construct($user);
}
@@ -163,7 +171,11 @@ class reparse extends \phpbb\console\command\command
$this->input = $input;
$this->output = $output;
$this->io = new SymfonyStyle($input, $output);
- $this->load_resume_data();
+
+ if (!$this->reparse_lock->acquire())
+ {
+ throw new runtime_exception('REPARSE_LOCK_ERROR', array(), null, 1);
+ }
$name = $input->getArgument('reparser-name');
if (isset($name))
@@ -185,6 +197,8 @@ class reparse extends \phpbb\console\command\command
$this->io->success($this->user->lang('CLI_REPARSER_REPARSE_SUCCESS'));
+ $this->reparse_lock->release();
+
return 0;
}
@@ -194,36 +208,18 @@ class reparse extends \phpbb\console\command\command
* Will use the last saved value if --resume is set and the option was not specified
* on the command line
*
- * @param string $reparser_name Reparser name
* @param string $option_name Option name
* @return integer
*/
- protected function get_option($reparser_name, $option_name)
+ protected function get_option($option_name)
{
// Return the option from the resume_data if applicable
- if ($this->input->getOption('resume') && isset($this->resume_data[$reparser_name][$option_name]) && !$this->input->hasParameterOption('--' . $option_name))
+ if ($this->input->getOption('resume') && isset($this->resume_data[$option_name]) && !$this->input->hasParameterOption('--' . $option_name))
{
- return $this->resume_data[$reparser_name][$option_name];
+ return $this->resume_data[$option_name];
}
- $value = $this->input->getOption($option_name);
-
- // range-max has no default value, it must be computed for each reparser
- if ($option_name === 'range-max' && $value === null)
- {
- $value = $this->reparsers[$reparser_name]->get_max_id();
- }
-
- return $value;
- }
-
- /**
- * 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);
+ return $this->input->getOption($option_name);
}
/**
@@ -234,6 +230,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();
@@ -244,9 +241,15 @@ class reparse extends \phpbb\console\command\command
}
// Start at range-max if specified or at the highest ID otherwise
- $max = $this->get_option($name, 'range-max');
- $min = $this->get_option($name, 'range-min');
- $size = $this->get_option($name, 'range-size');
+ $max = $this->get_option('range-max');
+ $min = $this->get_option('range-min');
+ $size = $this->get_option('range-size');
+
+ // range-max has no default value, it must be computed for each reparser
+ if ($max == null)
+ {
+ $max = $reparser->get_max_id();
+ }
if ($max < $min)
{
@@ -272,34 +275,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();
- }
}
diff --git a/phpBB/phpbb/cron/task/text_reparser/reparser.php b/phpBB/phpbb/cron/task/text_reparser/reparser.php
new file mode 100644
index 0000000000..aa644de827
--- /dev/null
+++ b/phpBB/phpbb/cron/task/text_reparser/reparser.php
@@ -0,0 +1,168 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\cron\task\text_reparser;
+
+/**
+ * Reparse text cron task
+ */
+class reparser extends \phpbb\cron\task\base
+{
+ const MIN = 1;
+ const SIZE = 100;
+
+ /**
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * @var \phpbb\config\db_text
+ */
+ protected $config_text;
+
+ /**
+ * @var \phpbb\lock\db
+ */
+ protected $reparse_lock;
+
+ /**
+ * @var \phpbb\textreparser\manager
+ */
+ protected $reparser_manager;
+
+ /**
+ * @var string
+ */
+ protected $reparser_name;
+
+ /**
+ * @var \phpbb\di\service_collection
+ */
+ protected $reparsers;
+
+ /**
+ * @var array
+ */
+ protected $resume_data;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\config\config $config
+ * @param \phpbb\config\db_text $config_text
+ * @param \phpbb\lock\db $reparse_lock
+ * @param \phpbb\textreparser\manager $reparser_manager
+ * @param \phpbb\di\service_collection $reparsers
+ */
+ public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\lock\db $reparse_lock, \phpbb\textreparser\manager $reparser_manager, \phpbb\di\service_collection $reparsers)
+ {
+ $this->config = $config;
+ $this->config_text = $config_text;
+ $this->reparse_lock = $reparse_lock;
+ $this->reparser_manager = $reparser_manager;
+ $this->reparsers = $reparsers;
+ }
+
+ /**
+ * Sets the reparser for this cron task
+ *
+ * @param string $reparser
+ */
+ public function set_reparser($reparser)
+ {
+ $this->reparser_name = (!isset($this->reparsers[$reparser]) ? 'text_reparser.' : '') . $reparser;
+
+ if ($this->resume_data === null)
+ {
+ $this->reparser_manager->get_resume_data($this->reparser_name);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function is_runnable()
+ {
+ if ($this->resume_data === null)
+ {
+ $this->reparser_manager->get_resume_data($this->reparser_name);
+ }
+
+ if (empty($this->resume_data['range-max']) || $this->resume_data['range-max'] >= $this->resume_data['range-min'])
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function should_run()
+ {
+ if (!empty($this->config['reparse_lock']))
+ {
+ $last_run = explode(' ', $this->config['reparse_lock']);
+
+ if ($last_run[0] + 3600 >= time())
+ {
+ return false;
+ }
+ }
+
+ if ($this->config[$this->reparser_name . '_cron_interval'])
+ {
+ return $this->config[$this->reparser_name . '_last_cron'] < time() - $this->config[$this->reparser_name . '_cron_interval'];
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function run()
+ {
+ if ($this->reparse_lock->acquire())
+ {
+ if ($this->resume_data === null)
+ {
+ $this->resume_data = $this->reparser_manager->get_resume_data($this->reparser_name);
+ }
+
+ /**
+ * @var \phpbb\textreparser\reparser_interface $reparser
+ */
+ $reparser = $this->reparsers[$this->reparser_name];
+
+ $min = !empty($this->resume_data['range-min']) ? $this->resume_data['range-min'] : self::MIN;
+ $current = !empty($this->resume_data['range-max']) ? $this->resume_data['range-max'] : $reparser->get_max_id();
+ $size = !empty($this->resume_data['range-size']) ? $this->resume_data['range-size'] : self::SIZE;
+
+ if ($current >= $min)
+ {
+ $start = max($min, $current + 1 - $size);
+ $end = max($min, $current);
+
+ $reparser->reparse_range($start, $end);
+
+ $this->reparser_manager->update_resume_data($this->reparser_name, $min, $start - 1, $size);
+ }
+
+ $this->config->set($this->reparser_name . '_last_cron', time());
+ $this->reparse_lock->release();
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
index de127e3745..726822bc71 100644
--- a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
+++ b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
@@ -15,6 +15,13 @@ namespace phpbb\db\migration\data\v320;
class allowed_schemes_links extends \phpbb\db\migration\migration
{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function update_data()
{
return array(
diff --git a/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
index fe30a1c1b8..7afecb884b 100644
--- a/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
+++ b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
@@ -29,7 +29,9 @@ class announce_global_permission extends \phpbb\db\migration\migration
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\rc2');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v320/dev.php b/phpBB/phpbb/db/migration/data/v320/dev.php
new file mode 100644
index 0000000000..ad2da3c1f4
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/dev.php
@@ -0,0 +1,36 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v320;
+
+class dev extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-dev', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v316',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-dev')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
index 6ffaf18b4a..817b638037 100644
--- a/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
+++ b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
@@ -15,6 +15,13 @@ namespace phpbb\db\migration\data\v320;
class font_awesome_update extends \phpbb\db\migration\migration
{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function effectively_installed()
{
return isset($this->config['load_font_awesome_url']);
diff --git a/phpBB/phpbb/db/migration/data/v320/icons_alt.php b/phpBB/phpbb/db/migration/data/v320/icons_alt.php
index 7071ae78db..80132e579e 100644
--- a/phpBB/phpbb/db/migration/data/v320/icons_alt.php
+++ b/phpBB/phpbb/db/migration/data/v320/icons_alt.php
@@ -17,7 +17,9 @@ class icons_alt extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\dev');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/log_post_id.php b/phpBB/phpbb/db/migration/data/v320/log_post_id.php
index 0f155d543c..ead53c8138 100644
--- a/phpBB/phpbb/db/migration/data/v320/log_post_id.php
+++ b/phpBB/phpbb/db/migration/data/v320/log_post_id.php
@@ -17,7 +17,9 @@ class log_post_id extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\dev');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
index fd9f1a2ad6..8a76ebab58 100644
--- a/phpBB/phpbb/db/migration/data/v320/notifications_board.php
+++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
@@ -17,7 +17,9 @@ class notifications_board extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\notifications');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
index 59208be4dc..c14d31f1c0 100644
--- a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
+++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
@@ -21,6 +21,13 @@ class remove_outdated_media extends \phpbb\db\migration\migration
ATTACHMENT_CATEGORY_QUICKTIME,
);
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function update_data()
{
return array(
diff --git a/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
index 2898c708f8..1cb9070bf9 100644
--- a/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
+++ b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
@@ -17,7 +17,9 @@ class remove_profilefield_wlm extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\profilefield_wlm');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/text_reparser.php b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
new file mode 100644
index 0000000000..1d73b74a76
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
@@ -0,0 +1,101 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\db\migration\data\v320;
+
+class text_reparser extends \phpbb\db\migration\container_aware_migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\contact_admin_form');
+ }
+
+ public function effectively_installed()
+ {
+ return isset($this->config['reparse_lock']);
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('reparse_lock', 0, true)),
+ array('config.add', array('text_reparser.pm_text_cron_interval', 10)),
+ array('config.add', array('text_reparser.pm_text_last_cron', 0)),
+ array('config.add', array('text_reparser.poll_option_cron_interval', 10)),
+ array('config.add', array('text_reparser.poll_option_last_cron', 0)),
+ array('config.add', array('text_reparser.poll_title_cron_interval', 10)),
+ array('config.add', array('text_reparser.poll_title_last_cron', 0)),
+ array('config.add', array('text_reparser.post_text_cron_interval', 10)),
+ array('config.add', array('text_reparser.post_text_last_cron', 0)),
+ array('config.add', array('text_reparser.user_signature_cron_interval', 10)),
+ array('config.add', array('text_reparser.user_signature_last_cron', 0)),
+ array('custom', array(array($this, 'reparse'))),
+ );
+ }
+
+ public function reparse($resume_data)
+ {
+ // Somtimes a cron job is too much
+ $limit = 100;
+ $fast_reparsers = array(
+ 'text_reparser.contact_admin_info',
+ 'text_reparser.forum_description',
+ 'text_reparser.forum_rules',
+ 'text_reparser.group_description',
+ );
+
+ if (!is_array($resume_data))
+ {
+ $resume_data = array(
+ 'reparser' => 0,
+ 'current' => $this->container->get($fast_reparsers[0])->get_max_id(),
+ );
+ }
+
+ $fast_reparsers_size = sizeof($fast_reparsers);
+ $processed_records = 0;
+ while ($processed_records < $limit && $resume_data['reparser'] < $fast_reparsers_size)
+ {
+ $reparser = $this->container->get($fast_reparsers[$resume_data['reparser']]);
+
+ // New reparser
+ if ($resume_data['current'] === 0)
+ {
+ $resume_data['current'] = $reparser->get_max_id();
+ }
+
+ $start = max(1, $resume_data['current'] + 1 - ($limit - $processed_records));
+ $end = max(1, $resume_data['current']);
+ $reparser->reparse_range($start, $end);
+
+ $processed_records = $end - $start + 1;
+ $resume_data['current'] = $start - 1;
+
+ if ($start === 1)
+ {
+ // Prevent CLI command from running these reparsers again
+ $reparser_manager = $this->container->get('text_reparser.manager');
+ $reparser_manager->update_resume_data($fast_reparsers[$resume_data['reparser']], 1, 0, $limit);
+
+ $resume_data['reparser']++;
+ }
+ }
+
+ if ($resume_data['reparser'] === $fast_reparsers_size)
+ {
+ return true;
+ }
+
+ return $resume_data;
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/v320a1.php b/phpBB/phpbb/db/migration/data/v320/v320a1.php
new file mode 100644
index 0000000000..d7ecb36f90
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320a1.php
@@ -0,0 +1,44 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v320;
+
+class v320a1 extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-a1', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ '\phpbb\db\migration\data\v320\allowed_schemes_links',
+ '\phpbb\db\migration\data\v320\announce_global_permission',
+ '\phpbb\db\migration\data\v320\remove_profilefield_wlm',
+ '\phpbb\db\migration\data\v320\font_awesome_update',
+ '\phpbb\db\migration\data\v320\icons_alt',
+ '\phpbb\db\migration\data\v320\log_post_id',
+ '\phpbb\db\migration\data\v320\remove_outdated_media',
+ '\phpbb\db\migration\data\v320\notifications_board',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-dev')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php
index 4155440fc3..5d82d8d1ef 100644
--- a/phpBB/phpbb/install/console/command/install/config/show.php
+++ b/phpBB/phpbb/install/console/command/install/config/show.php
@@ -96,7 +96,7 @@ class show extends \phpbb\console\command\command
if (!is_file($config_file))
{
- $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
return;
}
diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php
index 81ad1039f6..d76182af92 100644
--- a/phpBB/phpbb/install/console/command/install/install.php
+++ b/phpBB/phpbb/install/console/command/install/install.php
@@ -116,7 +116,7 @@ class install extends \phpbb\console\command\command
if (!is_file($config_file))
{
- $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
return 1;
}
@@ -127,7 +127,7 @@ class install extends \phpbb\console\command\command
}
catch (ParseException $e)
{
- $iohandler->add_error_message('INVALID_YAML_FILE');
+ $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file));
return 1;
}
diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php
index fdb07d9c4a..ed817f7396 100644
--- a/phpBB/phpbb/install/controller/helper.php
+++ b/phpBB/phpbb/install/controller/helper.php
@@ -197,7 +197,7 @@ class helper
$this->language_cookie = $lang;
}
- $lang = (!empty($lang) && strpos($lang, '/')) ? $lang : null;
+ $lang = (!empty($lang) && strpos($lang, '/') === false) ? $lang : null;
$this->render_language_select($lang);
diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php
index 77e0a896bc..a41b4cd6a6 100644
--- a/phpBB/phpbb/install/installer.php
+++ b/phpBB/phpbb/install/installer.php
@@ -13,6 +13,7 @@
namespace phpbb\install;
+use phpbb\cache\driver\driver_interface;
use phpbb\di\ordered_service_collection;
use phpbb\install\exception\installer_config_not_writable_exception;
use phpbb\install\exception\jump_to_restart_point_exception;
@@ -26,6 +27,11 @@ use phpbb\path_helper;
class installer
{
/**
+ * @var driver_interface
+ */
+ protected $cache;
+
+ /**
* @var config
*/
protected $install_config;
@@ -55,11 +61,13 @@ class installer
/**
* Constructor
*
- * @param config $config Installer config handler
- * @param path_helper $path_helper Path helper
+ * @param driver_interface $cache Cache service
+ * @param config $config Installer config handler
+ * @param path_helper $path_helper Path helper
*/
- public function __construct(config $config, path_helper $path_helper)
+ public function __construct(driver_interface $cache, config $config, path_helper $path_helper)
{
+ $this->cache = $cache;
$this->install_config = $config;
$this->installer_modules = null;
$this->web_root = $path_helper->get_web_root_path();
@@ -235,6 +243,7 @@ class installer
if ($install_finished || $fail_cleanup)
{
$this->install_config->clean_up_config_file();
+ $this->cache->purge();
}
else
{
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
index 41616e995a..ac305e8ab5 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
@@ -70,7 +70,7 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta
$admin_name = $this->io_handler->get_input('admin_name', '', true);
$admin_pass1 = $this->io_handler->get_input('admin_pass1', '', true);
$admin_pass2 = $this->io_handler->get_input('admin_pass2', '', true);
- $board_email = $this->io_handler->get_input('board_email', '');
+ $board_email = $this->io_handler->get_input('board_email', '', true);
$admin_data_valid = $this->check_admin_data($admin_name, $admin_pass1, $admin_pass2, $board_email);
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
index 4e977981ce..6c54561d14 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
@@ -76,8 +76,8 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
{
// Board data
$default_lang = $this->io_handler->get_input('default_lang', '');
- $board_name = $this->io_handler->get_input('board_name', '');
- $board_desc = $this->io_handler->get_input('board_description', '');
+ $board_name = $this->io_handler->get_input('board_name', '', true);
+ $board_desc = $this->io_handler->get_input('board_description', '', true);
// Check default lang
$langs = $this->language_helper->get_available_languages();
@@ -116,8 +116,8 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
{
if ($use_request_data)
{
- $board_name = $this->io_handler->get_input('board_name', '');
- $board_desc = $this->io_handler->get_input('board_description', '');
+ $board_name = $this->io_handler->get_input('board_name', '', true);
+ $board_desc = $this->io_handler->get_input('board_description', '', true);
}
else
{
diff --git a/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php b/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php
index 1c6b9aa058..e712b8ad6a 100644
--- a/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php
+++ b/phpBB/phpbb/install/module/update_filesystem/task/show_file_status.php
@@ -100,7 +100,7 @@ class show_file_status extends task_base
{
$this->file_updater->create_new_file(
$filename,
- $this->cache->get('_file_' . md5($filename)),
+ base64_decode($this->cache->get('_file_' . md5($filename))),
true
);
}
diff --git a/phpBB/phpbb/install/module/update_filesystem/task/update_files.php b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
index 747a86281b..fbb465cc66 100644
--- a/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
+++ b/phpBB/phpbb/install/module/update_filesystem/task/update_files.php
@@ -164,20 +164,20 @@ class update_files extends task_base
{
case 'delete':
$this->file_updater->delete_file($path);
- break;
+ break;
case 'new':
$this->file_updater->create_new_file($path, $new_path . $path);
- break;
+ break;
case 'update_without_diff':
$this->file_updater->update_file($path, $new_path . $path);
- break;
+ break;
case 'update_with_diff':
$this->file_updater->update_file(
$path,
- $this->cache->get('_file_' . md5($path)),
+ base64_decode($this->cache->get('_file_' . md5($path))),
true
);
- break;
+ break;
}
// Save progress
diff --git a/phpBB/phpbb/textreparser/manager.php b/phpBB/phpbb/textreparser/manager.php
new file mode 100644
index 0000000000..fddd867923
--- /dev/null
+++ b/phpBB/phpbb/textreparser/manager.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+namespace phpbb\textreparser;
+
+class manager
+{
+ /**
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * @var \phpbb\config\db_text
+ */
+ protected $config_text;
+
+ /**
+ * @var \phpbb\di\service_collection
+ */
+ protected $reparsers;
+
+ /**
+ * @var array
+ */
+ protected $resume_data;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\config\config $config
+ * @param \phpbb\config\db_text $config_text
+ * @param \phpbb\di\service_collection $reparsers
+ */
+ public function __construct(\phpbb\config\config $config, \phpbb\config\db_text $config_text, \phpbb\di\service_collection $reparsers)
+ {
+ $this->config = $config;
+ $this->config_text = $config_text;
+ $this->reparsers = $reparsers;
+ }
+
+ /**
+ * Loads resume data from the database
+ *
+ * @param string $name Name of the reparser to which the resume data belongs
+ *
+ * @return array
+ */
+ public function get_resume_data($name)
+ {
+ if ($this->resume_data === null)
+ {
+ $resume_data = $this->config_text->get('reparser_resume');
+ $this->resume_data = !empty($resume_data) ? unserialize($resume_data) : array();
+ }
+
+ return isset($this->resume_data[$name]) ? $this->resume_data[$name] : array();
+ }
+
+ /**
+ * Updates the resume data in the database
+ *
+ * @param string $name Name of the reparser to which the resume data belongs
+ * @param int $min Lowest record ID
+ * @param int $current Current record ID
+ * @param int $size Number of records to process at a time
+ * @param bool $update_db True if the resume data should be written to the database, false if not. (default: true)
+ */
+ public function update_resume_data($name, $min, $current, $size, $update_db = true)
+ {
+ // Prevent overwriting the old, stored array
+ if ($this->resume_data === null)
+ {
+ $this->get_resume_data('');
+ }
+
+ $this->resume_data[$name] = array(
+ 'range-min' => $min,
+ 'range-max' => $current,
+ 'range-size' => $size,
+ );
+
+ if ($update_db)
+ {
+ $this->config_text->set('reparser_resume', serialize($this->resume_data));
+ }
+ }
+
+ /**
+ * Sets the interval for a text_reparser cron task
+ *
+ * @param string $name Name of the reparser to schedule
+ * @param int $interval Interval in seconds, 0 to disable the cron task
+ */
+ public function schedule($name, $interval)
+ {
+ if (isset($this->reparsers[$name]) && isset($this->config[$name . '_cron_interval']))
+ {
+ $this->config->set($name . '_cron_interval', $interval);
+ }
+ }
+
+ /**
+ * Sets the interval for all text_reparser cron tasks
+ *
+ * @param int $interval Interval in seconds, 0 to disable the cron task
+ */
+ public function schedule_all($interval)
+ {
+ // This way we don't construct every registered reparser
+ $reparser_array = array_keys($this->reparsers->getArrayCopy());
+
+ foreach ($reparser_array as $reparser)
+ {
+ $this->schedule($reparser, $interval);
+ }
+ }
+}