Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -102,6 +102,7 @@ |
103 | 103 | * (bug 26597) Allow toggling of persistent cookies ("remember me") in API |
104 | 104 | action=login |
105 | 105 | * (bug 29237) add interwiki target url attribute to api/query/interwiki |
| 106 | +* (bug 28392) mark action=undelete×tamps as type "timestamp" |
106 | 107 | |
107 | 108 | === Languages updated in 1.19 === |
108 | 109 | |
Index: trunk/phase3/includes/api/ApiUndelete.php |
— | — | @@ -103,7 +103,8 @@ |
104 | 104 | 'token' => null, |
105 | 105 | 'reason' => '', |
106 | 106 | 'timestamps' => array( |
107 | | - ApiBase::PARAM_ISMULTI => true |
| 107 | + ApiBase::PARAM_TYPE => 'timestamp', |
| 108 | + ApiBase::PARAM_ISMULTI => true, |
108 | 109 | ), |
109 | 110 | 'watchlist' => array( |
110 | 111 | ApiBase::PARAM_DFLT => 'preferences', |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -775,14 +775,13 @@ |
776 | 776 | } |
777 | 777 | break; |
778 | 778 | case 'timestamp': |
779 | | - if ( $multi ) { |
780 | | - ApiBase::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" ); |
| 779 | + if ( is_array( $value ) ) { |
| 780 | + foreach ( $value as $key => $val ) { |
| 781 | + $value[$key] = $this->validateTimestamp( $val, $encParamName ); |
| 782 | + } |
| 783 | + } else { |
| 784 | + $value = $this->validateTimestamp( $value, $encParamName ); |
781 | 785 | } |
782 | | - $value = wfTimestamp( TS_UNIX, $value ); |
783 | | - if ( $value === 0 ) { |
784 | | - $this->dieUsage( "Invalid value '$value' for timestamp parameter $encParamName", "badtimestamp_{$encParamName}" ); |
785 | | - } |
786 | | - $value = wfTimestamp( TS_MW, $value ); |
787 | 786 | break; |
788 | 787 | case 'user': |
789 | 788 | if ( !is_array( $value ) ) { |
— | — | @@ -914,6 +913,19 @@ |
915 | 914 | } |
916 | 915 | |
917 | 916 | /** |
| 917 | + * @param $value string |
| 918 | + * @param $paramName string |
| 919 | + * @return string |
| 920 | + */ |
| 921 | + function validateTimestamp( $value, $paramName ) { |
| 922 | + $value = wfTimestamp( TS_UNIX, $value ); |
| 923 | + if ( $value === 0 ) { |
| 924 | + $this->dieUsage( "Invalid value '$value' for timestamp parameter $paramName", "badtimestamp_{$paramName}" ); |
| 925 | + } |
| 926 | + return wfTimestamp( TS_MW, $value ); |
| 927 | + } |
| 928 | + |
| 929 | + /** |
918 | 930 | * Adds a warning to the output, else dies |
919 | 931 | * |
920 | 932 | * @param $msg String Message to show as a warning, or error message if dying |