[TikiWiki-commits] [Git][tikiwiki/tiki][tiki-fix-installer-secdb-fallback-idempotent] 6 commits: [FIX] AutoIncrement race condition: try to resolve duplicate values when...
"Sammy Ndabo \(@ndabosam084\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <699c609a5c7bb_3b186f8c442c@gitlab-sidekiq-low-urgency-cpu-bound-v2-5b77bfdff7-99qh6.mail> |
Sammy Ndabo pushed to branch tiki-fix-installer-secdb-fallback-idempotent at Tiki Wiki CMS Groupware / Tiki
Commits:
d1b18b7b by Victor Emanouilov at 2026-02-23T12:27:21+02:00
[FIX] AutoIncrement race condition: try to resolve duplicate values when records are created at the same time
- - - - -
f2048d80 by Victor Emanouilov at 2026-02-23T13:27:28+02:00
[FIX] ability to print pdf from specific page's edit permission
- - - - -
b32f2f90 by Victor Emanouilov at 2026-02-23T14:12:45+02:00
[FIX] editable format blocks: inline ones prefer text field rather than wysiwyg even if smarty renders them
- - - - -
5f9c6ddd by Bruno Kambere at 2026-02-23T13:34:09+00:00
[TRA] fr - Add French translations for calendar-related terms
---
* [TRA] fr - Add French translations for calendar-related terms and update button labels
See merge request tikiwiki/tiki!9629
- - - - -
617ce7d1 by Sammy Ndabo at 2026-02-23T16:11:24+02:00
[FIX] installer: make secdb SQL fallback import idempotent
- - - - -
93eeff6e by Sammy Ndabo at 2026-02-23T16:11:24+02:00
[FIX] installer: refactor secdb truncation logic to avoid code repetition
- - - - -
6 changed files:
- installer/Installer.php
- lang/fr/language.js
- lib/core/Search/Formatter/Plugin/SmartyTemplate.php
- lib/core/Services/PDF/Controller.php
- lib/core/Tracker/Field/AutoIncrement.php
- src/js/jquery-tiki/tiki-calendar.js
Changes:
=====================================
installer/Installer.php
=====================================
@@ -129,11 +129,15 @@ class Installer extends TikiDb_Bridge implements SplSubject
if ($rc == false) {
// The batch loader failed
if (file_exists($secdb)) {
+ // Mirror runDataFile behavior to avoid duplicate PK rows on re-runs.
+ $this->truncateSecdbIfExists();
// Run single inserts
$this->runFile($secdb, false);
}
}
} elseif (file_exists($secdb)) {
+ // Keep fallback SQL path idempotent, as with .data loading.
+ $this->truncateSecdbIfExists();
// Run single inserts
$this->runFile($secdb, false);
}
@@ -241,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)
{
=====================================
lang/fr/language.js
=====================================
@@ -52,6 +52,21 @@ lang = {
"Select Some Options" : "Sélectionnez quelques options",
"No results match" : "Aucun résultat ne correspond",
"Warning: You have exceeded the allowed limit of %0 characters" : "Attention : vous avez dépassé la limite autorisée de %0 caractères.",
+ "Bogus entry" : "Entrée erronnée",
+ "day" : "jour",
+ "today" : "aujourd'hui",
+ "all-day" : "toute la journée",
+ "week" : "semaine",
+ "month" : "mois",
+ "One-Month" : "Un mois",
+ "Quarter" : "Trimestre",
+ "Semester" : "Semestre",
+ "list" : "liste",
+ "Loading..." : "Chargement...",
+ "Copy link to this event" : "Copier le lien de cet événement",
+ "Copied to clipboard" : "Copié dans le presse-papiers",
+ "Failure to copy. Check permissions for clipboard" : "Échec de la copie. Vérifiez les permissions du presse-papiers",
+ "New event" : "Nouvel événement",
+ "Edit event" : "Modifier l'événement"
// remember the IE does not support ending comma on last item
- "Bogus entry" : "Entrée erronnée"
};
=====================================
lib/core/Search/Formatter/Plugin/SmartyTemplate.php
=====================================
@@ -164,7 +164,7 @@ class Search_Formatter_Plugin_SmartyTemplate implements Search_Formatter_Plugin_
'field' => [
'id' => $this->editableId,
'type' => 'form',
- 'wysiwyg' => true,
+ 'wysiwyg' => $this->editable === 'inline' ? false : true,
],
],
);
=====================================
lib/core/Services/PDF/Controller.php
=====================================
@@ -16,7 +16,12 @@ class Services_PDF_Controller
global $prefs;
// edit permission is needed to convert arbitrary text to PDF
- if (! Perms::get()->edit) {
+ if ($input->page->pagename()) {
+ $perms = Perms::get('wiki page', $input->page->pagename());
+ } else {
+ $perms = Perms::get();
+ }
+ if (! $perms->edit) {
throw new Services_Exception_Denied();
}
=====================================
lib/core/Tracker/Field/AutoIncrement.php
=====================================
@@ -149,6 +149,51 @@ class Tracker_Field_AutoIncrement extends \Tracker\Field\AbstractItemField imple
return false;
}
+ /**
+ * After the item is saved, check for duplicate auto-increment values that
+ * can occur when concurrent processes both read the same maximum value
+ * before either has persisted its result. If a duplicate is found,
+ * re-read the current maximum and assign a new unique value.
+ */
+ public function postSaveHook($value)
+ {
+ // itemId mode uses the actual DB item ID — duplicates are impossible
+ if ($this->getOption('itemId') == 'itemId') {
+ return;
+ }
+
+ $itemId = $this->getItemId();
+ $fieldId = $this->getConfiguration('fieldId');
+
+ if (! $itemId || $value === false || $value === null || $value === '') {
+ return;
+ }
+
+ global $prefs;
+ $trklib = TikiLib::lib('trk');
+ $table = TikiDb::get()->table('tiki_tracker_item_fields');
+
+ $maxRetries = 3;
+ for ($i = 0; $i < $maxRetries; $i++) {
+ $duplicateCount = $table->fetchCount([
+ 'fieldId' => (int)$fieldId,
+ 'value' => (string)$value,
+ ]);
+
+ if ($duplicateCount <= 1) {
+ break;
+ }
+
+ $maxValue = $trklib->get_maximum_value($fieldId);
+ if ($prefs['tracker_autoincrement_resettable'] == 'y') {
+ $value = max($maxValue + 1, $this->getOption('start', 1));
+ } else {
+ $value = $maxValue + 1;
+ }
+ $trklib->modify_field($itemId, $fieldId, $value);
+ }
+ }
+
public function getTabularSchema()
{
$schema = new Tracker\Tabular\Schema($this->getTrackerDefinition());
=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -56,8 +56,19 @@ $.fn.setupEventCalendar = function (
if (!document.getElementById("quarter")) {
const ecStart = document.querySelector(".ec-start");
const buttonMonthView = document.createElement("div");
+ const quarterText = tr("Quarter");
+ const semesterText = tr("Semester");
+ const oneMonthText = tr("One-Month");
buttonMonthView.innerHTML =
- '<button class="ec-button" id="one-month">One-Month</button><button class="ec-button" id="quarter">Quarter</button><button class="ec-button" id="semester">Semester</button>';
+ '<button class="ec-button" id="one-month">' +
+ oneMonthText +
+ "</button>" +
+ '<button class="ec-button" id="quarter">' +
+ quarterText +
+ "</button>" +
+ '<button class="ec-button" id="semester">' +
+ semesterText +
+ "</button>";
ecStart.appendChild(buttonMonthView);
}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/9a347bd213555e77eb66c78ba3aa044cee7efa39...93eeff6e890056c87cb23550487007733604ce58
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/9a347bd213555e77eb66c78ba3aa044cee7efa39...93eeff6e890056c87cb23550487007733604ce58
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