Do checks in the correct order in Linker::getLinkColour().
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Tue, 24 Jul 2012 12:44:27 +0000 (14:44 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 25 Jul 2012 07:50:58 +0000 (09:50 +0200)
There's no point doing potentially expensive checks (exists() and
getLength()) if the page is simply not in a content namespace.

Change-Id: I86a2b3a36071cf508b8e99ef20bdf3e0e20f3c82

includes/Linker.php

index 5355140..083845d 100644 (file)
@@ -139,9 +139,9 @@ class Linker {
                if ( $t->isRedirect() ) {
                        # Page is a redirect
                        $colour = 'mw-redirect';
-               } elseif ( $threshold > 0 &&
-                          $t->exists() && $t->getLength() < $threshold &&
-                          $t->isContentPage() ) {
+               } elseif ( $threshold > 0 && $t->isContentPage() &&
+                       $t->exists() && $t->getLength() < $threshold
+               ) {
                        # Page is a stub
                        $colour = 'stub';
                }