Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -970,12 +970,20 @@ |
971 | 971 | * @return array in the format of array( key, param1, param2, ... ) or array( 'code' => ..., 'info' => ... ) |
972 | 972 | */ |
973 | 973 | public function getPossibleErrors() { |
974 | | - $ret = array( array( 'readrequired' ) ); |
| 974 | + $ret = array(); |
975 | 975 | |
976 | 976 | if ( $this->mustBePosted() ) { |
977 | | - $ret = array_merge( $ret, array( array ('mustbeposted', $this->getModuleName() ) ) ); |
| 977 | + $ret = array_merge( $ret, array( array ( 'mustbeposted', $this->getModuleName() ) ) ); |
978 | 978 | } |
979 | 979 | |
| 980 | + if ( $this->isReadMode() ) { |
| 981 | + $ret = array_merge( $ret, array( array ( 'readrequired' ) ) ); |
| 982 | + } |
| 983 | + |
| 984 | + if ( $this->isWriteMode() ) { |
| 985 | + $ret = array_merge( $ret, array( array ( 'writerequired' ), array( 'writedisabled' ) ) ); |
| 986 | + } |
| 987 | + |
980 | 988 | return $ret; |
981 | 989 | } |
982 | 990 | |