1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/13904] Modify files for changes in ini wrapper

PHPBB3-13904
This commit is contained in:
Marc Alexander
2015-08-27 10:51:10 +02:00
parent b2957b9d65
commit 16f3b8c2b9
16 changed files with 60 additions and 66 deletions

View File

@@ -1,3 +1,3 @@
services:
php_ini:
class: phpbb\php\ini
class: bantu\IniGetWrapper\IniGetWrapper

View File

@@ -205,8 +205,8 @@ $migrator->set_migrations($migrations);
// What is a safe limit of execution time? Half the max execution time should be safe.
// No more than 15 seconds so the user isn't sitting and waiting for a very long time
$phpbb_ini = new \phpbb\php\ini();
$safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2));
$phpbb_ini = new \bantu\IniGetWrapper\IniGetWrapper();
$safe_time_limit = min(15, ($phpbb_ini->getNumeric('max_execution_time') / 2));
// While we're going to try limit this to half the max execution time,
// we want to try and take additional measures to prevent hitting the

View File

@@ -72,7 +72,7 @@ class filespec
/** @var \phpbb\filesystem\filesystem_interface */
protected $filesystem;
/** @var \phpbb\php\ini ini_get() wrapper class */
/** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */
protected $php_ini;
/** @var language Language class */
@@ -92,12 +92,12 @@ class filespec
*
* @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem
* @param language $language Language
* @param \phpbb\php\ini $php_ini ini_get() wrapper
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param string $phpbb_root_path phpBB root path
* @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser
* @param \phpbb\plupload\plupload $plupload Plupload
*/
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \phpbb\php\ini $php_ini, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
$this->filesystem = $phpbb_filesystem;
$this->language = $language;
@@ -417,7 +417,7 @@ class filespec
return false;
}
$upload_mode = ($this->php_ini->get_bool('open_basedir') || $this->php_ini->get_bool('safe_mode')) ? 'move' : 'copy';
$upload_mode = ($this->php_ini->getBool('open_basedir') || $this->php_ini->getBool('safe_mode')) ? 'move' : 'copy';
$upload_mode = ($this->local) ? 'local' : $upload_mode;
$this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname);

View File

@@ -56,7 +56,7 @@ class upload
/** @var \phpbb\files\factory Files factory */
protected $factory;
/** @var \phpbb\php\ini ini_get() wrapper */
/** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper */
protected $php_ini;
/** @var \phpbb\language\language Language class */
@@ -74,11 +74,11 @@ class upload
* @param filesystem_interface $filesystem
* @param factory $factory Files factory
* @param language $language Language class
* @param \phpbb\php\ini $php_ini ini_get() wrapper
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param request_interface $request Request class
* @param string $phpbb_root_path phpBB root path
*/
public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \phpbb\php\ini $php_ini, request_interface $request, $phpbb_root_path)
public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
{
$this->filesystem = $filesystem;
$this->factory = $factory;
@@ -216,7 +216,7 @@ class upload
switch ($errorcode)
{
case UPLOAD_ERR_INI_SIZE:
$max_filesize = $this->php_ini->get_string('upload_max_filesize');
$max_filesize = $this->php_ini->getString('upload_max_filesize');
$unit = 'MB';
if (!empty($max_filesize))

View File

@@ -41,7 +41,7 @@ class config
protected $install_config_file;
/**
* @var \phpbb\php\ini
* @var \bantu\IniGetWrapper\IniGetWrapper
*/
protected $php_ini;
@@ -83,7 +83,7 @@ class config
/**
* Constructor
*/
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\php\ini $php_ini, $phpbb_root_path)
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \bantu\IniGetWrapper\IniGetWrapper $php_ini, $phpbb_root_path)
{
$this->filesystem = $filesystem;
$this->php_ini = $php_ini;
@@ -373,7 +373,7 @@ class config
protected function setup_system_data()
{
// Query maximum runtime from php.ini
$execution_time = $this->php_ini->get_int('max_execution_time');
$execution_time = $this->php_ini->getNumeric('max_execution_time');
$execution_time = min(15, $execution_time / 2);
$this->system_data['max_execution_time'] = $execution_time;
@@ -381,6 +381,6 @@ class config
$this->system_data['start_time'] = time();
// Get memory limit
$this->system_data['memory_limit'] = $this->php_ini->get_bytes('memory_limit');
$this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit');
}
}

View File

@@ -39,7 +39,7 @@ class plupload
protected $user;
/**
* @var \phpbb\php\ini
* @var \bantu\IniGetWrapper\IniGetWrapper
*/
protected $php_ini;
@@ -67,10 +67,10 @@ class plupload
* @param \phpbb\config\config $config
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user
* @param \phpbb\php\ini $php_ini
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini
* @param \phpbb\mimetype\guesser $mimetype_guesser
*/
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \phpbb\php\ini $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)
public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \phpbb\mimetype\guesser $mimetype_guesser)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->config = $config;
@@ -284,9 +284,9 @@ class plupload
public function get_chunk_size()
{
$max = min(
$this->php_ini->get_bytes('upload_max_filesize'),
$this->php_ini->get_bytes('post_max_size'),
max(1, $this->php_ini->get_bytes('memory_limit')),
$this->php_ini->getBytes('upload_max_filesize'),
$this->php_ini->getBytes('post_max_size'),
max(1, $this->php_ini->getBytes('memory_limit')),
$this->config['max_filesize']
);