Commit aa899cfd authored by Luke081515's avatar Luke081515

Merge branch 'readPage-new' into 'master'

Update readPage to new API parameters

See merge request !112
parents 25bf5973 baeb034e
Pipeline #4641 failed with stages
in 21 seconds
stages:
- lint
- codesniffer
- unit
lint:lint-php5.4:
stage: lint
......@@ -50,44 +49,4 @@ codesniffer:
- bash ci/docker_install-cs.sh > /dev/null
script:
- bash ci/phpcs.sh
allow_failure: true
unit:testBasic:
stage: unit
image: php:5.6
before_script:
- bash ci/docker_install-unit.sh > /dev/null
script:
- bash ci/phpunitBasic.sh
unit:testRead:
stage: unit
image: php:5.6
before_script:
- bash ci/docker_install-unit.sh > /dev/null
script:
- bash ci/phpunitRead.sh
unit:testReadAssertFail:
stage: unit
image: php:5.6
before_script:
- bash ci/docker_install-unit.sh > /dev/null
script:
- bash ci/phpunitReadAssert.sh
unit:testPageProperty:
stage: unit
image: php:5.6
before_script:
- bash ci/docker_install-unit.sh > /dev/null
script:
- bash ci/phpunitPageProperty.sh
unit:testUserProperty:
stage: unit
image: php:5.6
before_script:
- bash ci/docker_install-unit.sh > /dev/null
script:
- bash ci/phpunitUserProperty.sh
\ No newline at end of file
allow_failure: true
\ No newline at end of file
......@@ -370,36 +370,38 @@ class Core extends Password {
if ($pageID == -1) {
return null;
}
return $page['query']['pages'][$pageID]['revisions'][0]['*'];
return $page['query']['pages'][$pageID]['revisions'][0]['slots']['main']['*'];
}
/** readPage
* Returns the content of a page
* @param $title - name of the page including namespaces
* @author MGChecker
* @author Luke081515, MGChecker
* @return content of the page
** false if there is an unknown error
** null if the page does not exist
*/
public function readPage($title) {
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvcontentformat=text%2Fx-wiki&titles=" . urlencode($title) .
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvslots=main&titles=" . urlencode($title) .
"&rvdir=older&assert=" . $this->assert . "&maxlag=" . $this->maxlag . "&rawcontinue=&indexpageids=1";
return $this->readPageEngine($request);
}
/** readPageId
* Returns the content of a page
* @param $pageID - ID of the page
* @author MGChecker
* @author Luke081515, MGChecker
* @return content of the page
** false if there is an unknown error
** null if the page does not exist
*/
public function readPageID($pageID) {
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvcontentformat=text%2Fx-wiki&pageids=" . urlencode($pageID) .
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvslots=main&pageids=" . urlencode($pageID) .
"&rvdir=older&assert=" . $this->assert . "&maxlag=" . $this->maxlag . "&rawcontinue=&indexpageids=1";
return $this->readPageEngine($request);
}
/** readPageJs
* Returns the content of a JS page
* DEPRECATED, replaced with "readPage"
* To be removed in V2.2
* @param $title - title of the page
* @author MGChecker
* @return text of the page
......@@ -407,12 +409,13 @@ class Core extends Password {
** null if the page does not exist
*/
public function readPageJs($title) {
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvcontentformat=text%2Fjavascript&titles=" . urlencode($title) .
"&rvdir=older&assert=" . $this->assert . "&maxlag=" . $this->maxlag . "&rawcontinue=&indexpageids=1";
return $this->readPageEngine($request);
$this->echoMsg("This function is deprecated, please use \$this->readPage() instead. This function will get removed soon.", "warning");
return $this->readPage($title);
}
/** readPageCss
* Returns the content of a CSS page
* DEPRECATED, replaced with "readPage"
* To be removed in V2.2
* @param $title - title of the page
* @author MGChecker
* @return text of the page
......@@ -420,21 +423,20 @@ class Core extends Password {
** null if the page does not exist
*/
public function readPageCss($title) {
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvcontentformat=text%2Fcss&titles=" . urlencode($title) .
"&rvdir=older&assert=" . $this->assert . "&maxlag=" . $this->maxlag . "&rawcontinue=&indexpageids=1";
return $this->readPageEngine($request);
$this->echoMsg("This function is deprecated, please use \$this->readPage() instead. This function will get removed soon.", "warning");
return $this->readPage($title);
}
/** readSection
* returns the content of a specified section
* @param $title - name of the page
* @param $section - number of the section
* @author MGChecker
* @author Luke081515, MGChecker
* @return text of the section
** false if there is an unknown error
** null if the page does not exist
*/
public function readSection($title, $section) {
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvcontentformat=text%2Fx-wiki&rvdir=older&indexpageids=1&rvsection=" . urlencode($section) .
$request = "action=query&prop=revisions&format=json&rvprop=content&rvlimit=1&rvslots=main&rvdir=older&indexpageids=1&rvsection=" . urlencode($section) .
"&assert=" . $this->assert . "&maxlag=" . $this->maxlag . "&titles=" . urlencode($title);
return $this->readPageEngine($request);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment