This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ea7246  Add option to force regeneration of catalogs
4ea7246 is described below

commit 4ea724675d36a65ebc2c07f7df3795e2f56391e6
Author: Matthias Bläsing <mblaes...@doppel-helix.eu>
AuthorDate: Tue Nov 10 21:13:52 2020 +0100

    Add option to force regeneration of catalogs
---
 pp3/module/Application/config/module.config.php.dist             | 2 +-
 .../Application/src/Application/Controller/CliController.php     | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/pp3/module/Application/config/module.config.php.dist 
b/pp3/module/Application/config/module.config.php.dist
index d5c3fba..5dafbfb 100755
--- a/pp3/module/Application/config/module.config.php.dist
+++ b/pp3/module/Application/config/module.config.php.dist
@@ -258,7 +258,7 @@ return array(
             'routes' => array(
                 'generate-catalogs' => array(
                     'options' => array(
-                        'route' => 'generate-catalogs',
+                        'route' => 'generate-catalogs [--force]',
                         'defaults' => array(
                             '__NAMESPACE__' => 'Application\Controller',
                             'controller' => 'Cli',
diff --git 
a/pp3/module/Application/src/Application/Controller/CliController.php 
b/pp3/module/Application/src/Application/Controller/CliController.php
index d50bb88..6f9f3df 100644
--- a/pp3/module/Application/src/Application/Controller/CliController.php
+++ b/pp3/module/Application/src/Application/Controller/CliController.php
@@ -48,18 +48,19 @@ class CliController extends BaseController {
     }
 
     public function generateCatalogsAction() {
+        $force = $this->request->getParams()->get('force');
         printf("Regenerating catalogs " . ((new 
\DateTime('now'))->format("Y-m-d\TH:i:sO")). "\n");
         $versions = 
$this->_nbVersionRepository->getEntityRepository()->findAll();
         foreach ($versions as $v) {
-            $this->createCatalog($v, true);
-            $this->createCatalog($v, false);
+            $this->createCatalog($v, true, $force);
+            $this->createCatalog($v, false, $force);
 
             $v->markCatalogRebuild();
             $this->_nbVersionRepository->persist($v);
         }
     }
 
-    private function createCatalog(\Application\Entity\NbVersion $version, 
$experimental) {
+    private function createCatalog(\Application\Entity\NbVersion $version, 
$experimental, $force) {
         if ($experimental) {
             $items = 
$this->_pluginVersionRepository->getNonVerifiedVersionsByNbVersion($version->getVersion(),
 true);
         } else {
@@ -83,6 +84,8 @@ class CliController extends BaseController {
 
         $rebuildNeeded |= (! $catalog->catalogFileExits());
 
+        $rebuildNeeded |= $force;
+
         if (! $rebuildNeeded) {
             printf("Skipping %scatalog for %s\n", $experimental ? 
'experimental ' : '', $version->getVersion());
             return;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to