Merge pull request #1369 from EXreaction/ticket/11335

Ticket/11335
This commit is contained in:
Nils Adermann 2013-04-25 04:01:38 -07:00
commit 7b144bbff2
27 changed files with 55 additions and 55 deletions

View file

@ -85,9 +85,9 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
// Set up container

View file

@ -4,7 +4,7 @@ services:
arguments:
- @config
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
calls:
- [set_name, [avatar.driver.gravatar]]
@ -16,7 +16,7 @@ services:
arguments:
- @config
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
calls:
- [set_name, [avatar.driver.local]]
@ -28,7 +28,7 @@ services:
arguments:
- @config
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
calls:
- [set_name, [avatar.driver.remote]]
@ -40,7 +40,7 @@ services:
arguments:
- @config
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
calls:
- [set_name, [avatar.driver.upload]]

View file

@ -36,7 +36,7 @@ services:
arguments:
- phpbb_
- %core.root_path%includes/
- .%core.php_ext%
- %core.php_ext%
calls:
- [register, []]
- [set_cache, [@cache.driver]]
@ -46,7 +46,7 @@ services:
arguments:
- phpbb_ext_
- %core.root_path%ext/
- .%core.php_ext%
- %core.php_ext%
calls:
- [register, []]
- [set_cache, [@cache.driver]]
@ -70,7 +70,7 @@ services:
- @template
- @user
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
controller.resolver:
class: phpbb_controller_resolver
@ -134,7 +134,7 @@ services:
- @filesystem
- %tables.ext%
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
ext.finder:
@ -144,7 +144,7 @@ services:
- @filesystem
- %core.root_path%
- @cache.driver
- .%core.php_ext%
- %core.php_ext%
- _ext_finder
filesystem:
@ -173,7 +173,7 @@ services:
class: phpbb_hook_finder
arguments:
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
- @cache.driver
kernel_request_subscriber:
@ -181,7 +181,7 @@ services:
arguments:
- @ext.finder
- %core.root_path%
- .%core.php_ext%
- %core.php_ext%
tags:
- { name: kernel.event_subscriber }

View file

@ -50,9 +50,9 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
// Set up container

View file

