(bug 15647) API edit with basetimestamp fails if the page has been deleted and undele...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 4 Oct 2008 13:43:17 +0000 (13:43 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 4 Oct 2008 13:43:17 +0000 (13:43 +0000)
RELEASE-NOTES
includes/api/ApiEditPage.php
includes/api/ApiQueryInfo.php

index ee0cb4b..32a847d 100644 (file)
@@ -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 ===
 
index ca839fd..9220f6d 100644 (file)
@@ -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',
index 1715103..13828cf 100644 (file)
@@ -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);