| @@ 13-39 (lines=27) @@ | ||
| 10 | * |
|
| 11 | * @author Addshore |
|
| 12 | */ |
|
| 13 | class RevisionDeleter extends Service { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @since 0.5 |
|
| 17 | * |
|
| 18 | * @param Revision $revision |
|
| 19 | * |
|
| 20 | * @return bool |
|
| 21 | */ |
|
| 22 | public function delete( Revision $revision ) { |
|
| 23 | $params = [ |
|
| 24 | 'type' => 'revision', |
|
| 25 | 'hide' => 'content', |
|
| 26 | // Note: pre 1.24 this is a delete token, post it is csrf |
|
| 27 | 'token' => $this->api->getToken( 'delete' ), |
|
| 28 | 'ids' => $revision->getId(), |
|
| 29 | ]; |
|
| 30 | ||
| 31 | $this->api->postRequest( new SimpleRequest( |
|
| 32 | 'revisiondelete', |
|
| 33 | $params |
|
| 34 | ) ); |
|
| 35 | ||
| 36 | return true; |
|
| 37 | } |
|
| 38 | ||
| 39 | } |
|
| 40 | ||
| @@ 13-39 (lines=27) @@ | ||
| 10 | * |
|
| 11 | * @author Addshore |
|
| 12 | */ |
|
| 13 | class RevisionRestorer extends Service { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @since 0.5 |
|
| 17 | * |
|
| 18 | * @param Revision $revision |
|
| 19 | * |
|
| 20 | * @return bool |
|
| 21 | */ |
|
| 22 | public function restore( Revision $revision ) { |
|
| 23 | $params = [ |
|
| 24 | 'type' => 'revision', |
|
| 25 | 'show' => 'content', |
|
| 26 | // Note: pre 1.24 this is a delete token, post it is csrf |
|
| 27 | 'token' => $this->api->getToken( 'delete' ), |
|
| 28 | 'ids' => $revision->getId(), |
|
| 29 | ]; |
|
| 30 | ||
| 31 | $this->api->postRequest( new SimpleRequest( |
|
| 32 | 'revisiondelete', |
|
| 33 | $params |
|
| 34 | ) ); |
|
| 35 | ||
| 36 | return true; |
|
| 37 | } |
|
| 38 | ||
| 39 | } |
|
| 40 | ||