mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/extension-manager] Don't cache the phpbb_root_path in the ext manager
Otherwise the paths are incorrect from e.g. adm/ PHPBB3-10323
This commit is contained in:
parent
6c6a7d7992
commit
6ea6d50ccb
4 changed files with 15 additions and 7 deletions
|
@ -161,6 +161,8 @@ class phpbb_extension_finder
|
||||||
*/
|
*/
|
||||||
public function directory($directory)
|
public function directory($directory)
|
||||||
{
|
{
|
||||||
|
$directory = preg_replace('#(?:^|/)\./#', '/', $directory);
|
||||||
|
|
||||||
if (strlen($directory) > 1 && $directory[strlen($directory) - 1] === '/')
|
if (strlen($directory) > 1 && $directory[strlen($directory) - 1] === '/')
|
||||||
{
|
{
|
||||||
$directory = substr($directory, 0, -1);
|
$directory = substr($directory, 0, -1);
|
||||||
|
|
|
@ -93,7 +93,7 @@ class phpbb_extension_manager
|
||||||
*/
|
*/
|
||||||
public function get_extension_path($name)
|
public function get_extension_path($name)
|
||||||
{
|
{
|
||||||
return $this->phpbb_root_path . 'ext/' . basename($name) . '/';
|
return 'ext/' . basename($name) . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -315,7 +315,13 @@ class phpbb_extension_manager
|
||||||
*/
|
*/
|
||||||
public function all_configured()
|
public function all_configured()
|
||||||
{
|
{
|
||||||
return $this->extensions;
|
$configured = array();
|
||||||
|
foreach ($this->extensions as $name => $data)
|
||||||
|
{
|
||||||
|
$data['ext_path'] = $this->phpbb_root_path . $data['ext_path'];
|
||||||
|
$configured[$name] = $data;
|
||||||
|
}
|
||||||
|
return $configured;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -331,7 +337,7 @@ class phpbb_extension_manager
|
||||||
{
|
{
|
||||||
if ($data['ext_active'])
|
if ($data['ext_active'])
|
||||||
{
|
{
|
||||||
$enabled[$name] = $data['ext_path'];
|
$enabled[$name] = $this->phpbb_root_path . $data['ext_path'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $enabled;
|
return $enabled;
|
||||||
|
@ -350,7 +356,7 @@ class phpbb_extension_manager
|
||||||
{
|
{
|
||||||
if (!$data['ext_active'])
|
if (!$data['ext_active'])
|
||||||
{
|
{
|
||||||
$disabled[$name] = $data['ext_path'];
|
$disabled[$name] = $this->phpbb_root_path . $data['ext_path'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $disabled;
|
return $disabled;
|
||||||
|
|
|
@ -19,7 +19,7 @@ class phpbb_cron_provider_test extends PHPUnit_Framework_TestCase
|
||||||
'testext' => array(
|
'testext' => array(
|
||||||
'ext_name' => 'testext',
|
'ext_name' => 'testext',
|
||||||
'ext_active' => true,
|
'ext_active' => true,
|
||||||
'ext_path' => dirname(__FILE__) . '/ext/testext/'
|
'ext_path' => 'ext/testext/'
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
$this->provider = new phpbb_cron_provider($this->extension_manager);
|
$this->provider = new phpbb_cron_provider($this->extension_manager);
|
||||||
|
|
|
@ -23,12 +23,12 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||||
'foo' => array(
|
'foo' => array(
|
||||||
'ext_name' => 'foo',
|
'ext_name' => 'foo',
|
||||||
'ext_active' => '1',
|
'ext_active' => '1',
|
||||||
'ext_path' => dirname(__FILE__) . '/ext/foo/',
|
'ext_path' => 'ext/foo/',
|
||||||
),
|
),
|
||||||
'bar' => array(
|
'bar' => array(
|
||||||
'ext_name' => 'bar',
|
'ext_name' => 'bar',
|
||||||
'ext_active' => '1',
|
'ext_active' => '1',
|
||||||
'ext_path' => dirname(__FILE__) . '/ext/bar/',
|
'ext_path' => 'ext/bar/',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue