[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] update: Add a new status for patches `FAILED` and only record these as...

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69d4ef80ca0a5_3b190f8c6b1@gitlab-sidekiq-low-urgency-cpu-bound-v2-7fd4f585b8-phvjt.mail>

Jonny Bradley pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
b113bfaa by Jonny Bradley at 2026-04-07T11:42:58+00:00
[FIX] update: Add a new status for patches `FAILED` and only record these as...
---
* [FIX] update: Add a new status for patches `FAILED` and only record these as...
---
* [FIX] update: Add a new status for patches `FAILED` and only record these as...
---
* [FIX] update: Add a new status for patches `FAILED` and only record these as being executed if not successful when using the `auto-register` option, instead of marking all 'NOT_APPLIED' patches as "skipped"

See merge request tikiwiki/tiki!9928


(cherry picked from commit d6d0e84731fab142ccc375f90d60a6aee6b3973f)

10779425 [FIX] update: Add a new status for patches `FAILED` and only record these as...

Co-authored-by: Jonny Bradley <[email protected]>

See merge request tikiwiki/tiki!9962


(cherry picked from commit 5b8259fadacea003732a054d12d626c4c948d12e)

2249fcba [FIX] update: Add a new status for patches `FAILED` and only record these as...

Co-authored-by: Jonny Bradley <[email protected]>

(cherry picked from commit 5674238246e0e9c404715c844a266ef037502a6e)

Co-authored-by: Jonny Bradley <[email protected]>

See merge request tikiwiki/tiki!9963

- - - - -


3 changed files:

- installer/Installer.php
- installer/Patch.php
- lib/core/Tiki/Command/UpdateCommand.php


Changes:

=====================================
installer/Installer.php
=====================================
@@ -219,6 +219,7 @@ class Installer extends TikiDb_Bridge implements SplSubject
                 throw new Exception('No such patch', 1);
             }
         } elseif (! $status) {
+            Patch::$list[$patch]->setStatus(Patch::FAILED);
             throw new Exception('Patch application failed', 2);
         } else {
             Patch::$list[$patch]->record();
@@ -325,9 +326,10 @@ class Installer extends TikiDb_Bridge implements SplSubject
                 if ($throwOnError) {
                     throw new Exception("Failed running query $statement from file $file");
                 }
+            } else {
+                $this->queries['executed'] += 1;
             }
 
-            $this->queries['executed'] += 1;
             $this->queries['currentStmt'] = $statement;
             $this->notify();
         }


=====================================
installer/Patch.php
=====================================
@@ -19,6 +19,7 @@ class Patch
     public const NOT_APPLIED = 0;
     public const ALREADY_APPLIED = 1;
     public const NEWLY_APPLIED = 2;
+    public const FAILED = -1;
 
     private $name;
     private $status = null;
@@ -37,7 +38,7 @@ class Patch
      */
     public function setStatus($status)
     {
-        if (! in_array($status, [self::NOT_APPLIED, self::ALREADY_APPLIED, self::NEWLY_APPLIED])) {
+        if (! in_array($status, [self::NOT_APPLIED, self::ALREADY_APPLIED, self::NEWLY_APPLIED, self::FAILED])) {
             throw new DomainException();
         }
         $this->status = $status;


=====================================
lib/core/Tiki/Command/UpdateCommand.php
=====================================
@@ -93,7 +93,7 @@ class UpdateCommand extends Command
             foreach (array_keys(Patch::getPatches([Patch::NEWLY_APPLIED])) as $patch) {
                 $output->writeln("<info>Installed: $patch</info>");
             }
-            foreach (array_keys(Patch::getPatches([Patch::NOT_APPLIED])) as $patch) {
+            foreach (array_keys(Patch::getPatches([Patch::FAILED])) as $patch) {
                 $output->writeln("<error>Failed: $patch</error>");
 
                 if ($autoRegister) {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b113bfaa281d7663cd9c4f3262e426de1a58ff49

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b113bfaa281d7663cd9c4f3262e426de1a58ff49
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.