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

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69d352549240d_3b101f2880286dd@gitlab-sidekiq-low-urgency-cpu-bound-v2-664f654ff4-x9tsl.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
d6d0e847 by Jonny Bradley at 2026-04-06T06:20:25+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 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

- - - - -


3 changed files:

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


Changes:

=====================================
installer/Installer.php
=====================================
@@ -217,6 +217,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();
@@ -319,9 +320,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
=====================================
@@ -94,7 +94,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/d6d0e84731fab142ccc375f90d60a6aee6b3973f

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d6d0e84731fab142ccc375f90d60a6aee6b3973f
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.