mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/10824] Make styles use composer.json files
PHPBB3-10824
This commit is contained in:
committed by
Marc Alexander
parent
cd74556058
commit
a200446646
5
phpBB/phpbb/cache/service.php
vendored
5
phpBB/phpbb/cache/service.php
vendored
@@ -344,7 +344,7 @@ class service
|
||||
$parsed_array = array();
|
||||
}
|
||||
|
||||
$filename = $this->phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg';
|
||||
$filename = $this->phpbb_root_path . 'styles/' . $style['style_path'] . '/composer.json';
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
@@ -354,7 +354,8 @@ class service
|
||||
if (!isset($parsed_array['filetime']) || (($this->config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||
{
|
||||
// Re-parse cfg file
|
||||
$parsed_array = parse_cfg_file($filename);
|
||||
$json = file_get_contents($filename);
|
||||
$parsed_array = json_decode($json, true);
|
||||
$parsed_array['filetime'] = @filemtime($filename);
|
||||
|
||||
$this->driver->put('_cfg_' . $style['style_path'], $parsed_array);
|
||||
|
@@ -69,10 +69,11 @@ class style_update_p1 extends \phpbb\db\migration\migration
|
||||
$skip_dirs = array('.', '..', 'prosilver');
|
||||
foreach ($iterator as $fileinfo)
|
||||
{
|
||||
if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/style.cfg'))
|
||||
if ($fileinfo->isDir() && !in_array($fileinfo->getFilename(), $skip_dirs) && file_exists($fileinfo->getPathname() . '/composer.json'))
|
||||
{
|
||||
$style_cfg = parse_cfg_file($fileinfo->getPathname() . '/style.cfg');
|
||||
if (isset($style_cfg['phpbb_version']) && version_compare($style_cfg['phpbb_version'], '3.1.0-dev', '>='))
|
||||
$json = file_get_contents($fileinfo->getPathname() . '/composer.json');
|
||||
$style_data = json_decode($json, true);
|
||||
if (isset($style_data['extra']['phpbb-version']) && version_compare($style_data['extra']['phpbb-version'], '3.1.0-dev', '>='))
|
||||
{
|
||||
// 3.1 style
|
||||
$available_styles[] = $fileinfo->getFilename();
|
||||
|
@@ -49,11 +49,8 @@ class style_update extends \phpbb\db\migration\migration
|
||||
// Install prosilver if no style is available and prosilver can be installed
|
||||
if (empty($style_paths) && in_array('prosilver', $styles))
|
||||
{
|
||||
// Try to parse config file
|
||||
$cfg = parse_cfg_file($this->phpbb_root_path . 'styles/prosilver/style.cfg');
|
||||
|
||||
// Stop running this if prosilver cfg file can't be read
|
||||
if (empty($cfg))
|
||||
// Stop running this if prosilver composer.json file can't be read
|
||||
if (file_exists($this->phpbb_root_path . 'styles/prosilver/composer.json'))
|
||||
{
|
||||
throw new \RuntimeException('No styles available and could not fall back to prosilver.');
|
||||
}
|
||||
@@ -123,7 +120,7 @@ class style_update extends \phpbb\db\migration\migration
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file_exists("{$dir}/style.cfg"))
|
||||
if (file_exists("{$dir}/composer.json"))
|
||||
{
|
||||
$styles[] = $file;
|
||||
}
|
||||
|
Reference in New Issue
Block a user