[TikiWiki-commits] [Git][tikiwiki/tiki][tiki-fix-installer-secdb-fallback-idempotent] [FIX] installer: refactor secdb truncation logic to avoid code repetition

"Sammy Ndabo \(@ndabosam084\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <698df74e860c2_3b13db55c830ef@gitlab-sidekiq-low-urgency-cpu-bound-v2-759d7d4599-77rsj.mail>

Sammy Ndabo pushed to branch tiki-fix-installer-secdb-fallback-idempotent at Tiki Wiki CMS Groupware / Tiki


Commits:
ec1794b1 by Sammy Ndabo at 2026-02-12T17:51:34+02:00
[FIX] installer: refactor secdb truncation logic to avoid code repetition

- - - - -


1 changed file:

- installer/Installer.php


Changes:

=====================================
installer/Installer.php
=====================================
@@ -130,18 +130,14 @@ class Installer extends TikiDb_Bridge implements SplSubject
                 // The batch loader failed
                 if (file_exists($secdb)) {
                     // Mirror runDataFile behavior to avoid duplicate PK rows on re-runs.
-                    if ($this->tableExists('tiki_secdb')) {
-                        $this->query('TRUNCATE TABLE `tiki_secdb`');
-                    }
+                    $this->truncateSecdbIfExists();
                     // Run single inserts
                     $this->runFile($secdb, false);
                 }
             }
         } elseif (file_exists($secdb)) {
             // Keep fallback SQL path idempotent, as with .data loading.
-            if ($this->tableExists('tiki_secdb')) {
-                $this->query('TRUNCATE TABLE `tiki_secdb`');
-            }
+            $this->truncateSecdbIfExists();
             // Run single inserts
             $this->runFile($secdb, false);
         }
@@ -249,6 +245,13 @@ class Installer extends TikiDb_Bridge implements SplSubject
         $this->executed[] = $script;
     }
 
+    private function truncateSecdbIfExists()
+    {
+        if ($this->tableExists('tiki_secdb')) {
+            $this->query('TRUNCATE TABLE `tiki_secdb`');
+        }
+    }
+
 
     private function applyProfile($profileFile)
     {



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ec1794b1e3ca4c64c0c08f06dc65ff1c53252143
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.