Revision 3731:3770620079d4,
1.5 KB
checked in by franck <carnet.franck.paul@…>, 8 years ago
(diff) |
Simplify licence block at the beginning of each file
|
Rev | Line | |
---|
[1925] | 1 | <?php |
---|
[3731] | 2 | /** |
---|
| 3 | * @brief maintenance, a plugin for Dotclear 2 |
---|
| 4 | * |
---|
| 5 | * @package Dotclear |
---|
| 6 | * @subpackage Plugins |
---|
| 7 | * |
---|
| 8 | * @copyright Olivier Meunier & Association Dotclear |
---|
| 9 | * @copyright GPL-2.0-only |
---|
| 10 | */ |
---|
| 11 | |
---|
[3730] | 12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
[1925] | 13 | |
---|
| 14 | /** |
---|
| 15 | @ingroup PLUGIN_MAINTENANCE |
---|
| 16 | @nosubgrouping |
---|
| 17 | @brief Maintenance plugin rest service class. |
---|
| 18 | |
---|
| 19 | Serve maintenance methods via Dotclear's rest API |
---|
[3730] | 20 | */ |
---|
[1925] | 21 | class dcMaintenanceRest |
---|
| 22 | { |
---|
[3730] | 23 | /** |
---|
| 24 | * Serve method to do step by step task for maintenance. |
---|
| 25 | * |
---|
| 26 | * @param core <b>dcCore</b> dcCore instance |
---|
| 27 | * @param get <b>array</b> cleaned $_GET |
---|
| 28 | * @param post <b>array</b> cleaned $_POST |
---|
| 29 | * |
---|
| 30 | * @return <b>xmlTag</b> XML representation of response |
---|
| 31 | */ |
---|
| 32 | public static function step($core, $get, $post) |
---|
| 33 | { |
---|
| 34 | if (!isset($post['task'])) { |
---|
| 35 | throw new Exception('No task ID'); |
---|
| 36 | } |
---|
| 37 | if (!isset($post['code'])) { |
---|
| 38 | throw new Exception('No code ID'); |
---|
| 39 | } |
---|
[1925] | 40 | |
---|
[3730] | 41 | $maintenance = new dcMaintenance($core); |
---|
| 42 | if (($task = $maintenance->getTask($post['task'])) === null) { |
---|
| 43 | throw new Exception('Unknow task ID'); |
---|
| 44 | } |
---|
[1925] | 45 | |
---|
[3730] | 46 | $task->code((integer) $post['code']); |
---|
| 47 | if (($code = $task->execute()) === true) { |
---|
| 48 | $maintenance->setLog($task->id()); |
---|
| 49 | $code = 0; |
---|
| 50 | } |
---|
[1925] | 51 | |
---|
[3730] | 52 | $rsp = new xmlTag('step'); |
---|
| 53 | $rsp->code = $code; |
---|
| 54 | $rsp->title = html::escapeHTML($task->success()); |
---|
[1925] | 55 | |
---|
[3730] | 56 | return $rsp; |
---|
| 57 | } |
---|
[1925] | 58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.