Skip to content

Commit

Permalink
RemoteAPICore: do not rely on timestamps of saved revisions
Browse files Browse the repository at this point in the history
This fixes the remote API's relying on timestamps of files in the attic
directory. While the timestamp of the current page is always the
revision (and actually how the timestamp of the revision is determined),
timestamps of attic files do not necessarily match the revision they
represent. This should also fix random test failures in the remote api
tests.
  • Loading branch information
michitux committed Jan 1, 2017
1 parent 2d69eb4 commit 2e38f57
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions inc/RemoteAPICore.php
Expand Up @@ -449,14 +449,20 @@ public function pageInfo($id,$rev=''){
throw new RemoteException('The requested page does not exist', 121);
}

// set revision to current version if empty, use revision otherwise
// as the timestamps of old files are not necessarily correct
if($rev === '') {
$rev = $time;
}

$pagelog = new PageChangeLog($id, 1024);
$info = $pagelog->getRevisionInfo($time);
$info = $pagelog->getRevisionInfo($rev);

$data = array(
'name' => $id,
'lastModified' => $this->api->toDate($time),
'lastModified' => $this->api->toDate($rev),
'author' => (($info['user']) ? $info['user'] : $info['ip']),
'version' => $time
'version' => $rev
);

return ($data);
Expand Down Expand Up @@ -806,7 +812,7 @@ public function pageVersions($id, $first) {
// specified via $conf['recent']
if($time){
$pagelog->setChunkSize(1024);
$info = $pagelog->getRevisionInfo($time);
$info = $pagelog->getRevisionInfo($rev ? $rev : $time);
if(!empty($info)) {
$data = array();
$data['user'] = $info['user'];
Expand Down

0 comments on commit 2e38f57

Please sign in to comment.