diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php deleted file mode 100644 index 19aebd1fbc..0000000000 --- a/phpBB/includes/functions_url_matcher.php +++ /dev/null @@ -1,102 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; -use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\RequestContext; - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Create a new UrlMatcher class and dump it into the cache file -* -* @param \phpbb\extension\manager $manager Extension manager -* @param RequestContext $context Symfony RequestContext object -* @param string $root_path Root path -* @param string $php_ext PHP file extension -* @return null -*/ -function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext) -{ - global $phpbb_container; - - $config_cache = new ConfigCache($root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/url_matcher.' . $php_ext, defined('DEBUG')); - if (!$config_cache->isFresh()) - { - phpbb_create_dumped_url_matcher($manager, $root_path, $config_cache); - } - - return phpbb_load_url_matcher($context, $root_path, $php_ext); -} - -/** -* Create a new UrlMatcher class and dump it into the cache file -* -* @param \phpbb\extension\manager $manager Extension manager -* @param string $root_path Root path* @param ConfigCache $config_cache The config cache -* @return null -*/ -function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $config_cache) -{ - global $phpbb_container; - - $provider = new \phpbb\controller\provider($phpbb_container->getParameter('core.environment'), $root_path); - $provider->find_routing_files($manager->all_enabled()); - $routes = $provider->find()->get_routes(); - $dumper = new PhpMatcherDumper($routes); - $cached_url_matcher_dump = $dumper->dump(array( - 'class' => 'phpbb_url_matcher', - )); - - $config_cache->write($cached_url_matcher_dump, $routes->getResources()); -} - -/** -* Create a non-cached UrlMatcher -* -* @param \phpbb\extension\manager $manager Extension manager -* @param RequestContext $context Symfony RequestContext object -* @return UrlMatcher -*/ -function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path) -{ - global $phpbb_container; - - $provider = new \phpbb\controller\provider($phpbb_container->getParameter('core.environment'), $root_path); - $provider->find_routing_files($manager->all_enabled()); - $routes = $provider->find()->get_routes(); - return new UrlMatcher($routes, $context); -} - -/** -* Load the cached phpbb_url_matcher class -* -* @param RequestContext $context Symfony RequestContext object -* @param string $root_path Root path -* @param string $php_ext PHP file extension -* @return phpbb_url_matcher -*/ -function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext) -{ - global $phpbb_container; - - require($root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/url_matcher.' . $php_ext); - return new phpbb_url_matcher($context); -}