Albert221 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401411 )
Change subject: Fix wgRestrictionEdit not exists in mw.config ...................................................................... Fix wgRestrictionEdit not exists in mw.config Added new TitleExists hook that gives true whether an Org or a Course actually exists. Bug: T133289 Change-Id: Ibe447488959e85f335af654e714db136ff22c8ab --- M EducationProgram.hooks.php M extension.json 2 files changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram refs/changes/11/401411/1 diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php index 72191aa..17308e8 100644 --- a/EducationProgram.hooks.php +++ b/EducationProgram.hooks.php @@ -709,4 +709,19 @@ return true; } + + /** + * Title::exists() returns false for all actions across EducationProgram, fix that here. + * + * @param Title $title + * @param bool $exists + */ + public static function onTitleExists( Title $title, &$exists ) { + if ( $title->getNamespace() != EP_NS && $title->getNamespace() != EP_NS_TALK ) { + return; + } + + $exists = Orgs::singleton()->count( [ 'name' => $title->mTextform ] ) > 0 + || Courses::singleton()->count( [ 'name' => $title->mTextform ] ) > 0; + } } diff --git a/extension.json b/extension.json index 2d4aeb8..80b005b 100644 --- a/extension.json +++ b/extension.json @@ -705,7 +705,8 @@ "UserMergeAccountFields": "EducationProgram\\Hooks::onUserMergeAccountFields", "UserMergeAccountDeleteTables": "EducationProgram\\Hooks::onUserMergeAccountDeleteTables", "MergeAccountFromTo": "EducationProgram\\Hooks::onMergeAccountFromTo", - "ResourceLoaderRegisterModules": "EducationProgram\\Hooks::onResourceLoaderRegisterModules" + "ResourceLoaderRegisterModules": "EducationProgram\\Hooks::onResourceLoaderRegisterModules", + "TitleExists": "EducationProgram\\Hooks::onTitleExists" }, "config": { "EPSettings": { -- To view, visit https://gerrit.wikimedia.org/r/401411 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibe447488959e85f335af654e714db136ff22c8ab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EducationProgram Gerrit-Branch: master Gerrit-Owner: Albert221 <w.albert...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits