mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-23 09:00:48 +01:00
[ticket/11150] Makes minimum-stability configurable
PHPBB3-11150
This commit is contained in:
parent
6bbd8486b2
commit
317c90cf48
@ -62,6 +62,21 @@
|
||||
<label><input type="radio" name="enable_packagist" class="radio" value="0"{% if not settings.enable_packagist %} checked="checked" {% endif %} /> {{ lang('NO') }}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="minimum_stability">{{ lang('COMPOSER_MINIMUM_STABILITY') }}{{ lang('COLON') }}</label><br />
|
||||
<span class="explain">
|
||||
<strong class="error">{{ lang('WARNING') }}{{ lang('COLON') }}</strong> {{ lang('COMPOSER_MINIMUM_STABILITY_EXPLAIN') }}
|
||||
</span>
|
||||
</dt>
|
||||
<dd>
|
||||
<select id="minimum_stability" name="minimum_stability">
|
||||
{% for stability in settings.stabilities %}
|
||||
<option value="{{ stability }}"{% if stability === settings.minimum_stability %} selected='selected'{% endif %}>{{ lang('STABILITY_' ~ stability|upper) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="submit-buttons">
|
||||
<input class="button1" type="submit" name="update" value="{{ lang('SUBMIT') }}" />
|
||||
|
@ -587,6 +587,8 @@ class acp_extensions
|
||||
if (!$this->config['exts_composer_packagist'] && $this->request->is_set('enable_packagist') && confirm_box(true))
|
||||
{
|
||||
$this->config->set('exts_composer_packagist', true);
|
||||
$composer_manager->reset_cache();
|
||||
|
||||
trigger_error($language->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
@ -601,12 +603,25 @@ class acp_extensions
|
||||
$enable_packagist = $this->request->variable('enable_packagist', false);
|
||||
$enable_on_install = $this->request->variable('enable_on_install', false);
|
||||
$purge_on_remove = $this->request->variable('purge_on_remove', false);
|
||||
$minimum_stability = $this->request->variable('minimum_stability', 'stable');
|
||||
$repositories = array_unique(explode("\n", $this->request->variable('repositories', '')));
|
||||
|
||||
$previous_minimum_stability = $this->config['exts_composer_minimum_stability'];
|
||||
$previous_repositories = $this->config['exts_composer_repositories'];
|
||||
$previous_enable_packagist = $this->config['exts_composer_packagist'];
|
||||
|
||||
$this->config->set('exts_composer_enable_on_install', $enable_on_install);
|
||||
$this->config->set('exts_composer_purge_on_remove', $purge_on_remove);
|
||||
$this->config->set('exts_composer_minimum_stability', $minimum_stability);
|
||||
$this->config->set('exts_composer_repositories', json_encode($repositories, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
|
||||
if ($minimum_stability != $previous_minimum_stability
|
||||
|| $repositories != $previous_repositories
|
||||
|| $enable_packagist != $previous_enable_packagist)
|
||||
{
|
||||
$composer_manager->reset_cache();
|
||||
}
|
||||
|
||||
if (!$this->config['exts_composer_packagist'] && $enable_packagist)
|
||||
{
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
@ -651,6 +666,8 @@ class acp_extensions
|
||||
'enable_packagist' => $this->config['exts_composer_packagist'],
|
||||
'enable_on_install' => $this->config['exts_composer_enable_on_install'],
|
||||
'purge_on_remove' => $this->config['exts_composer_purge_on_remove'],
|
||||
'minimum_stability' => $this->config['exts_composer_minimum_stability'],
|
||||
'stabilities' => array_keys(\Composer\Package\BasePackage::$stabilities),
|
||||
'repositories' => json_decode($this->config['exts_composer_repositories'], true),
|
||||
]);
|
||||
$this->template->assign_var('enabled', $manager->check_requirements());
|
||||
|
@ -165,4 +165,14 @@ $lang = array_merge($lang, array(
|
||||
'EXTENSIONS_UPDATED' => 'Extensions successfully updated.',
|
||||
|
||||
'EXTENSIONS_COMPOSER_NOT_WRITABLE' => 'TODO: some required files / directory are not writable => disable ',
|
||||
|
||||
'STABILITY_STABLE' => 'stable',
|
||||
'STABILITY_RC' => 'RC',
|
||||
'STABILITY_BETA' => 'beta',
|
||||
'STABILITY_ALPHA' => 'alpha',
|
||||
'STABILITY_DEV' => 'dev',
|
||||
|
||||
'COMPOSER_MINIMUM_STABILITY' => 'Minimum stability',
|
||||
'COMPOSER_MINIMUM_STABILITY_EXPLAIN' => 'TODO: why it is dangerous to change that',
|
||||
|
||||
));
|
||||
|
@ -55,6 +55,11 @@ class installer
|
||||
*/
|
||||
protected $packages_vendor_dir = 'vendor-ext/';
|
||||
|
||||
/**
|
||||
* @var string Minimum stability
|
||||
*/
|
||||
protected $minimum_stability = 'stable';
|
||||
|
||||
/**
|
||||
* @var string phpBB root path
|
||||
*/
|
||||
@ -88,6 +93,7 @@ class installer
|
||||
$this->packagist = (bool) $config['exts_composer_packagist'];
|
||||
$this->composer_filename = $config['exts_composer_json_file'];
|
||||
$this->packages_vendor_dir = $config['exts_composer_vendor_dir'];
|
||||
$this->minimum_stability = $config['exts_composer_minimum_stability'];
|
||||
}
|
||||
|
||||
$this->root_path = $root_path;
|
||||
@ -484,6 +490,7 @@ class installer
|
||||
'cache-dir' => 'store/composer',
|
||||
'vendor-dir'=> $this->packages_vendor_dir,
|
||||
],
|
||||
'minimum-stability' => $this->minimum_stability,
|
||||
];
|
||||
|
||||
$this->ext_json_file_backup = null;
|
||||
|
@ -263,6 +263,18 @@ class manager implements manager_interface
|
||||
return $this->available_packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset_cache()
|
||||
{
|
||||
$this->cache->destroy('_composer_' . $this->package_type . '_available');
|
||||
|
||||
$this->available_packages = null;
|
||||
$this->managed_packages = null;
|
||||
$this->all_managed_packages = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -78,6 +78,11 @@ interface manager_interface
|
||||
*/
|
||||
public function get_available_packages();
|
||||
|
||||
/**
|
||||
* Reset the cache
|
||||
*/
|
||||
public function reset_cache();
|
||||
|
||||
/**
|
||||
* Start managing a manually installed package
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user