From 477c7cb4e85002ab4cbe9a9f555cfe6115d5ce25 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 17 Feb 2026 15:49:21 -0800 Subject: [PATCH 1/2] Apply %mail% and %user% substitutions to all commit messages, add page %ns% substitution --- action/editcommit.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/action/editcommit.php b/action/editcommit.php index 91b68a3..ac2bae9 100644 --- a/action/editcommit.php +++ b/action/editcommit.php @@ -97,6 +97,12 @@ private function isIgnored($filePath) private function commitFile($filePath, $message) { if (!$this->isIgnored($filePath)) { + $message = str_replace( + ['%user%', '%mail%', '\n'], + [$this->getAuthor(), $this->getAuthorMail(), "\n"], + $message + ); + try { $repo = $this->initRepo(); @@ -232,8 +238,8 @@ public function handleMediaDeletion(Event &$event, $param) $mediaName = $event->data['name']; $message = str_replace( - ['%media%', '%user%'], - [$mediaName, $this->getAuthor()], + ['%media%'], + [$mediaName], $this->getConf('commitMediaMsgDel') ); @@ -247,8 +253,8 @@ public function handleMediaUpload(Event &$event, $param) $mediaName = $event->data[2]; $message = str_replace( - ['%media%', '%user%'], - [$mediaName, $this->getAuthor()], + ['%media%'], + [$mediaName], $this->getConf('commitMediaMsg') ); @@ -267,6 +273,7 @@ public function handleIOWikiPageWrite(Event &$event, $param) if (!$rev) { $pagePath = $event->data[0][0]; $pageName = $event->data[2]; + $pageNs = $event->data[1]; $pageContent = $event->data[0][1]; // get the summary directly from the form input @@ -288,8 +295,8 @@ public function handleIOWikiPageWrite(Event &$event, $param) } $message = str_replace( - ['%page%', '%summary%', '%user%'], - [$pageName, $editSummary, $this->getAuthor()], + ['%page%', '%summary%', '%ns%'], + [$pageName, $editSummary, $pageNs], $msgTemplate ); From 1bd38d0c57611b671ef4c54d952b4e6e6039c8ed Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 17 Feb 2026 15:49:38 -0800 Subject: [PATCH 2/2] Document new substitutions --- lang/en/settings.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/en/settings.php b/lang/en/settings.php index 1486e36..a3f7db1 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -10,10 +10,10 @@ $lang['periodicPull'] = 'Pull the remote git repository every "periodicMinutes" triggered by a http page request'; $lang['updateIndexOnPull'] = 'Update index of pages changed on pull'; $lang['periodicMinutes'] = 'Timespan (in minutes) between periodic pull requests'; -$lang['commitPageMsg'] = 'Commit message for page edits (%user%,%summary%,%page% are replaced by the corresponding values)'; -$lang['commitPageMsgDel'] = 'Commit message for deleted pages (%user%,%summary%,%page% are replaced by the corresponding values)'; -$lang['commitMediaMsg'] = 'Commit message for media files (%user%,%media% are replaced by the corresponding values)'; -$lang['commitMediaMsgDel'] = 'Commit message for deleted media files (%user%,%media% are replaced by the corresponding values)'; +$lang['commitPageMsg'] = 'Commit message for page edits (%user%,%mail%,%summary%,%page%,%ns% are replaced by the corresponding values)'; +$lang['commitPageMsgDel'] = 'Commit message for deleted pages (%user%,%mail%,%summary%,%page%,%ns% are replaced by the corresponding values)'; +$lang['commitMediaMsg'] = 'Commit message for media files (%user%,%mail%,%media% are replaced by the corresponding values)'; +$lang['commitMediaMsgDel'] = 'Commit message for deleted media files (%user%,%mail%,%media% are replaced by the corresponding values)'; $lang['repoPath'] = 'Path of the git repo(s) (e.g. the savedir ' . $GLOBALS['conf']['savedir'] . ')'; $lang['repoWorkDir'] = 'Path of the git working tree, must contain "pages" and "media" directories (e.g. the savedir ' . $GLOBALS['conf']['savedir'] . ')'; $lang['gitPath'] = 'Path to the git binary (if empty, the default "/usr/bin/git" will be used)';