aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/database_update.php5
-rw-r--r--phpBB/install/index.php2
-rw-r--r--phpBB/install/install_convert.php6
-rw-r--r--phpBB/install/install_install.php43
-rw-r--r--phpBB/install/install_update.php6
5 files changed, 51 insertions, 11 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index ba6f0b3ba9..4746bb11f2 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -183,7 +183,10 @@ define('IN_DB_UPDATE', true);
/* @var $migrator \phpbb\db\migrator */
$migrator = $phpbb_container->get('migrator');
-$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log'));
+
+/** @var \phpbb\filesystem\filesystem_interface $filesystem */
+$filesystem = $phpbb_container->get('filesystem');
+$migrator->set_output_handler(new \phpbb\db\log_wrapper_migrator_output_handler($user, new \phpbb\db\html_migrator_output_handler($user), $phpbb_root_path . 'store/migrations_' . time() . '.log', $filesystem));
$migrator->create_migrations_table();
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 811034f064..dd3590e854 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -270,7 +270,7 @@ $config = new \phpbb\config\config(array(
/* @var $symfony_request \phpbb\symfony_request */
$symfony_request = $phpbb_container->get('symfony_request');
-/* @var $phpbb_filesystem \phpbb\filesystem */
+/* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */
$phpbb_filesystem = $phpbb_container->get('filesystem');
/* @var $phpbb_path_helper \phpbb\path_helper */
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 506bece9c9..e268565be3 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -96,6 +96,9 @@ class install_convert extends module
/** @var string */
protected $php_ext;
+ /** @var \phpbb\filesystem\filesystem_interface */
+ protected $filesystem;
+
/**
* Variables used while converting, they are accessible from the global variable $convert
*/
@@ -116,6 +119,7 @@ class install_convert extends module
$this->template = $template;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
+ $this->filesystem = new \phpbb\filesystem\filesystem();
if (!$this->check_phpbb_installed())
{
@@ -859,7 +863,7 @@ class install_convert extends module
$this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__);
}
- if (!$local_path || !phpbb_is_writable($phpbb_root_path . $local_path))
+ if (!$local_path || !$this->filesystem->is_writable($phpbb_root_path . $local_path))
{
if (!$local_path)
{
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 7a9fa9c81e..3c37a028cb 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -43,9 +43,15 @@ if (!empty($setmodules))
*/
class install_install extends module
{
+ /**
+ * @var \phpbb\filesystem\filesystem_interface
+ */
+ protected $filesystem;
+
function install_install(&$p_master)
{
$this->p_master = &$p_master;
+ $this->filesystem = new \phpbb\filesystem\filesystem();
}
function main($mode, $sub)
@@ -466,13 +472,29 @@ class install_install extends module
if (!file_exists($phpbb_root_path . $dir))
{
@mkdir($phpbb_root_path . $dir, 0777);
- phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
+
+ try
+ {
+ $this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
+ }
+ catch (\phpbb\filesystem\exception\filesystem_exception $e)
+ {
+ // Do nothing
+ }
}
// Now really check
if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))
{
- phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
+ try
+ {
+ $this->filesystem->phpbb_chmod($phpbb_root_path . $dir, CHMOD_READ | CHMOD_WRITE);
+ }
+ catch (\phpbb\filesystem\exception\filesystem_exception $e)
+ {
+ // Do nothing
+ }
+
$exists = true;
}
@@ -514,7 +536,7 @@ class install_install extends module
$write = $exists = true;
if (file_exists($phpbb_root_path . $dir))
{
- if (!phpbb_is_writable($phpbb_root_path . $dir))
+ if (!$this->filesystem->is_writable($phpbb_root_path . $dir))
{
$write = false;
}
@@ -892,7 +914,7 @@ class install_install extends module
$config_data = phpbb_create_config_file_data($data, $available_dbms[$data['dbms']]['DRIVER']);
// Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
- if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path))
+ if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && $this->filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx)) || $this->filesystem->is_writable($phpbb_root_path))
{
// Assume it will work ... if nothing goes wrong below
$written = true;
@@ -914,7 +936,14 @@ class install_install extends module
if ($written)
{
// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
- phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ);
+ try
+ {
+ $this->filesystem->phpbb_chmod($phpbb_root_path . 'config.' . $phpEx, CHMOD_READ);
+ }
+ catch (\phpbb\filesystem\exception\filesystem_exception $e)
+ {
+ // Do nothing
+ }
}
}
@@ -1193,7 +1222,7 @@ class install_install extends module
include($phpbb_root_path . 'includes/constants.' . $phpEx);
}
- $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx);
+ $finder = new \phpbb\finder(new \phpbb\filesystem\filesystem(), $phpbb_root_path, null, $phpEx);
$classes = $finder->core_path('phpbb/db/migration/data/')
->get_classes();
@@ -2029,7 +2058,7 @@ class install_install extends module
{
global $config, $phpbb_root_path;
- if (!phpbb_is_writable($phpbb_root_path . 'images/avatars/upload/'))
+ if (!$this->filesystem->is_writable($phpbb_root_path . 'images/avatars/upload/'))
{
$config->set('allow_avatar', 0);
$config->set('allow_avatar_upload', 0);
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 0ec6897607..410a8afb66 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -55,6 +55,8 @@ class install_update extends module
var $update_to_version;
+ protected $filesystem;
+
// Set to false
var $test_update = false;
@@ -87,6 +89,8 @@ class install_update extends module
/* @var $cache \phpbb\cache\service */
$cache = $phpbb_container->get('cache');
+ $this->filesystem = $phpbb_container->get('filesystem');
+
$this->tpl_name = 'install_update';
$this->page_title = 'UPDATE_INSTALLATION';
@@ -961,7 +965,7 @@ class install_update extends module
// Now init the connection
if ($update_mode == 'download')
{
- if (function_exists('phpbb_is_writable') && !phpbb_is_writable($phpbb_root_path . 'store/'))
+ if ($this->filesystem->is_writable($phpbb_root_path . 'store/'))
{
trigger_error(sprintf('The directory ā€œ%sā€ is not writable.', $phpbb_root_path . 'store/'), E_USER_ERROR);
}