aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db
diff options
context:
space:
mode:
authorMate Bartus <mate.bartus@gmail.com>2015-07-24 09:20:50 +0200
committerMate Bartus <mate.bartus@gmail.com>2015-10-17 23:05:57 +0200
commit8f5a0ad6f73e7b7757b02c827436384c96069b5a (patch)
tree87a16ddaa2f645d62728f0b4543199e43995bfeb /phpBB/phpbb/db
parentf1047ac854baba4d1015cd9a555a523b3860f2c9 (diff)
downloadforums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.gz
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.bz2
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.tar.xz
forums-8f5a0ad6f73e7b7757b02c827436384c96069b5a.zip
[ticket/14039] Revamp updater
PHPBB3-14039
Diffstat (limited to 'phpBB/phpbb/db')
-rw-r--r--phpBB/phpbb/db/migrator.php4
-rw-r--r--phpBB/phpbb/db/output_handler/html_migrator_output_handler.php (renamed from phpBB/phpbb/db/html_migrator_output_handler.php)18
-rw-r--r--phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php46
-rw-r--r--phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php (renamed from phpBB/phpbb/db/log_wrapper_migrator_output_handler.php)24
-rw-r--r--phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php (renamed from phpBB/phpbb/db/migrator_output_handler_interface.php)2
-rw-r--r--phpBB/phpbb/db/output_handler/null_migrator_output_handler.php (renamed from phpBB/phpbb/db/null_migrator_output_handler.php)2
6 files changed, 70 insertions, 26 deletions
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index 18c6403c07..a809bc14f9 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -13,6 +13,8 @@
namespace phpbb\db;
+use phpbb\db\output_handler\migrator_output_handler_interface;
+use phpbb\db\output_handler\null_migrator_output_handler;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -122,7 +124,7 @@ class migrator
/**
* Set the output handler.
*
- * @param migrator_output_handler $handler The output handler
+ * @param migrator_output_handler_interface $handler The output handler
*/
public function set_output_handler(migrator_output_handler_interface $handler)
{
diff --git a/phpBB/phpbb/db/html_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/html_migrator_output_handler.php
index e37c667463..f15b8e5913 100644
--- a/phpBB/phpbb/db/html_migrator_output_handler.php
+++ b/phpBB/phpbb/db/output_handler/html_migrator_output_handler.php
@@ -11,27 +11,25 @@
*
*/
-namespace phpbb\db;
-
-use phpbb\user;
+namespace phpbb\db\output_handler;
class html_migrator_output_handler implements migrator_output_handler_interface
{
/**
- * User object.
+ * Language object.
*
- * @var user
+ * @var \phpbb\language\language
*/
- private $user;
+ private $language;
/**
* Constructor
*
- * @param user $user User object
+ * @param \phpbb\language\language $language Language object
*/
- public function __construct(user $user)
+ public function __construct(\phpbb\language\language $language)
{
- $this->user = $user;
+ $this->language = $language;
}
/**
@@ -41,7 +39,7 @@ class html_migrator_output_handler implements migrator_output_handler_interface
{
if ($verbosity <= migrator_output_handler_interface::VERBOSITY_VERBOSE)
{
- $final_message = call_user_func_array(array($this->user, 'lang'), $message);
+ $final_message = $this->language->lang_array($message);
echo $final_message . "<br />\n";
}
}
diff --git a/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php
new file mode 100644
index 0000000000..56d5cf49a1
--- /dev/null
+++ b/phpBB/phpbb/db/output_handler/installer_migrator_output_handler.php
@@ -0,0 +1,46 @@
+<?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\output_handler;
+
+use phpbb\install\helper\iohandler\iohandler_interface;
+
+class installer_migrator_output_handler implements migrator_output_handler_interface
+{
+ /**
+ * @var iohandler_interface
+ */
+ protected $iohandler;
+
+ /**
+ * Constructor
+ *
+ * @param iohandler_interface $iohandler Installer's IO-handler
+ */
+ public function __construct(iohandler_interface $iohandler)
+ {
+ $this->iohandler = $iohandler;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function write($message, $verbosity)
+ {
+ if ($verbosity <= migrator_output_handler_interface::VERBOSITY_VERBOSE)
+ {
+ $this->iohandler->add_log_message($message);
+ $this->iohandler->send_response();
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/log_wrapper_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
index 4c85bf4d67..475b2616e5 100644
--- a/phpBB/phpbb/db/log_wrapper_migrator_output_handler.php
+++ b/phpBB/phpbb/db/output_handler/log_wrapper_migrator_output_handler.php
@@ -11,18 +11,16 @@
*
*/
-namespace phpbb\db;
-
-use phpbb\user;
+namespace phpbb\db\output_handler;
class log_wrapper_migrator_output_handler implements migrator_output_handler_interface
{
/**
- * User object.
+ * Language object.
*
- * @var user
+ * @var \phpbb\language\language
*/
- protected $user;
+ protected $language;
/**
* A migrator output handler
@@ -45,14 +43,14 @@ class log_wrapper_migrator_output_handler implements migrator_output_handler_int
/**
* Constructor
*
- * @param user $user User object
- * @param migrator_output_handler_interface $migrator Migrator output handler
- * @param string $log_file File to log to
- * @param \phpbb\filesystem\filesystem_interface phpBB filesystem object
+ * @param \phpbb\language\language $language Language object
+ * @param migrator_output_handler_interface $migrator Migrator output handler
+ * @param string $log_file File to log to
+ * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem object
*/
- public function __construct(user $user, migrator_output_handler_interface $migrator, $log_file, \phpbb\filesystem\filesystem_interface $filesystem)
+ public function __construct(\phpbb\language\language $language, migrator_output_handler_interface $migrator, $log_file, \phpbb\filesystem\filesystem_interface $filesystem)
{
- $this->user = $user;
+ $this->language = $language;
$this->migrator = $migrator;
$this->filesystem = $filesystem;
$this->file_open($log_file);
@@ -84,7 +82,7 @@ class log_wrapper_migrator_output_handler implements migrator_output_handler_int
if ($this->file_handle !== false)
{
- $translated_message = call_user_func_array(array($this->user, 'lang'), $message) . "\n";
+ $translated_message = $this->language->lang_array($message);
if ($verbosity <= migrator_output_handler_interface::VERBOSITY_NORMAL)
{
diff --git a/phpBB/phpbb/db/migrator_output_handler_interface.php b/phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php
index a923af99f6..7bb5c73fec 100644
--- a/phpBB/phpbb/db/migrator_output_handler_interface.php
+++ b/phpBB/phpbb/db/output_handler/migrator_output_handler_interface.php
@@ -11,7 +11,7 @@
*
*/
-namespace phpbb\db;
+namespace phpbb\db\output_handler;
interface migrator_output_handler_interface
{
diff --git a/phpBB/phpbb/db/null_migrator_output_handler.php b/phpBB/phpbb/db/output_handler/null_migrator_output_handler.php
index 0e8cfbb049..5fc2a52577 100644
--- a/phpBB/phpbb/db/null_migrator_output_handler.php
+++ b/phpBB/phpbb/db/output_handler/null_migrator_output_handler.php
@@ -11,7 +11,7 @@
*
*/
-namespace phpbb\db;
+namespace phpbb\db\output_handler;
class null_migrator_output_handler implements migrator_output_handler_interface
{