mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
add deprecation, remove class_exists
This commit is contained in:
parent
2600b26617
commit
b53148c034
@ -8,6 +8,7 @@ use Psr\SimpleCache\CacheInterface;
|
|||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version provider will look up configured modules and examine the composer.lock file
|
* The version provider will look up configured modules and examine the composer.lock file
|
||||||
@ -185,33 +186,23 @@ class VersionProvider
|
|||||||
*/
|
*/
|
||||||
public function getModuleVersionFromComposer($modules = [])
|
public function getModuleVersionFromComposer($modules = [])
|
||||||
{
|
{
|
||||||
if (class_exists(\Composer\InstalledVersions::class)) {
|
|
||||||
$versions = [];
|
$versions = [];
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$versions[$module] = \Composer\InstalledVersions::getPrettyVersion($module);
|
$versions[$module] = \Composer\InstalledVersions::getPrettyVersion($module);
|
||||||
}
|
}
|
||||||
return $versions;
|
return $versions;
|
||||||
}
|
}
|
||||||
$versions = [];
|
|
||||||
$lockData = $this->getComposerLock();
|
|
||||||
if ($lockData && !empty($lockData['packages'])) {
|
|
||||||
foreach ($lockData['packages'] as $package) {
|
|
||||||
if (in_array($package['name'], $modules) && isset($package['version'])) {
|
|
||||||
$versions[$package['name']] = $package['version'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $versions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load composer.lock's contents and return it
|
* Load composer.lock's contents and return it
|
||||||
*
|
*
|
||||||
|
* @deprecated 5.1 Has been replaced by composer-runtime-api
|
||||||
* @param bool $cache
|
* @param bool $cache
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getComposerLock($cache = true)
|
protected function getComposerLock($cache = true)
|
||||||
{
|
{
|
||||||
|
Deprecation::notice("5.1", "Has been replaced by composer-runtime-api", Deprecation::SCOPE_METHOD);
|
||||||
$composerLockPath = $this->getComposerLockPath();
|
$composerLockPath = $this->getComposerLockPath();
|
||||||
if (!file_exists($composerLockPath)) {
|
if (!file_exists($composerLockPath)) {
|
||||||
return [];
|
return [];
|
||||||
|
Loading…
Reference in New Issue
Block a user