Skip to content

Commit 1b212aa

Browse files
Miro-Collasglensc
andauthored
Fix namespace detection for pages in root (#30)
Co-authored-by: Elan Ruusamäe <glen@pld-linux.org>
1 parent 1058714 commit 1b212aa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ Download the latest release from [Tags] page and install the plugin using the
2020
1. Create an Incoming Webhook on slack: https://api.slack.com/messaging/webhooks#create_a_webhook
2121

2222
2. Enter the webhook into the slacknotifier configuration section in DokuWiki's Configuration Settings
23+
24+
## Root Namespace
25+
26+
To include the root namespace, simply put a `:` in the namespace field in the config.

event/PageSaveEvent.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public function getEventType(): ?string
3434
*/
3535
public function getNamespace(): string
3636
{
37+
// Handle special case of page being in root namespace
38+
$pos = strpos($this->id, ':');
39+
if ($pos === false) {
40+
return ':';
41+
}
42+
3743
return explode(':', $this->id, 2)[0];
3844
}
3945

0 commit comments

Comments
 (0)