and 'notice-message', which were deprecated in 1.32, were removed. Instead,
use 'help', 'help-message', and 'help-messages'.
* (T197179) HTMLFormField::getNotices(), deprecated in 1.32, was removed.
+* The "Parsoid v1" compatibility mappings in ParsoidVirtualRESTService and
+ RestbaseVirtualRESTService, deprecated since 1.26, have been removed.
+ Use the RESTBase v1 or Parsoid v3 API instead.
* …
=== Deprecations in 1.33 ===
* * $title is optional
* * $revision is optional
*
- * There are also deprecated "v1" requests; see onParsoid1Request
- * for details.
* @param array $params Key/value map
* - url : Parsoid server URL
* - domain : Wiki domain to use
# Map RESTBase v1 API to Parsoid v3 API (pretty easy)
$req['url'] = preg_replace( '#^local/v1/#', 'local/v3/', $req['url'] );
} elseif ( $version !== 'v3' ) {
- $result[$key] = $this->onParsoid1Request( $req, $idGeneratorFunc );
- continue;
+ throw new Exception( "Only Parsoid v3 API is supported." );
}
if ( $targetWiki !== 'local' ) {
throw new Exception( "Only 'local' target wiki is currently supported" );
return $result;
}
- /**
- * Remap a Parsoid v1 request to a Parsoid v3 request.
- *
- * Example Parsoid v1 requests:
- * GET /local/v1/page/$title/html/$oldid
- * * $oldid is optional
- * POST /local/v1/transform/html/to/wikitext/$title/$oldid
- * * body: array( 'html' => ... )
- * * $title and $oldid are optional
- * POST /local/v1/transform/wikitext/to/html/$title
- * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body' => true/false )
- * * $title is optional
- *
- * NOTE: the POST APIs aren't "real" Parsoid v1 APIs, they are just what
- * Visual Editor "pretends" the V1 API is like. A previous version of
- * ParsoidVirtualRESTService translated these to the "real" Parsoid v1
- * API. We now translate these to the "real" Parsoid v3 API.
- * @param array $req
- * @param Closure $idGeneratorFunc
- * @return array
- * @throws Exception
- * @deprecated since 1.26, upgrade your client to issue v3 requests.
- */
- public function onParsoid1Request( array $req, Closure $idGeneratorFunc ) {
- wfDeprecated( __METHOD__, '1.26' );
- $parts = explode( '/', $req['url'] );
- list(
- $targetWiki, // 'local'
- $version, // 'v1'
- $reqType // 'page' or 'transform'
- ) = $parts;
- if ( $targetWiki !== 'local' ) {
- throw new Exception( "Only 'local' target wiki is currently supported" );
- } elseif ( $version !== 'v1' ) {
- throw new Exception( "Only v1 and v3 are supported." );
- } elseif ( $reqType !== 'page' && $reqType !== 'transform' ) {
- throw new Exception( "Request type must be either 'page' or 'transform'" );
- }
- $req['url'] = $this->params['url'] . $this->params['domain'] . '/v3/';
- if ( $reqType === 'page' ) {
- $title = $parts[3];
- if ( $parts[4] !== 'html' ) {
- throw new Exception( "Only 'html' output format is currently supported" );
- }
- $req['url'] .= 'page/html/' . $title;
- if ( isset( $parts[5] ) ) {
- $req['url'] .= '/' . $parts[5];
- } elseif ( isset( $req['query']['oldid'] ) && $req['query']['oldid'] ) {
- $req['url'] .= '/' . $req['query']['oldid'];
- unset( $req['query']['oldid'] );
- }
- } elseif ( $reqType === 'transform' ) {
- $req['url'] .= 'transform/' . $parts[3] . '/to/' . $parts[5];
- // the title
- if ( isset( $parts[6] ) ) {
- $req['url'] .= '/' . $parts[6];
- }
- // revision id
- if ( isset( $parts[7] ) ) {
- $req['url'] .= '/' . $parts[7];
- } elseif ( isset( $req['body']['oldid'] ) && $req['body']['oldid'] ) {
- $req['url'] .= '/' . $req['body']['oldid'];
- unset( $req['body']['oldid'] );
- }
- if ( $parts[4] !== 'to' ) {
- throw new Exception( "Part index 4 is not 'to'" );
- }
- if ( $parts[3] === 'html' && $parts[5] === 'wikitext' ) {
- if ( !isset( $req['body']['html'] ) ) {
- throw new Exception( "You must set an 'html' body key for this request" );
- }
- } elseif ( $parts[3] == 'wikitext' && $parts[5] == 'html' ) {
- if ( !isset( $req['body']['wikitext'] ) ) {
- throw new Exception( "You must set a 'wikitext' body key for this request" );
- }
- if ( isset( $req['body']['body'] ) ) {
- $req['body']['body_only'] = $req['body']['body'];
- unset( $req['body']['body'] );
- }
- } else {
- throw new Exception( "Transformation unsupported" );
- }
- }
- // set the appropriate proxy, timeout and headers
- if ( $this->params['HTTPProxy'] ) {
- $req['proxy'] = $this->params['HTTPProxy'];
- }
- if ( $this->params['timeout'] != null ) {
- $req['reqTimeout'] = $this->params['timeout'];
- }
- if ( $this->params['forwardCookies'] ) {
- $req['headers']['Cookie'] = $this->params['forwardCookies'];
- }
-
- return $req;
- }
-
}
}
/**
- * Remaps Parsoid v1/v3 requests to RESTBase v1 requests.
+ * Remaps Parsoid v3 requests to RESTBase v1 requests.
* @param array $reqs
* @param Closure $idGeneratorFunc
* @return array
$version = explode( '/', $req['url'] )[1];
if ( $version === 'v3' ) {
$result[$key] = $this->onParsoid3Request( $req, $idGeneratorFunc );
- } elseif ( $version === 'v1' ) {
- $result[$key] = $this->onParsoid1Request( $req, $idGeneratorFunc );
} else {
- throw new Exception( "Only v1 and v3 are supported." );
+ throw new Exception( "Only Parsoid v3 is supported." );
}
}
return $result;
}
- /**
- * Remap a Parsoid v1 request to a RESTBase v1 request.
- *
- * Example Parsoid v1 requests:
- * GET /local/v1/page/$title/html/$oldid
- * * $oldid is optional
- * POST /local/v1/transform/html/to/wikitext/$title/$oldid
- * * body: array( 'html' => ... )
- * * $title and $oldid are optional
- * POST /local/v1/transform/wikitext/to/html/$title
- * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body' => true/false )
- * * $title is optional
- *
- * NOTE: the POST APIs aren't "real" Parsoid v1 APIs, they are just what
- * Visual Editor "pretends" the V1 API is like. (See
- * ParsoidVirtualRESTService.)
- * @param array $req
- * @param Closure $idGeneratorFunc
- * @return array
- * @throws Exception
- * @deprecated since 1.26, upgrade your client to issue v3 requests.
- */
- public function onParsoid1Request( array $req, Closure $idGeneratorFunc ) {
- wfDeprecated( __METHOD__, '1.26' );
- $parts = explode( '/', $req['url'] );
- list(
- $targetWiki, // 'local'
- $version, // 'v1'
- $reqType // 'page' or 'transform'
- ) = $parts;
- if ( $targetWiki !== 'local' ) {
- throw new Exception( "Only 'local' target wiki is currently supported" );
- } elseif ( $version !== 'v1' ) {
- throw new Exception( "Version mismatch: should not happen." );
- } elseif ( $reqType !== 'page' && $reqType !== 'transform' ) {
- throw new Exception( "Request type must be either 'page' or 'transform'" );
- }
- $req['url'] = $this->params['url'] . $this->params['domain'] . '/v1/' . $reqType . '/';
- if ( $reqType === 'page' ) {
- $title = $parts[3];
- if ( $parts[4] !== 'html' ) {
- throw new Exception( "Only 'html' output format is currently supported" );
- }
- $req['url'] .= 'html/' . $title;
- if ( isset( $parts[5] ) ) {
- $req['url'] .= '/' . $parts[5];
- } elseif ( isset( $req['query']['oldid'] ) && $req['query']['oldid'] ) {
- $req['url'] .= '/' . $req['query']['oldid'];
- unset( $req['query']['oldid'] );
- }
- } elseif ( $reqType === 'transform' ) {
- // from / to transform
- $req['url'] .= $parts[3] . '/to/' . $parts[5];
- // the title
- if ( isset( $parts[6] ) ) {
- $req['url'] .= '/' . $parts[6];
- }
- // revision id
- if ( isset( $parts[7] ) ) {
- $req['url'] .= '/' . $parts[7];
- } elseif ( isset( $req['body']['oldid'] ) && $req['body']['oldid'] ) {
- $req['url'] .= '/' . $req['body']['oldid'];
- unset( $req['body']['oldid'] );
- }
- if ( $parts[4] !== 'to' ) {
- throw new Exception( "Part index 4 is not 'to'" );
- }
- if ( $parts[3] === 'html' && $parts[5] === 'wikitext' ) {
- if ( !isset( $req['body']['html'] ) ) {
- throw new Exception( "You must set an 'html' body key for this request" );
- }
- } elseif ( $parts[3] == 'wikitext' && $parts[5] == 'html' ) {
- if ( !isset( $req['body']['wikitext'] ) ) {
- throw new Exception( "You must set a 'wikitext' body key for this request" );
- }
- if ( isset( $req['body']['body'] ) ) {
- $req['body']['body_only'] = $req['body']['body'];
- unset( $req['body']['body'] );
- }
- } else {
- throw new Exception( "Transformation unsupported" );
- }
- }
- // set the appropriate proxy, timeout and headers
- if ( $this->params['HTTPProxy'] ) {
- $req['proxy'] = $this->params['HTTPProxy'];
- }
- if ( $this->params['timeout'] != null ) {
- $req['reqTimeout'] = $this->params['timeout'];
- }
- if ( $this->params['forwardCookies'] ) {
- $req['headers']['Cookie'] = $this->params['forwardCookies'];
- }
-
- return $req;
- }
-
/**
* Remap a Parsoid v3 request to a RESTBase v1 request.
*