mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11700] Add develop scripts to use namespaces and rename interfaces
PHPBB3-11700
This commit is contained in:
36
phpBB/develop/rename_interfaces.php
Normal file
36
phpBB/develop/rename_interfaces.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$code_dir = realpath(__DIR__ . '/../');
|
||||
$test_dir = realpath(__DIR__ . '/../../tests/');
|
||||
$iterator = new \AppendIterator();
|
||||
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($code_dir)));
|
||||
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($test_dir)));
|
||||
|
||||
$map = array(
|
||||
'phpbb\request\request_interface' => 'phpbb\request\request_interface',
|
||||
'phpbb\auth\provider\provider_interface' => 'phpbb\auth\provider\provider_interface',
|
||||
'phpbb\avatar\driver\driver_interface' => 'phpbb\avatar\driver\driver_interface',
|
||||
'phpbb\cache\driver\driver_interface' => 'phpbb\cache\driver\driver_interface',
|
||||
'phpbb\db\migration\tool\tool_interface' => 'phpbb\db\migration\tool\tool_interface',
|
||||
'phpbb\extension\extension_interface' => 'phpbb\extension\extension_interface',
|
||||
'phpbb\groupposition\groupposition_interface' => 'phpbb\groupposition\groupposition_interface',
|
||||
'phpbb\log\log_interface' => 'phpbb\log\log_interface',
|
||||
'phpbb\notification\method\method_interface' => 'phpbb\notification\method\method_interface',
|
||||
'phpbb\notification\type\type_interface' => 'phpbb\notification\type\type_interface',
|
||||
'phpbb\request\request_interface' => 'phpbb\request\request_interface',
|
||||
'phpbb\tree\tree_interface' => 'phpbb\tree\tree_interface',
|
||||
);
|
||||
|
||||
foreach ($iterator as $file)
|
||||
{
|
||||
if ($file->getExtension() == 'php')
|
||||
{
|
||||
$code = file_get_contents($file->getPathname());
|
||||
|
||||
foreach ($map as $orig => $new)
|
||||
{
|
||||
$code = preg_replace("#([^a-z0-9_\$])$orig([^a-z0-9_])#i", '\\1' . $new . '\\2', $code);
|
||||
}
|
||||
file_put_contents($file->getPathname(), $code);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user