From 5896f16a440f17d0dd3eba54306bbcf6b85db7ed Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sat, 4 Oct 2008 13:43:17 +0000 Subject: [PATCH] (bug 15647) API edit with basetimestamp fails if the page has been deleted and undeleted since the last edit --- RELEASE-NOTES | 2 ++ includes/api/ApiEditPage.php | 11 +++++++++-- includes/api/ApiQueryInfo.php | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ee0cb4b804..32a847dbaf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -291,6 +291,8 @@ The following extensions are migrated into MediaWiki 1.14: be disabled in LocalSettings.php * (bug 15653) Add prop=duplicatefiles * (bug 15768) Add list=watchlistraw +* (bug 15647) action=edit with basetimestamp fails if the page has been deleted + and undeleted since the last edit === Languages updated in 1.14 === diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index ca839fd15e..9220f6d80c 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -100,8 +100,11 @@ class ApiEditPage extends ApiBase { $reqArr['wpEdittime'] = wfTimestamp(TS_MW, $params['basetimestamp']); else $reqArr['wpEdittime'] = $articleObj->getTimestamp(); - # Fake wpStartime - $reqArr['wpStarttime'] = $reqArr['wpEdittime']; + if(!is_null($params['starttimestamp']) && $params['starttimestamp'] != '') + $reqArr['wpStarttime'] = wfTimestamp(TS_MW, $params['starttimestamp']); + else + # Fake wpStartime + $reqArr['wpStarttime'] = $reqArr['wpEdittime']; if($params['minor'] || (!$params['notminor'] && $wgUser->getOption('minordefault'))) $reqArr['wpMinoredit'] = ''; if($params['recreate']) @@ -253,6 +256,7 @@ class ApiEditPage extends ApiBase { 'notminor' => false, 'bot' => false, 'basetimestamp' => null, + 'starttimestamp' => null, 'recreate' => false, 'createonly' => false, 'nocreate' => false, @@ -279,6 +283,9 @@ class ApiEditPage extends ApiBase { 'basetimestamp' => array('Timestamp of the base revision (gotten through prop=revisions&rvprop=timestamp).', 'Used to detect edit conflicts; leave unset to ignore conflicts.' ), + 'starttimestamp' => array('Timestamp when you obtained the edit token.', + 'Used to detect edit conflicts; leave unset to ignore conflicts.' + ), 'recreate' => 'Override any errors about the article having been deleted in the meantime', 'createonly' => 'Don\'t edit the page if it exists already', 'nocreate' => 'Throw an error if the page doesn\'t exist', diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 1715103684..13828cf577 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -403,6 +403,7 @@ class ApiQueryInfo extends ApiQueryBase { if (!is_null($params['token'])) { $tokenFunctions = $this->getTokenFunctions(); + $pageInfo['starttimestamp'] = wfTimestamp(TS_ISO_8601, time()); foreach($params['token'] as $t) { $val = call_user_func($tokenFunctions[$t], $pageid, $title); @@ -475,6 +476,7 @@ class ApiQueryInfo extends ApiQueryBase { if(!is_null($params['token'])) { $tokenFunctions = $this->getTokenFunctions(); + $res['query']['pages'][$pageid]['starttimestamp'] = wfTimestamp(TS_ISO_8601, time()); foreach($params['token'] as $t) { $val = call_user_func($tokenFunctions[$t], $pageid, $title); -- 2.20.1