@ -54,7 +54,7 @@ class acp_extensions
// If they've specified an extension, let's load the metadata manager and validate it.
if ($ext_name)
{
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, ".$phpEx", $template, $config);
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, $phpEx, $template, $config);
try
{

View file

@ -74,7 +74,7 @@ class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
if (!function_exists('validate_data'))
{
require($this->phpbb_root_path . 'includes/functions_user' . $this->php_ext);
require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$validate_array = validate_data(

View file

@ -63,7 +63,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
if (!function_exists('validate_data'))
{
require($this->phpbb_root_path . 'includes/functions_user' . $this->php_ext);
require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$validate_array = validate_data(
@ -117,7 +117,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
if (!class_exists('fileupload'))
{
include($this->phpbb_root_path . 'includes/functions_upload' . $this->php_ext);
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
}
$types = fileupload::image_types();

View file

@ -27,7 +27,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
public function get_data($row, $ignore_config = false)
{
return array(
'src' => $this->phpbb_root_path . 'download/file' . $this->php_ext . '?avatar=' . $row['avatar'],
'src' => $this->phpbb_root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'],
'width' => $row['avatar_width'],
'height' => $row['avatar_height'],
);
@ -63,7 +63,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
if (!class_exists('fileupload'))
{
include($this->phpbb_root_path . 'includes/functions_upload' . $this->php_ext);
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
}
$upload = new fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false));

View file

@ -52,7 +52,7 @@ class phpbb_class_loader
* @param string $php_ext The file extension for PHP files
* @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface.
*/
public function __construct($prefix, $path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null)
public function __construct($prefix, $path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null)
{
$this->prefix = $prefix;
$this->path = $path;
@ -111,7 +111,7 @@ class phpbb_class_loader
{
if (isset($this->cached_paths[$class]))
{
return $this->path . $this->cached_paths[$class] . $this->php_ext;
return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext;
}
if (!preg_match('/^' . $this->prefix . '[a-zA-Z0-9_]+$/', $class))
@ -136,7 +136,7 @@ class phpbb_class_loader
$relative_path = $dirs . implode(array_slice($parts, $i, sizeof($parts) - $i), '_');
if (!file_exists($this->path . $relative_path . $this->php_ext))
if (!file_exists($this->path . $relative_path . '.' . $this->php_ext))
{
return false;
}
@ -147,7 +147,7 @@ class phpbb_class_loader
$this->cache->put('class_loader_' . $this->prefix, $this->cached_paths);
}
return $this->path . $relative_path . $this->php_ext;
return $this->path . $relative_path . '.' . $this->php_ext;
}
/**

View file

@ -117,7 +117,7 @@ class phpbb_controller_helper
$params = array('controller' => $route);
}
return append_sid($this->phpbb_root_path . 'app' . $this->php_ext . $route_params, $params, $is_amp, $session_id);
return append_sid($this->phpbb_root_path . 'app.' . $this->php_ext . $route_params, $params, $is_amp, $session_id);
}
/**

View file

@ -62,7 +62,7 @@ class phpbb_extension_finder
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = '.php', $cache_name = '_ext_finder')
public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder')
{
$this->extension_manager = $extension_manager;
$this->filesystem = $filesystem;
@ -256,8 +256,8 @@ class phpbb_extension_finder
*/
public function get_classes($cache = true, $use_all_available = false)
{
$this->query['extension_suffix'] .= $this->php_ext;
$this->query['core_suffix'] .= $this->php_ext;
$this->query['extension_suffix'] .= '.' . $this->php_ext;
$this->query['core_suffix'] .= '.' . $this->php_ext;
$files = $this->find($cache, false, $use_all_available);
@ -277,7 +277,7 @@ class phpbb_extension_finder
{
$file = preg_replace('#^includes/#', '', $file);
$classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen($this->php_ext)));
$classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext)));
}
return $classes;
}

View file

@ -51,7 +51,7 @@ class phpbb_extension_manager
* @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_db_migrator $migrator, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_db_migrator $migrator, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
{
$this->container = $container;
$this->phpbb_root_path = $phpbb_root_path;
@ -412,7 +412,7 @@ class phpbb_extension_manager
RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->php_ext)
if ($file_info->isFile() && $file_info->getFilename() == 'ext.' . $this->php_ext)
{
$ext_name = $iterator->getInnerIterator()->getSubPath();

View file

@ -39,7 +39,7 @@ class phpbb_extension_metadata_manager
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $phpEx php file extension
*/
public function __construct($ext_name, phpbb_db_driver $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = '.php', phpbb_template $template, phpbb_config $config)
public function __construct($ext_name, phpbb_db_driver $db, phpbb_extension_manager $extension_manager, $phpbb_root_path, $phpEx = 'php', phpbb_template $template, phpbb_config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->db = $db;

View file

@ -60,7 +60,7 @@ function phpbb_create_dumped_url_matcher(phpbb_extension_finder $finder, $root_p
'class' => 'phpbb_url_matcher',
));
file_put_contents($root_path . 'cache/url_matcher' . $php_ext, $cached_url_matcher_dump);
file_put_contents($root_path . 'cache/url_matcher.' . $php_ext, $cached_url_matcher_dump);
}
/**
@ -87,7 +87,7 @@ function phpbb_create_url_matcher(phpbb_extension_finder $finder, RequestContext
*/
function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
{
require($root_path . 'cache/url_matcher' . $php_ext);
require($root_path . 'cache/url_matcher.' . $php_ext);
return new phpbb_url_matcher($context);
}
@ -102,5 +102,5 @@ function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
*/
function phpbb_url_matcher_dumped($root_path, $php_ext)
{
return file_exists($root_path . 'cache/url_matcher' . $php_ext);
return file_exists($root_path . 'cache/url_matcher.' . $php_ext);
}

View file

