Merge "Fix unstyled updatedmarker"
[lhc/web/wiklou.git] / includes / actions / Action.php
index ead8efa..ae4c6d6 100644 (file)
@@ -62,7 +62,7 @@ abstract class Action {
         * the action is disabled, or null if it's not recognised
         * @param string $action
         * @param array $overrides
-        * @return bool|null|string|callable
+        * @return bool|null|string|callable|Action
         */
        final private static function getClass( $action, array $overrides ) {
                global $wgActions;
@@ -96,6 +96,9 @@ abstract class Action {
                $classOrCallable = self::getClass( $action, $page->getActionOverrides() );
 
                if ( is_string( $classOrCallable ) ) {
+                       if ( !class_exists( $classOrCallable ) ) {
+                               return false;
+                       }
                        $obj = new $classOrCallable( $page, $context );
                        return $obj;
                }
@@ -144,7 +147,7 @@ abstract class Action {
                // Trying to get a WikiPage for NS_SPECIAL etc. will result
                // in WikiPage::factory throwing "Invalid or virtual namespace -1 given."
                // For SpecialPages et al, default to action=view.
-               if ( !$context->canUseWikiPage() ) {
+               if ( $actionName === '' || !$context->canUseWikiPage() ) {
                        return 'view';
                }