diff --git a/includes/Hooks.php b/includes/Hooks.php index 925196a..799fbc2 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -53,6 +53,11 @@ class Hooks { } } + /** + * @param Title $title + * @param $url + * @param $query + */ public static function onGetArticleUrl(\Title &$title, &$url, $query){ try { if(in_array($title->getNamespace(), self::$allowedNS) && Utils::titleSlugExists($title)){ diff --git a/includes/Utils.php b/includes/Utils.php index 55291be..ee48e68 100644 --- a/includes/Utils.php +++ b/includes/Utils.php @@ -1,11 +1,11 @@ getId()) return false; - $matchRecords = self::$dbr->selectField('revision', 'COUNT(*)', [ - 'rev_page' => $title->getArticleID(), - 'rev_user' => $user->getId(), - ], __METHOD__); - $matchRecords = intval($matchRecords); - return $matchRecords > 0; + if($user->isAnon()) return false; + $wikiPage = Article::newFromID($title->getArticleID())->getPage(); + $contributors = $wikiPage->getContributors(); + foreach($contributors as $contributor){ + if($contributor->equals($user)){ + return true; + } + } + return false; } public static function encodeUriComponent($str){ @@ -311,7 +312,7 @@ class Utils { } /** - * @param Language|string $language - 语言 + * @param Language|string|null $language - 语言 * @return BaseConvertor 转换器 */ public static function getConvertor($language = null){