Skip to content

Commit

Permalink
Merge pull request #4 from DamianZaremba/cleanup-revisions-warnings
Browse files Browse the repository at this point in the history
Wikipedia::revisions - specify `rvslots`
  • Loading branch information
DamianZaremba authored Oct 16, 2021
2 parents 1553735 + aae6434 commit 542899c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function doarchive(
));
unset($tmp);

$cursects = splitintosections($rv[0]['*'], $level);
$cursects = splitintosections($rv[0]['slots']['main']['*'], $level);

$ans = array();
$anr = array();
Expand Down Expand Up @@ -183,11 +183,11 @@ function doarchive(
}
}
if ($lastrvid == null) {
$tmp = array(array('*' => ''));
$tmp = array(array('slots' => array('main' => array('*' => ''))));
} else {
$tmp = $wpapi->revisions($page, 1, 'older', true, $lastrvid);
}
$oldsects = splitintosections($tmp[0]['*'], $level);
$oldsects = splitintosections($tmp[0]['slots']['main']['*'], $level);
$header = $cursects[0];
unset($cursects[0]);
unset($oldsects[0]);
Expand Down
2 changes: 1 addition & 1 deletion lib/wikipedia.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function revisions(
$redirects = false
) {
global $logger;
$url = $this->apiurl . '?action=query&rawcontinue=1&prop=revisions&titles=' .
$url = $this->apiurl . '?action=query&rawcontinue=1&prop=revisions&rvslots=main&titles=' .
urlencode($page) . '&rvlimit=' . urlencode($count) . '&rvprop=timestamp|ids|user|comment' .
(($content) ? '|content' : '') . '&format=php&meta=userinfo&rvdir=' . urlencode($dir) .
(($revid !== null) ? '&rvstartid=' . urlencode($revid) : '') .
Expand Down
12 changes: 6 additions & 6 deletions lib/wikipedia.index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public function post($page, $data, $summery = '', $minor = false, $rv = null, $b
if ($rv == null) {
$rv = $wpapi->revisions($page, 1, 'older', true);
}
if (!$rv[0]['*']) {
$rv[0]['*'] = $wpq->getpage($page);
if (!$rv[0]['slots']['main']['*']) {
$rv[0]['slots']['main']['*'] = $wpq->getpage($page);
}

$now = gmdate('YmdHis', time());
Expand All @@ -97,18 +97,18 @@ public function post($page, $data, $summery = '', $minor = false, $rv = null, $b
$html .= "<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n";
$html .= '<input name="wpAutoSummary" type="hidden" value="' . md5('') . '" />' . "\n";

if (preg_match('/' . preg_quote('{{nobots}}', '/') . '/iS', $rv[0]['*'])) {
if (preg_match('/' . preg_quote('{{nobots}}', '/') . '/iS', $rv[0]['slots']['main']['*'])) {
return false;
} /* Honor the bots flags */
if (preg_match('/' . preg_quote('{{bots|allow=none}}', '/') . '/iS', $rv[0]['*'])) {
if (preg_match('/' . preg_quote('{{bots|allow=none}}', '/') . '/iS', $rv[0]['slots']['main']['*'])) {
return false;
}
if (preg_match('/' . preg_quote('{{bots|deny=all}}', '/') . '/iS', $rv[0]['*'])) {
if (preg_match('/' . preg_quote('{{bots|deny=all}}', '/') . '/iS', $rv[0]['slots']['main']['*'])) {
return false;
}
if (
preg_match('/' . preg_quote('{{bots|deny=', '/') . '(.*)' .
preg_quote('}}', '/') . '/iS', $rv[0]['*'], $m)
preg_quote('}}', '/') . '/iS', $rv[0]['slots']['main']['*'], $m)
) {
if (in_array(explode(',', $m[1]), $user)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/wikipedia.query.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getpage($page)
$this->checkurl();
$ret = $this->api->revisions($page, 1, 'older', true, null, true, false, false, false);

return $ret[0]['*'];
return $ret[0]['slots']['main']['*'];
}

/**
Expand Down

0 comments on commit 542899c

Please sign in to comment.