[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

@ -18,6 +18,20 @@ if (!defined('IN_PHPBB'))
exit; exit;
} }
/**
* Sets compatibility globals in the global scope
*
* 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;
global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $phpbb_log;
global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template;
// set up caching // set up caching
/* @var $cache \phpbb\cache\service */ /* @var $cache \phpbb\cache\service */
$cache = $phpbb_container->get('cache'); $cache = $phpbb_container->get('cache');
@ -60,3 +74,6 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager');
/* @var $template \phpbb\template\template */ /* @var $template \phpbb\template\template */
$template = $phpbb_container->get('template'); $template = $phpbb_container->get('template');
}
register_compatibility_globals();