@ -66,7 +66,7 @@ class phpbb_hook_finder
{
while (($file = readdir($dh)) !== false)
{
if (strpos($file, 'hook_') === 0 && substr($file, -(strlen($this->php_ext) + 1)) === '.' . $this->php_ext)
if (strpos($file, 'hook_') === 0 && substr($file, -strlen('.' . $this->php_ext)) === '.' . $this->php_ext)
{
$hook_files[] = substr($file, 0, -(strlen($this->php_ext) + 1));
}

View file

@ -95,7 +95,7 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader->register();
// Set up container (must be done here because extensions table may not exist)

View file

@ -90,9 +90,9 @@ include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
// Setup class loader first
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx");
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", $phpEx);
$phpbb_class_loader->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx");
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
$phpbb_class_loader_ext->register();
// Set up container

View file

@ -16,11 +16,11 @@ $table_prefix = 'phpbb_';
require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx;
$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', ".php");
$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php");
$phpbb_class_loader_mock->register();
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".php");
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php");
$phpbb_class_loader_ext->register();
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".php");
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', "php");
$phpbb_class_loader->register();
require_once 'test_framework/phpbb_test_case_helpers.php';

View file

@ -71,8 +71,8 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
$cache = new phpbb_mock_cache($cache_map);
$prefix = dirname(__FILE__) . '/';
$class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', '.php', $cache);
$class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', '.php', $cache);
$class_loader = new phpbb_class_loader('phpbb_', $prefix . 'includes/', 'php', $cache);
$class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'includes/', 'php', $cache);
$prefix .= 'includes/';

View file

@ -52,7 +52,7 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
$this->user = $this->getMock('phpbb_user');
$this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context());
$helper = new phpbb_controller_helper($this->template, $this->user, '', '.php');
$helper = new phpbb_controller_helper($this->template, $this->user, '', 'php');
$this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
}
}

View file

@ -63,7 +63,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
new phpbb_filesystem(),
'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/',
'.php',
'php',
null
);
}

View file

@ -164,7 +164,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache()
{
$cache = new phpbb_mock_cache;
$finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name');
$finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
$files = $finder->suffix('_class.php')->get_files();
$expected_files = array(

View file

@ -115,7 +115,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
new phpbb_filesystem(),
'phpbb_ext',
dirname(__FILE__) . '/',
'.' . $php_ext,
$php_ext,
($with_cache) ? new phpbb_mock_cache() : null
);
}

View file

@ -36,7 +36,7 @@ class metadata_manager_test extends phpbb_database_test_case
$this->db = $this->new_dbal();
$this->db_tools = new phpbb_db_tools($this->db);
$this->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = '.php';
$this->phpEx = 'php';
$this->user = new phpbb_user();
$this->table_prefix = 'phpbb_';

View file

@ -12,7 +12,7 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
public function __construct($phpbb_root_path, $extensions = array())
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = '.php';
$this->php_ext = 'php';
$this->extensions = $extensions;
$this->filesystem = new phpbb_filesystem();
}

View file

@ -92,12 +92,12 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
// Container
$phpbb_container = new phpbb_mock_container_builder();
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, '.' . $phpEx, USERS_TABLE);
$user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
// Notification Manager
$phpbb_notifications = new phpbb_notification_manager(array(), array(),
$phpbb_container, $user_loader, $db, $user,
$phpbb_root_path, '.' . $phpEx,
$phpbb_root_path, $phpEx,
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
$phpbb_container->set('notification_manager', $phpbb_notifications);
@ -108,7 +108,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$class_name = 'phpbb_notification_type_' . $type;
$phpbb_container->set('notification.type.' . $type, new $class_name(
$user_loader, $db, $cache, $user, $auth, $config,
$phpbb_root_path, '.' . $phpEx,
$phpbb_root_path, $phpEx,
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE));
}
}

View file

@ -156,7 +156,7 @@ class phpbb_functional_test_case extends phpbb_test_case
new phpbb_filesystem(),
self::$config['table_prefix'] . 'ext',
dirname(__FILE__) . '/',
'.' . $php_ext,
$php_ext,
$this->get_cache_driver()
);