mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-28 02:20:41 +00:00
output number in updatable, installable extensions, code cleanup
This commit is contained in:
parent
886a5eaf62
commit
929a2acd25
|
|
@ -68,23 +68,21 @@ class UpdateextensionCommand extends Command
|
||||||
$installs = [];
|
$installs = [];
|
||||||
/* Get a list of available extensions from the repository */
|
/* Get a list of available extensions from the repository */
|
||||||
if($ret = $extmgr->updateExtensionList('', true)) {
|
if($ret = $extmgr->updateExtensionList('', true)) {
|
||||||
// $output->writeln(sprintf("<info>Updated extension list from repository.</info>"));
|
|
||||||
// list of installed extensions
|
// list of installed extensions
|
||||||
$extconfs = $extmgr->getExtensionConfiguration();
|
$extconfs = $extmgr->getExtensionConfiguration();
|
||||||
// list of extensions in repository, this will just return the
|
// list of extensions in repository, this will just return the
|
||||||
// latest version of an extension
|
// latest version of an extension
|
||||||
$list = $extmgr->getExtensionList();
|
$list = $extmgr->getExtensionList();
|
||||||
// print_r($list);
|
|
||||||
foreach($list as $extname=>$data) {
|
foreach($list as $extname=>$data) {
|
||||||
$extversions = $extmgr->getExtensionListByName($extname);
|
$extversions = $extmgr->getExtensionListByName($extname);
|
||||||
// print_r($extversions);
|
// $updates[$extname] = [];
|
||||||
$updates[$extname] = [];
|
// $installs[$extname] = [];
|
||||||
$installs[$extname] = [];
|
|
||||||
$allowedversions = [];
|
|
||||||
foreach($extversions as $version=>$extversion) {
|
foreach($extversions as $version=>$extversion) {
|
||||||
|
/* Only version which pass the check will be offered for
|
||||||
|
* update or install.
|
||||||
|
*/
|
||||||
$check = $extmgr->checkExtensionByName($extname, $extversion);
|
$check = $extmgr->checkExtensionByName($extname, $extversion);
|
||||||
if ($check) {
|
if ($check) {
|
||||||
$allowedversions[] = '<info>'.$version.'</info>';
|
|
||||||
if (isset($extconfs[$extname])) {
|
if (isset($extconfs[$extname])) {
|
||||||
if (\Seeddms\Seeddms\ExtensionMgr::cmpVersion($version, $extconfs[$extname]['version']) > 0) {
|
if (\Seeddms\Seeddms\ExtensionMgr::cmpVersion($version, $extconfs[$extname]['version']) > 0) {
|
||||||
$updates[$extname][$version] = $extversion;
|
$updates[$extname][$version] = $extversion;
|
||||||
|
|
@ -92,12 +90,12 @@ class UpdateextensionCommand extends Command
|
||||||
} else {
|
} else {
|
||||||
$installs[$extname][$version] = $extversion;
|
$installs[$extname][$version] = $extversion;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$allowedversions[] = '<error>'.$version.'</error>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$helper = new QuestionHelper();
|
$helper = new QuestionHelper();
|
||||||
|
if($updates) {
|
||||||
|
$output->writeln(sprintf("<options=bold>%d extensions can be updated.</>", count($updates)));
|
||||||
foreach($updates as $extname=>$update) {
|
foreach($updates as $extname=>$update) {
|
||||||
$availableversions = array_keys($update);
|
$availableversions = array_keys($update);
|
||||||
if ($update) {
|
if ($update) {
|
||||||
|
|
@ -124,6 +122,9 @@ class UpdateextensionCommand extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if($installs) {
|
||||||
|
$output->writeln(sprintf("<options=bold>%d extensions can be installed.</>", count($installs)));
|
||||||
foreach($installs as $extname=>$install) {
|
foreach($installs as $extname=>$install) {
|
||||||
$availableversions = array_keys($install);
|
$availableversions = array_keys($install);
|
||||||
if ($install) {
|
if ($install) {
|
||||||
|
|
@ -150,6 +151,7 @@ class UpdateextensionCommand extends Command
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
$output->writeln(sprintf("<error>Could not get extension list from repository.</error>"));
|
$output->writeln(sprintf("<error>Could not get extension list from repository.</error>"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user