Revision 3731:3770620079d4,
1.5 KB
checked in by franck <carnet.franck.paul@…>, 7 years ago
(diff) |
Simplify licence block at the beginning of each file
|
Line | |
---|
1 | <?php |
---|
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 | |
---|
12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
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 |
---|
20 | */ |
---|
21 | class dcMaintenanceRest |
---|
22 | { |
---|
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 | } |
---|
40 | |
---|
41 | $maintenance = new dcMaintenance($core); |
---|
42 | if (($task = $maintenance->getTask($post['task'])) === null) { |
---|
43 | throw new Exception('Unknow task ID'); |
---|
44 | } |
---|
45 | |
---|
46 | $task->code((integer) $post['code']); |
---|
47 | if (($code = $task->execute()) === true) { |
---|
48 | $maintenance->setLog($task->id()); |
---|
49 | $code = 0; |
---|
50 | } |
---|
51 | |
---|
52 | $rsp = new xmlTag('step'); |
---|
53 | $rsp->code = $code; |
---|
54 | $rsp->title = html::escapeHTML($task->success()); |
---|
55 | |
---|
56 | return $rsp; |
---|
57 | } |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.