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