aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/db/migration/data/v31x/v318rc1.php32
-rw-r--r--phpBB/phpbb/db/migration/data/v320/remote_upload_validation.php31
-rw-r--r--phpBB/phpbb/db/migration/data/v320/text_reparser.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320b1.php39
-rw-r--r--phpBB/phpbb/files/types/remote.php119
-rw-r--r--phpBB/phpbb/install/controller/archive_download.php6
-rw-r--r--phpBB/phpbb/install/controller/helper.php12
-rw-r--r--phpBB/phpbb/install/controller/install.php3
-rw-r--r--phpBB/phpbb/install/controller/update.php3
-rw-r--r--phpBB/phpbb/install/helper/config.php22
-rw-r--r--phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php31
-rw-r--r--phpBB/phpbb/install/helper/iohandler/cli_iohandler.php7
-rw-r--r--phpBB/phpbb/install/helper/iohandler/factory.php2
-rw-r--r--phpBB/phpbb/install/helper/iohandler/iohandler_base.php8
-rw-r--r--phpBB/phpbb/install/helper/iohandler/iohandler_interface.php18
-rw-r--r--phpBB/phpbb/install/helper/navigation/convertor_navigation.php78
-rw-r--r--phpBB/phpbb/install/module/install_database/task/create_schema.php13
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php37
-rw-r--r--phpBB/phpbb/install/module/requirements/task/check_update.php16
-rw-r--r--phpBB/phpbb/install/module/update_database/task/update.php1
-rw-r--r--phpBB/phpbb/path_helper.php9
-rw-r--r--phpBB/phpbb/session.php2
-rw-r--r--phpBB/phpbb/template/twig/definition.php5
-rw-r--r--phpBB/phpbb/template/twig/node/includeasset.php2
24 files changed, 370 insertions, 133 deletions
diff --git a/phpBB/phpbb/db/migration/data/v31x/v318rc1.php b/phpBB/phpbb/db/migration/data/v31x/v318rc1.php
new file mode 100644
index 0000000000..8bae95c7d6
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v31x/v318rc1.php
@@ -0,0 +1,32 @@
+<?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\v31x;
+
+class v318rc1 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\increase_size_of_dateformat',
+ '\phpbb\db\migration\data\v31x\v317pl1',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.8-RC1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/remote_upload_validation.php b/phpBB/phpbb/db/migration/data/v320/remote_upload_validation.php
new file mode 100644
index 0000000000..d61f6b96fd
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/remote_upload_validation.php
@@ -0,0 +1,31 @@
+<?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 remote_upload_validation extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\v320a2',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('remote_upload_verify', '0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/text_reparser.php b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
index 1d73b74a76..ea614feb40 100644
--- a/phpBB/phpbb/db/migration/data/v320/text_reparser.php
+++ b/phpBB/phpbb/db/migration/data/v320/text_reparser.php
@@ -17,7 +17,10 @@ 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');
+ return array(
+ '\phpbb\db\migration\data\v310\contact_admin_form',
+ '\phpbb\db\migration\data\v320\allowed_schemes_links',
+ );
}
public function effectively_installed()
@@ -78,7 +81,7 @@ class text_reparser extends \phpbb\db\migration\container_aware_migration
$end = max(1, $resume_data['current']);
$reparser->reparse_range($start, $end);
- $processed_records = $end - $start + 1;
+ $processed_records += $end - $start + 1;
$resume_data['current'] = $start - 1;
if ($start === 1)
diff --git a/phpBB/phpbb/db/migration/data/v320/v320b1.php b/phpBB/phpbb/db/migration/data/v320/v320b1.php
new file mode 100644
index 0000000000..5c3a3797cd
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320b1.php
@@ -0,0 +1,39 @@
+<?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 v320b1 extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-b1', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v317pl1',
+ '\phpbb\db\migration\data\v320\v320a2',
+ '\phpbb\db\migration\data\v31x\increase_size_of_dateformat',
+ '\phpbb\db\migration\data\v320\default_data_type_ids',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-b1')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/files/types/remote.php b/phpBB/phpbb/files/types/remote.php
index 33cbfb00ae..1fdba0ca32 100644
--- a/phpBB/phpbb/files/types/remote.php
+++ b/phpBB/phpbb/files/types/remote.php
@@ -14,6 +14,7 @@
namespace phpbb\files\types;
use bantu\IniGetWrapper\IniGetWrapper;
+use phpbb\config\config;
use phpbb\files\factory;
use phpbb\files\filespec;
use phpbb\language\language;
@@ -21,6 +22,9 @@ use phpbb\request\request_interface;
class remote extends base
{
+ /** @var config phpBB config */
+ protected $config;
+
/** @var factory Files factory */
protected $factory;
@@ -42,14 +46,16 @@ class remote extends base
/**
* Construct a form upload type
*
+ * @param config $config phpBB config
* @param factory $factory Files factory
* @param language $language Language class
* @param IniGetWrapper $php_ini ini_get() wrapper
* @param request_interface $request Request object
* @param string $phpbb_root_path phpBB root path
*/
- public function __construct(factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
+ public function __construct(config $config, factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
{
+ $this->config = $config;
$this->factory = $factory;
$this->language = $language;
$this->php_ini = $php_ini;
@@ -86,10 +92,6 @@ class remote extends base
$url = parse_url($upload_url);
- $host = $url['host'];
- $path = $url['path'];
- $port = (!empty($url['port'])) ? (int) $url['port'] : 80;
-
$upload_ary['type'] = 'application/octet-stream';
$url['path'] = explode('.', $url['path']);
@@ -97,108 +99,55 @@ class remote extends base
$url['path'] = implode('', $url['path']);
$upload_ary['name'] = utf8_basename($url['path']) . (($ext) ? '.' . $ext : '');
- $filesize = 0;
$remote_max_filesize = $this->get_max_file_size();
- $errno = 0;
- $errstr = '';
+ $guzzle_options = [
+ 'timeout' => $this->upload->upload_timeout,
+ 'connect_timeout' => $this->upload->upload_timeout,
+ 'verify' => !empty($this->config['remote_upload_verify']) ? (bool) $this->config['remote_upload_verify'] : false,
+ ];
+ $client = new \GuzzleHttp\Client($guzzle_options);
- if (!($fsock = @fsockopen($host, $port, $errno, $errstr)))
+ try
{
- return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'));
+ $response = $client->get($upload_url, $guzzle_options);
}
-
- // Make sure $path not beginning with /
- if (strpos($path, '/') === 0)
+ catch (\GuzzleHttp\Exception\ClientException $clientException)
{
- $path = substr($path, 1);
+ return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'URL_NOT_FOUND');
}
-
- fputs($fsock, 'GET /' . $path . " HTTP/1.1\r\n");
- fputs($fsock, "HOST: " . $host . "\r\n");
- fputs($fsock, "Connection: close\r\n\r\n");
-
- // Set a proper timeout for the socket
- socket_set_timeout($fsock, $this->upload->upload_timeout);
-
- $get_info = false;
- $data = '';
- $length = false;
- $timer_stop = time() + $this->upload->upload_timeout;
-
- while ((!$length || $filesize < $length) && !@feof($fsock))
+ catch (\GuzzleHttp\Exception\RequestException $requestException)
{
- if ($get_info)
+ if (strpos($requestException->getMessage(), 'cURL error 28') !== false || preg_match('/408|504/', $requestException->getCode()))
{
- if ($length)
- {
- // Don't attempt to read past end of file if server indicated length
- $block = @fread($fsock, min($length - $filesize, 1024));
- }
- else
- {
- $block = @fread($fsock, 1024);
- }
-
- $filesize += strlen($block);
-
- if ($remote_max_filesize && $filesize > $remote_max_filesize)
- {
- $max_filesize = get_formatted_filesize($remote_max_filesize, false);
-
- return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']));
- }
-
- $data .= $block;
+ return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'REMOTE_UPLOAD_TIMEOUT');
}
else
{
- $line = @fgets($fsock, 1024);
-
- if ($line == "\r\n")
- {
- $get_info = true;
- }
- else
- {
- if (stripos($line, 'content-type: ') !== false)
- {
- $upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line)));
- }
- else if ($this->upload->max_filesize && stripos($line, 'content-length: ') !== false)
- {
- $length = (int) str_replace('content-length: ', '', strtolower($line));
-
- if ($remote_max_filesize && $length && $length > $remote_max_filesize)
- {
- $max_filesize = get_formatted_filesize($remote_max_filesize, false);
-
- return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']));
- }
- }
- else if (stripos($line, '404 not found') !== false)
- {
- return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'URL_NOT_FOUND');
- }
- }
+ return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'));
}
+ }
+ catch (\Exception $e)
+ {
+ return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'NOT_UPLOADED'));
+ }
- $stream_meta_data = stream_get_meta_data($fsock);
+ $content_length = $response->getBody()->getSize();
+ if ($remote_max_filesize && $content_length > $remote_max_filesize)
+ {
+ $max_filesize = get_formatted_filesize($remote_max_filesize, false);
- // Cancel upload if we exceed timeout
- if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
- {
- return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'REMOTE_UPLOAD_TIMEOUT');
- }
+ return $this->factory->get('filespec')->set_error($this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']));
}
- @fclose($fsock);
- if (empty($data))
+ if ($content_length == 0)
{
return $this->factory->get('filespec')->set_error($this->upload->error_prefix . 'EMPTY_REMOTE_DATA');
}
+ $data = $response->getBody();
+
$filename = tempnam(sys_get_temp_dir(), unique_id() . '-');
if (!($fp = @fopen($filename, 'wb')))
diff --git a/phpBB/phpbb/install/controller/archive_download.php b/phpBB/phpbb/install/controller/archive_download.php
index a0f0ba181d..eabc0a9976 100644
--- a/phpBB/phpbb/install/controller/archive_download.php
+++ b/phpBB/phpbb/install/controller/archive_download.php
@@ -46,9 +46,9 @@ class archive_download
*/
public function conflict_archive()
{
- $filename = $this->installer_config->get('update_file_conflict_archive', false);
+ $filename = $this->installer_config->get('update_file_conflict_archive', '');
- if (!$filename)
+ if (empty($filename))
{
throw new http_exception(404, 'URL_NOT_FOUND');
}
@@ -65,7 +65,7 @@ class archive_download
{
$filename = $this->installer_config->get('update_file_archive', '');
- if (!$filename)
+ if (empty($filename))
{
throw new http_exception(404, 'URL_NOT_FOUND');
}
diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php
index 2dad42b4b6..ff7e691224 100644
--- a/phpBB/phpbb/install/controller/helper.php
+++ b/phpBB/phpbb/install/controller/helper.php
@@ -160,12 +160,13 @@ class helper
* Returns path from route name
*
* @param string $route_name
+ * @param array $parameters
*
* @return string
*/
- public function route($route_name)
+ public function route($route_name, $parameters = array())
{
- $url = $this->router->generate($route_name);
+ $url = $this->router->generate($route_name, $parameters);
return $url;
}
@@ -182,11 +183,6 @@ class helper
if (!empty($submit))
{
$lang = $this->phpbb_request->variable('language', '');
-
- if (!empty($lang))
- {
- $this->language_cookie = $lang;
- }
}
// Retrieve language from cookie
@@ -194,10 +190,10 @@ class helper
if (empty($lang) && !empty($lang_cookie))
{
$lang = $lang_cookie;
- $this->language_cookie = $lang;
}
$lang = (!empty($lang) && strpos($lang, '/') === false) ? $lang : null;
+ $this->language_cookie = $lang;
$this->render_language_select($lang);
diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php
index b987d91c6a..92506872a3 100644
--- a/phpBB/phpbb/install/controller/install.php
+++ b/phpBB/phpbb/install/controller/install.php
@@ -123,6 +123,7 @@ class install
// Set the appropriate input-output handler
$this->installer->set_iohandler($this->iohandler_factory->get());
+ $this->controller_helper->handle_language_select();
if ($this->request->is_ajax())
{
@@ -142,8 +143,6 @@ class install
// Determine whether the installation was started or not
if (true)
{
- $this->controller_helper->handle_language_select();
-
// Set active stage
$this->menu_provider->set_nav_property(
array('install', 0, 'introduction'),
diff --git a/phpBB/phpbb/install/controller/update.php b/phpBB/phpbb/install/controller/update.php
index 9fff11cae8..6b88827940 100644
--- a/phpBB/phpbb/install/controller/update.php
+++ b/phpBB/phpbb/install/controller/update.php
@@ -122,6 +122,7 @@ class update
// Set the appropriate input-output handler
$this->installer->set_iohandler($this->iohandler_factory->get());
+ $this->controller_helper->handle_language_select();
// Render the intro page
if ($this->request->is_ajax())
@@ -140,8 +141,6 @@ class update
}
else
{
- $this->controller_helper->handle_language_select();
-
// Set active stage
$this->menu_provider->set_nav_property(
array('update', 0, 'introduction'),
diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php
index 0f0840f470..f58925899b 100644
--- a/phpBB/phpbb/install/helper/config.php
+++ b/phpBB/phpbb/install/helper/config.php
@@ -157,10 +157,10 @@ class config
{
if ($this->system_data['max_execution_time'] <= 0)
{
- return 1;
+ return PHP_INT_MAX;
}
- return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time();
+ return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - microtime(true);
}
/**
@@ -227,18 +227,22 @@ class config
$file_content = @file_get_contents($this->install_config_file);
$serialized_data = trim(substr($file_content, 8));
- $this->installer_config = array();
- $this->progress_data = array();
- $this->navigation_data = array();
+ $installer_config = array();
+ $progress_data = array();
+ $navigation_data = array();
if (!empty($serialized_data))
{
$unserialized_data = json_decode($serialized_data, true);
- $this->installer_config = (is_array($unserialized_data['installer_config'])) ? $unserialized_data['installer_config'] : array();
- $this->progress_data = (is_array($unserialized_data['progress_data'])) ? $unserialized_data['progress_data'] : array();
- $this->navigation_data = (is_array($unserialized_data['navigation_data'])) ? $unserialized_data['navigation_data'] : array();
+ $installer_config = (is_array($unserialized_data['installer_config'])) ? $unserialized_data['installer_config'] : array();
+ $progress_data = (is_array($unserialized_data['progress_data'])) ? $unserialized_data['progress_data'] : array();
+ $navigation_data = (is_array($unserialized_data['navigation_data'])) ? $unserialized_data['navigation_data'] : array();
}
+
+ $this->installer_config = array_merge($this->installer_config, $installer_config);
+ $this->progress_data = array_merge($this->progress_data, $progress_data);
+ $this->navigation_data = array_merge($this->navigation_data, $navigation_data);
}
/**
@@ -430,7 +434,7 @@ class config
$this->system_data['max_execution_time'] = $execution_time;
// Set start time
- $this->system_data['start_time'] = time();
+ $this->system_data['start_time'] = microtime(true);
// Get memory limit
$this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit');
diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
index 1342ffa30f..31474ae4e9 100644
--- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
+++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
@@ -72,6 +72,11 @@ class ajax_iohandler extends iohandler_base
protected $download;
/**
+ * @var array
+ */
+ protected $redirect_url;
+
+ /**
* Constructor
*
* @param path_helper $path_helper
@@ -89,6 +94,7 @@ class ajax_iohandler extends iohandler_base
$this->nav_data = array();
$this->cookies = array();
$this->download = array();
+ $this->redirect_url = array();
$this->file_status = '';
parent::__construct();
@@ -131,6 +137,14 @@ class ajax_iohandler extends iohandler_base
*/
public function add_user_form_group($title, $form)
{
+ $this->form = $this->generate_form_render_data($title, $form);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function generate_form_render_data($title, $form)
+ {
$this->template->assign_block_vars('options', array(
'LEGEND' => $this->language->lang($title),
'S_LEGEND' => true,
@@ -189,7 +203,7 @@ class ajax_iohandler extends iohandler_base
'form_install' => 'installer_form.html',
));
- $this->form = $this->template->assign_display('form_install');
+ return $this->template->assign_display('form_install');
}
/**
@@ -273,6 +287,12 @@ class ajax_iohandler extends iohandler_base
$this->cookies = array();
}
+ if (!empty($this->redirect_url))
+ {
+ $json_array['redirect'] = $this->redirect_url;
+ $this->redirect_url = array();
+ }
+
return $json_array;
}
@@ -373,6 +393,15 @@ class ajax_iohandler extends iohandler_base
}
/**
+ * {@inheritdoc}
+ */
+ public function redirect($url, $use_ajax = false)
+ {
+ $this->redirect_url = array('url' => $url, 'use_ajax' => $use_ajax);
+ $this->send_response();
+ }
+
+ /**
* Callback function for language replacing
*
* @param array $matches
diff --git a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
index 89f3594378..7945904524 100644
--- a/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
+++ b/phpBB/phpbb/install/helper/iohandler/cli_iohandler.php
@@ -289,4 +289,11 @@ class cli_iohandler extends iohandler_base
public function render_update_file_status($status_array)
{
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function redirect($url, $use_ajax = false)
+ {
+ }
}
diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php
index 52d24e49b2..1e8395760a 100644
--- a/phpBB/phpbb/install/helper/iohandler/factory.php
+++ b/phpBB/phpbb/install/helper/iohandler/factory.php
@@ -75,7 +75,5 @@ class factory
throw new iohandler_not_implemented_exception();
break;
}
-
- throw new iohandler_not_implemented_exception();
}
}
diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
index 7271fe9bc0..fed4bc101f 100644
--- a/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
+++ b/phpBB/phpbb/install/helper/iohandler/iohandler_base.php
@@ -170,6 +170,14 @@ abstract class iohandler_base implements iohandler_interface
}
/**
+ * {@inheritdoc}
+ */
+ public function generate_form_render_data($title, $form)
+ {
+ return '';
+ }
+
+ /**
* Localize message.
*
* Note: When an array is passed into the parameters below, it will be
diff --git a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php
index 00aab3283e..6b3839506f 100644
--- a/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php
+++ b/phpBB/phpbb/install/helper/iohandler/iohandler_interface.php
@@ -124,6 +124,16 @@ interface iohandler_interface
public function add_user_form_group($title, $form);
/**
+ * Returns the rendering information for the form
+ *
+ * @param string $title Language variable with the title of the form
+ * @param array $form An array describing the required data (options etc)
+ *
+ * @return string Information to render the form
+ */
+ public function generate_form_render_data($title, $form);
+
+ /**
* Sets the number of tasks belonging to the installer in the current mode.
*
* @param int $task_count Number of tasks
@@ -175,6 +185,14 @@ interface iohandler_interface
public function add_download_link($route, $title, $msg = null);
/**
+ * Redirects the user to a new page
+ *
+ * @param string $url URL to redirect to
+ * @param bool $use_ajax Whether or not to use AJAX redirect
+ */
+ public function redirect($url, $use_ajax = false);
+
+ /**
* Renders the status of update files
*
* @param array $status_array Array containing files in groups to render
diff --git a/phpBB/phpbb/install/helper/navigation/convertor_navigation.php b/phpBB/phpbb/install/helper/navigation/convertor_navigation.php
new file mode 100644
index 0000000000..54cab83b1d
--- /dev/null
+++ b/phpBB/phpbb/install/helper/navigation/convertor_navigation.php
@@ -0,0 +1,78 @@
+<?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\install\helper\navigation;
+
+use phpbb\install\helper\install_helper;
+
+class convertor_navigation implements navigation_interface
+{
+ /**
+ * @var install_helper
+ */
+ private $install_helper;
+
+ /**
+ * Constructor
+ *
+ * @param install_helper $install_helper
+ */
+ public function __construct(install_helper $install_helper)
+ {
+ $this->install_helper = $install_helper;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get()
+ {
+ if (!$this->install_helper->is_phpbb_installed())
+ {
+ return array();
+ }
+
+ return array(
+ 'convert' => array(
+ 'label' => 'CONVERT',
+ 'route' => 'phpbb_convert_intro',
+ 'order' => 3,
+ array(
+ 'intro' => array(
+ 'label' => 'SUB_INTRO',
+ 'stage' => true,
+ 'order' => 0,
+ ),
+ 'settings' => array(
+ 'label' => 'STAGE_SETTINGS',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_settings',
+ 'order' => 1,
+ ),
+ 'convert' => array(
+ 'label' => 'STAGE_IN_PROGRESS',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_convert',
+ 'order' => 2,
+ ),
+ 'finish' => array(
+ 'label' => 'CONVERT_COMPLETE',
+ 'stage' => true,
+ 'route' => 'phpbb_convert_finish',
+ 'order' => 3,
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/install/module/install_database/task/create_schema.php b/phpBB/phpbb/install/module/install_database/task/create_schema.php
index cabb78787f..a5635d5dbe 100644
--- a/phpBB/phpbb/install/module/install_database/task/create_schema.php
+++ b/phpBB/phpbb/install/module/install_database/task/create_schema.php
@@ -13,6 +13,8 @@
namespace phpbb\install\module\install_database\task;
+use phpbb\install\exception\resource_limit_reached_exception;
+
/**
* Create database schema
*/
@@ -106,6 +108,17 @@ class create_schema extends \phpbb\install\task_base
*/
public function run()
{
+ // As this task may take a large amount of time to complete refreshing the page might be necessary for some
+ // server configurations with limited resources
+ if (!$this->config->get('pre_schema_forced_refresh'))
+ {
+ if ($this->config->get_time_remaining() < 5)
+ {
+ $this->config->set('pre_schema_forced_refresh', true);
+ throw new resource_limit_reached_exception();
+ }
+ }
+
$this->db->sql_return_on_error(true);
$dbms = $this->config->get('dbms');
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
index 6a98721e77..be6404dcd8 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php
@@ -57,22 +57,35 @@ class obtain_update_settings extends task_base
}
else
{
+ if ($this->installer_config->get('disable_filesystem_update', false))
+ {
+ $options[] = array(
+ 'value' => 'db_only',
+ 'label' => 'UPDATE_TYPE_DB_ONLY',
+ 'selected' => true,
+ );
+ }
+ else
+ {
+ $options = array(
+ array(
+ 'value' => 'all',
+ 'label' => 'UPDATE_TYPE_ALL',
+ 'selected' => true,
+ ),
+ array(
+ 'value' => 'db_only',
+ 'label' => 'UPDATE_TYPE_DB_ONLY',
+ 'selected' => false,
+ ),
+ );
+ }
+
$this->iohandler->add_user_form_group('UPDATE_TYPE', array(
'update_type' => array(
'label' => 'UPDATE_TYPE',
'type' => 'radio',
- 'options' => array(
- array(
- 'value' => 'all',
- 'label' => 'UPDATE_TYPE_ALL',
- 'selected' => true,
- ),
- array(
- 'value' => 'db_only',
- 'label' => 'UPDATE_TYPE_DB_ONLY',
- 'selected' => false,
- ),
- ),
+ 'options' => $options,
),
'submit_update' => array(
'label' => 'SUBMIT',
diff --git a/phpBB/phpbb/install/module/requirements/task/check_update.php b/phpBB/phpbb/install/module/requirements/task/check_update.php
index c986c76810..4e9124ff47 100644
--- a/phpBB/phpbb/install/module/requirements/task/check_update.php
+++ b/phpBB/phpbb/install/module/requirements/task/check_update.php
@@ -14,6 +14,7 @@
namespace phpbb\install\module\requirements\task;
use phpbb\filesystem\filesystem;
+use phpbb\install\helper\config;
use phpbb\install\helper\container_factory;
use phpbb\install\helper\iohandler\iohandler_interface;
use phpbb\install\helper\update_helper;
@@ -35,6 +36,11 @@ class check_update extends task_base
protected $filesystem;
/**
+ * @var config
+ */
+ protected $installer_config;
+
+ /**
* @var iohandler_interface
*/
protected $iohandler;
@@ -69,14 +75,16 @@ class check_update extends task_base
*
* @param container_factory $container
* @param filesystem $filesystem
+ * @param config $config
* @param iohandler_interface $iohandler
* @param update_helper $update_helper
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(container_factory $container, filesystem $filesystem, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext)
+ public function __construct(container_factory $container, filesystem $filesystem, config $config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext)
{
$this->filesystem = $filesystem;
+ $this->installer_config = $config;
$this->iohandler = $iohandler;
$this->update_helper = $update_helper;
$this->phpbb_root_path = $phpbb_root_path;
@@ -117,8 +125,10 @@ class check_update extends task_base
$this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND');
$this->set_test_passed(false);
- // If there are no update files, we can't check the version
- return false;
+ // If there are no update files, we can't check the version etc
+ // However, we can let the users run migrations if they really want to...
+ $this->installer_config->set('disable_filesystem_update', true);
+ return true;
}
// Recover version numbers
diff --git a/phpBB/phpbb/install/module/update_database/task/update.php b/phpBB/phpbb/install/module/update_database/task/update.php
index 4b2baf2c23..aa44d403dd 100644
--- a/phpBB/phpbb/install/module/update_database/task/update.php
+++ b/phpBB/phpbb/install/module/update_database/task/update.php
@@ -158,6 +158,7 @@ class update extends task_base
array_unshift($msg, $e->getMessage());
$this->iohandler->add_error_message($msg);
+ $this->iohandler->send_response();
throw new user_interaction_required_exception();
}
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php
index 7b0d6f0fba..154361ef64 100644
--- a/phpBB/phpbb/path_helper.php
+++ b/phpBB/phpbb/path_helper.php
@@ -100,11 +100,18 @@ class path_helper
*/
public function update_web_root_path($path)
{
+ $web_root_path = $this->get_web_root_path();
+
+ // Removes the web root path if it is already present
+ if (strpos($path, $web_root_path) === 0)
+ {
+ $path = $this->phpbb_root_path . substr($path, strlen($web_root_path));
+ }
+
if (strpos($path, $this->phpbb_root_path) === 0)
{
$path = substr($path, strlen($this->phpbb_root_path));
- $web_root_path = $this->get_web_root_path();
if (substr($web_root_path, -8) === 'app.php/' && substr($path, 0, 7) === 'app.php')
{
$path = substr($path, 8);
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 3f7146c59b..12031bda03 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -1600,6 +1600,8 @@ class session
$db->sql_return_on_error(false);
+ $this->data = array_merge($this->data, $sql_ary);
+
if ($this->data['user_id'] != ANONYMOUS && !empty($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts'])
{
$this->leave_newly_registered();
diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php
index cb3c953692..205f0e68ee 100644
--- a/phpBB/phpbb/template/twig/definition.php
+++ b/phpBB/phpbb/template/twig/definition.php
@@ -19,7 +19,10 @@ namespace phpbb\template\twig;
class definition
{
/** @var array **/
- protected $definitions = array();
+ protected $definitions = array(
+ 'SCRIPTS' => '__SCRIPTS_PLACEHOLDER__',
+ 'STYLESHEETS' => '__STYLESHEETS_PLACEHOLDER__'
+ );
/**
* Get a DEFINE'd variable
diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php
index 3d3c6e4df8..6d50eafc9d 100644
--- a/phpBB/phpbb/template/twig/node/includeasset.php
+++ b/phpBB/phpbb/template/twig/node/includeasset.php
@@ -53,8 +53,6 @@ abstract class includeasset extends \Twig_Node
->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
->outdent()
->write("}\n")
- ->write("\$context['definition']->set('STYLESHEETS', '__STYLESHEETS_PLACEHOLDER__');\n")
- ->write("\$context['definition']->set('SCRIPTS', '__SCRIPTS_PLACEHOLDER__');\n")
->write("\$this->getEnvironment()->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);")
;
}