[ticket/13740] Core file workarounds

[ci skip]

PHPBB3-13740
This commit is contained in:
MateBartus 2015-04-28 15:49:07 +02:00 committed by Mate Bartus
parent 14e8f712ae
commit 5afc632bca
7 changed files with 92 additions and 71 deletions

View file

@ -52,7 +52,7 @@ if (!defined('PHPBB_INSTALLED'))
} }
// $phpbb_root_path accounts for redirects from e.g. /adm // $phpbb_root_path accounts for redirects from e.g. /adm
$script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/index.' . $phpEx; $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx;
// Replace any number of consecutive backslashes and/or slashes with a single slash // Replace any number of consecutive backslashes and/or slashes with a single slash
// (could happen on some proxy setups and/or Windows servers) // (could happen on some proxy setups and/or Windows servers)
$script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path);

View file

@ -8,13 +8,16 @@ imports:
- { resource: services_db.yml } - { resource: services_db.yml }
- { resource: services_event.yml } - { resource: services_event.yml }
- { resource: services_feed.yml } - { resource: services_feed.yml }
- { resource: services_files.yml }
- { resource: services_help.yml } - { resource: services_help.yml }
- { resource: services_http.yml }
- { resource: services_language.yml } - { resource: services_language.yml }
- { resource: services_migrator.yml } - { resource: services_migrator.yml }
- { resource: services_mimetype_guesser.yml } - { resource: services_mimetype_guesser.yml }
- { resource: services_module.yml } - { resource: services_module.yml }
- { resource: services_notification.yml } - { resource: services_notification.yml }
- { resource: services_password.yml } - { resource: services_password.yml }
- { resource: services_php.yml }
- { resource: services_profilefield.yml } - { resource: services_profilefield.yml }
- { resource: services_report.yml } - { resource: services_report.yml }
- { resource: services_routing.yml } - { resource: services_routing.yml }
@ -107,19 +110,9 @@ services:
- %core.php_ext% - %core.php_ext%
- @cache.driver - @cache.driver
filesystem:
class: phpbb\filesystem\filesystem
file_downloader: file_downloader:
class: phpbb\file_downloader class: phpbb\file_downloader
http_kernel:
class: Symfony\Component\HttpKernel\HttpKernel
arguments:
- @dispatcher
- @controller.resolver
- @request_stack
log: log:
class: phpbb\log\log class: phpbb\log\log
arguments: arguments:
@ -142,9 +135,6 @@ services:
- %core.php_ext% - %core.php_ext%
- %core.adm_relative_path% - %core.adm_relative_path%
php_ini:
class: phpbb\php\ini
plupload: plupload:
class: phpbb\plupload\plupload class: phpbb\plupload\plupload
arguments: arguments:
@ -155,22 +145,6 @@ services:
- @php_ini - @php_ini
- @mimetype.guesser - @mimetype.guesser
request:
class: phpbb\request\request
arguments:
- null
- %core.disable_super_globals%
# WARNING: The Symfony request does not escape the input and should be used very carefully
# prefer the phpbb request (service @request) as possible
symfony_request:
class: phpbb\symfony_request
arguments:
- @request
request_stack:
class: Symfony\Component\HttpFoundation\RequestStack
upload_imagesize: upload_imagesize:
class: fastImageSize\fastImageSize class: fastImageSize\fastImageSize

View file

@ -0,0 +1,3 @@
services:
filesystem:
class: phpbb\filesystem\filesystem

View file

@ -0,0 +1,23 @@
services:
# WARNING: The Symfony request does not escape the input and should be used very carefully
# prefer the phpbb request (service @request) as possible
symfony_request:
class: phpbb\symfony_request
arguments:
- @request
request_stack:
class: Symfony\Component\HttpFoundation\RequestStack
request:
class: phpbb\request\request
arguments:
- null
- %core.disable_super_globals%
http_kernel:
class: Symfony\Component\HttpKernel\HttpKernel
arguments:
- @dispatcher
- @controller.resolver
- @request_stack

View file

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

View file

