Changeset 3730:5c45a5df9a59 for plugins/maintenance/_services.php
- Timestamp:
- 03/08/18 17:58:39 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/maintenance/_services.php
r1959 r3730 10 10 # 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 if (!defined('DC_CONTEXT_ADMIN')) { return;}12 if (!defined('DC_CONTEXT_ADMIN')) {return;} 13 13 14 14 /** … … 18 18 19 19 Serve maintenance methods via Dotclear's rest API 20 */20 */ 21 21 class dcMaintenanceRest 22 22 { 23 24 25 26 * @param core <b>dcCore</b>dcCore instance27 * @param get <b>array</b>cleaned $_GET28 * @param post <b>array</b>cleaned $_POST29 30 * @return <b>xmlTag</b>XML representation of response31 32 33 34 35 36 37 38 39 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 40 41 42 43 44 41 $maintenance = new dcMaintenance($core); 42 if (($task = $maintenance->getTask($post['task'])) === null) { 43 throw new Exception('Unknow task ID'); 44 } 45 45 46 47 48 49 50 46 $task->code((integer) $post['code']); 47 if (($code = $task->execute()) === true) { 48 $maintenance->setLog($task->id()); 49 $code = 0; 50 } 51 51 52 $rsp= new xmlTag('step');53 $rsp->code= $code;54 52 $rsp = new xmlTag('step'); 53 $rsp->code = $code; 54 $rsp->title = html::escapeHTML($task->success()); 55 55 56 57 56 return $rsp; 57 } 58 58 }
Note: See TracChangeset
for help on using the changeset viewer.