Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/249049

Change subject: Do not attempt to fall back to PHP parser
......................................................................

Do not attempt to fall back to PHP parser

I think this was originally intended for when Parsoid was not
configured, so it would simply always fall back to PHP.

However, it wrongly triggers when an individual Parsoid request
fails (when the overall Parsoid setup is fine)

Bug: T116699
Change-Id: Ie46aed1b23c35bef7ec75f87d58551a4d9b7b9db
---
M includes/Parsoid/Utils.php
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/49/249049/1

diff --git a/includes/Parsoid/Utils.php b/includes/Parsoid/Utils.php
index 9ced876..193d041 100644
--- a/includes/Parsoid/Utils.php
+++ b/includes/Parsoid/Utils.php
@@ -27,17 +27,17 @@
         * @param string $content
         * @param Title $title
         * @return string
-        * @throws InvalidDataException When $title does not exist
+        * @throws WikitextException When the requested conversion is 
unsupported
+        * @throws NoParserException When the conversion fails
         */
        public static function convert( $from, $to, $content, Title $title ) {
                if ( $from === $to || $content === '' ) {
                        return $content;
                }
 
-               try {
+               if ( self::isParsoidConfigured() ) {
                        return self::parsoid( $from, $to, $content, $title );
-               } catch ( NoParserException $e ) {
-                       // If we have no parsoid config, fallback to the PHP 
parser.
+               } else {
                        return self::parser( $from, $to, $content, $title );
                }
        }
@@ -75,7 +75,7 @@
         * @param string $content
         * @param Title $title
         * @return string
-        * @throws NoParserException When Parsoid/RESTBase is not available
+        * @throws NoParserException When Parsoid/RESTBase operation fails
         * @throws WikitextException When conversion is unsupported
         */
        protected static function parsoid( $from, $to, $content, Title $title ) 
{
@@ -113,7 +113,7 @@
                        }
                        $vrsInfo = $serviceClient->getMountAndService( 
'/restbase/' );
                        $name = $vrsInfo[1] ? $vrsInfo[1]->getName() : 'VRS 
service';
-                       $msg = "Failed contacting " . $name . " for title 
\"$prefixedDbTitle\": $statusMsg";
+                       $msg = "Request to " . $name . " for '$from' to '$to' 
conversion of content connected to title \"$prefixedDbTitle\" failed: 
$statusMsg";
                        wfDebugLog( 'Flow', __METHOD__ . ": $msg" );
                        throw new NoParserException( "$msg", 'process-wikitext' 
);
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/249049
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie46aed1b23c35bef7ec75f87d58551a4d9b7b9db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to