@ -11,6 +11,7 @@ parameters:
tables.forums: %core.table_prefix%forums tables.forums: %core.table_prefix%forums
tables.log: %core.table_prefix%log tables.log: %core.table_prefix%log
tables.migrations: %core.table_prefix%migrations tables.migrations: %core.table_prefix%migrations
tables.moderator_cache: %core.table_prefix%moderator_cache
tables.modules: %core.table_prefix%modules tables.modules: %core.table_prefix%modules
tables.notification_types: %core.table_prefix%notification_types tables.notification_types: %core.table_prefix%notification_types
tables.notifications: %core.table_prefix%notifications tables.notifications: %core.table_prefix%notifications

View file

@ -1,62 +1,79 @@
<?php <?php
/** /**
* *
* This file is part of the phpBB Forum Software package. * This file is part of the phpBB Forum Software package.
* *
* @copyright (c) phpBB Limited <https://www.phpbb.com> * @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0) * @license GNU General Public License, version 2 (GPL-2.0)
* *
* For full copyright and license information, please see * For full copyright and license information, please see
* the docs/CREDITS.txt file. * the docs/CREDITS.txt file.
* *
*/ */
/** /**
*/ */
if (!defined('IN_PHPBB')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }
// set up caching /**
/* @var $cache \phpbb\cache\service */ * Sets compatibility globals in the global scope
$cache = $phpbb_container->get('cache'); *
* This function registers compatibility variables to the global
* variable scope. This is required to make it possible to include this file
* in a service.
*/
function register_compatibility_globals()
{
global $phpbb_container;
// Instantiate some basic classes global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log;
/* @var $phpbb_dispatcher \phpbb\event\dispatcher */ global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
/* @var $request \phpbb\request\request_interface */ // set up caching
$request = $phpbb_container->get('request'); /* @var $cache \phpbb\cache\service */
$cache = $phpbb_container->get('cache');
/* @var $user \phpbb\user */ // Instantiate some basic classes
$user = $phpbb_container->get('user'); /* @var $phpbb_dispatcher \phpbb\event\dispatcher */
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
/* @var $auth \phpbb\auth\auth */ /* @var $request \phpbb\request\request_interface */
$auth = $phpbb_container->get('auth'); $request = $phpbb_container->get('request');
/* @var $db \phpbb\db\driver\driver_interface */ /* @var $user \phpbb\user */
$db = $phpbb_container->get('dbal.conn'); $user = $phpbb_container->get('user');
// Grab global variables, re-cache if necessary /* @var $auth \phpbb\auth\auth */
/* @var $config phpbb\config\db */ $auth = $phpbb_container->get('auth');
$config = $phpbb_container->get('config');
/* @var $phpbb_log \phpbb\log\log_interface */ /* @var $db \phpbb\db\driver\driver_interface */
$phpbb_log = $phpbb_container->get('log'); $db = $phpbb_container->get('dbal.conn');
/* @var $symfony_request \phpbb\symfony_request */ // Grab global variables, re-cache if necessary
$symfony_request = $phpbb_container->get('symfony_request'); /* @var $config phpbb\config\db */
$config = $phpbb_container->get('config');
/* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ /* @var $phpbb_log \phpbb\log\log_interface */
$phpbb_filesystem = $phpbb_container->get('filesystem'); $phpbb_log = $phpbb_container->get('log');
/* @var $phpbb_path_helper \phpbb\path_helper */ /* @var $symfony_request \phpbb\symfony_request */
$phpbb_path_helper = $phpbb_container->get('path_helper'); $symfony_request = $phpbb_container->get('symfony_request');
// load extensions /* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */
/* @var $phpbb_extension_manager \phpbb\extension\manager */ $phpbb_filesystem = $phpbb_container->get('filesystem');
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
/* @var $template \phpbb\template\template */ /* @var $phpbb_path_helper \phpbb\path_helper */
$template = $phpbb_container->get('template'); $phpbb_path_helper = $phpbb_container->get('path_helper');
// load extensions
/* @var $phpbb_extension_manager \phpbb\extension\manager */
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
/* @var $template \phpbb\template\template */
$template = $phpbb_container->get('template');
}
register_compatibility_globals();