hooks: Only check relevant page title instead of both

The relevant page title is equal to the native page title
if we're on a regular page (e.g. both are Foo on Foo and on
Special:MovePage/Foo one is Special:MovePage and the other
Foo). In that case there is no point in checking both, especially
if it is with the OR condition.

Change-Id: I310e638a73312afea421a399ce4c6ea9b4254cbf
This commit is contained in:
Timo Tijhof 2013-07-22 19:50:25 +02:00
parent 712a7e9674
commit 95f135b0c8

View file

@ -67,12 +67,8 @@ class VisualEditorHooks {
// The user's current skin is supported
in_array( $skin->getSkinName(), self::$supportedSkins ) &&
(
// Article in the VisualEditor namespace
in_array( $skin->getTitle()->getNamespace(), $wgVisualEditorNamespaces ) ||
// Special page action for an article in the VisualEditor namespace
in_array( $skin->getRelevantTitle()->getNamespace(), $wgVisualEditorNamespaces )
) &&
// The current page is in a VisualEditor-enabled namespace
in_array( $skin->getRelevantTitle()->getNamespace(), $wgVisualEditorNamespaces ) &&
// Only use VisualEditor if the page is wikitext, not CSS/JS
$skin->getTitle()->getContentModel() === CONTENT_MODEL_WIKITEXT