From c1cef781435055772712b128f274c8125fe21664 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Sat, 1 Feb 2025 10:03:17 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=9A=94=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/Utils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/Utils.php b/includes/Utils.php index d00dd5e..f402bfd 100755 --- a/includes/Utils.php +++ b/includes/Utils.php @@ -14,6 +14,7 @@ class Utils { private static $dbr = null; private static $dbw = null; private static $cache = null; + private const PAGE_ID_SEPARATOR = '-'; public static function initMasterDb() { if (!self::$dbw) { @@ -86,7 +87,7 @@ class Utils { $wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); // 新版在URL中加了pageId - if (preg_match('/^(\d+?)~/', $url, $matches)) { + if (preg_match('/^(\d+?)' + self::PAGE_ID_SEPARATOR + '/', $url, $matches)) { $pageId = intval($matches[1]); $wikiPage = $wikiPageFactory->newFromID($pageId); @@ -234,7 +235,7 @@ class Utils { if ($wikiPage) { $pageId = $wikiPage->getId(); - $slugUrl = "{$pageId}~" . $slugUrl; + $slugUrl = $pageId . self::PAGE_ID_SEPARATOR . $slugUrl; } }