diff --git a/.gitignore b/.gitignore index 7fcf654..323211b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ LatinizeUrl.zip -includes/._Utils.php diff --git a/includes/Hooks.php b/includes/Hooks.php index 97ba04d..26769de 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -46,6 +46,8 @@ class Hooks { $request->setVal('title', $title->getPrefixedDBkey()); } elseif($wgLatinizeUrlForceRedirect && !($request->getVal('action') && $request->getVal('action') != 'view') + && !$request->getVal('veaction') + && !defined('MW_API') && in_array($title->getNamespace(), self::$allowedNS)) { //把原标题页面重定向到拼音页面 $slug = Utils::getSlugUrlByTitle($title); if($slug) $title = Title::newFromText($slug, $title->getNamespace()); diff --git a/includes/Utils.php b/includes/Utils.php index 3c49357..d082bb5 100644 --- a/includes/Utils.php +++ b/includes/Utils.php @@ -97,7 +97,7 @@ class Utils { ], __METHOD__, [ 'LIMIT' => 1, ]); - if($res->numRows() > 0){ + if ($res->numRows() > 0) { $data = $res->fetchRow(); return $data['title']; } else { @@ -300,7 +300,7 @@ class Utils { 'title' => $title, ], __METHOD__); - self::$dbr->delete('url_slug', [ + self::$dbw->delete('url_slug', [ 'title' => $title, ]); diff --git a/specials/SpecialCustomUrl.php b/specials/SpecialCustomUrl.php index fd4c566..d6b528b 100644 --- a/specials/SpecialCustomUrl.php +++ b/specials/SpecialCustomUrl.php @@ -127,7 +127,6 @@ class SpecialCustomUrl extends FormSpecialPage $originSubpaeSlug = Utils::getSlugByTitle($subpage); if(strpos($originSubpaeSlug, $originSlug) === 0){ $newSubpageSlug = $realSlug . substr($originSubpaeSlug, $originSlugLen); - var_dump($newSubpageSlug); Utils::updateTitleSlugMap($subpage->getText(), $newSubpageSlug, [$newSubpageSlug], 1); } }