Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/maintenance/_services.php

    r1959 r3730  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    12 if (!defined('DC_CONTEXT_ADMIN')) { return; } 
     12if (!defined('DC_CONTEXT_ADMIN')) {return;} 
    1313 
    1414/** 
     
    1818 
    1919Serve maintenance methods via Dotclear's rest API 
    20 */ 
     20 */ 
    2121class dcMaintenanceRest 
    2222{ 
    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           } 
     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        } 
    4040 
    41           $maintenance = new dcMaintenance($core); 
    42           if (($task = $maintenance->getTask($post['task'])) === null) { 
    43                throw new Exception('Unknow task ID'); 
    44           } 
     41        $maintenance = new dcMaintenance($core); 
     42        if (($task = $maintenance->getTask($post['task'])) === null) { 
     43            throw new Exception('Unknow task ID'); 
     44        } 
    4545 
    46           $task->code((integer) $post['code']); 
    47           if (($code = $task->execute()) === true) { 
    48                $maintenance->setLog($task->id()); 
    49                $code = 0; 
    50           } 
     46        $task->code((integer) $post['code']); 
     47        if (($code = $task->execute()) === true) { 
     48            $maintenance->setLog($task->id()); 
     49            $code = 0; 
     50        } 
    5151 
    52           $rsp = new xmlTag('step'); 
    53           $rsp->code = $code; 
    54           $rsp->title = html::escapeHTML($task->success()); 
     52        $rsp        = new xmlTag('step'); 
     53        $rsp->code = $code; 
     54        $rsp->title = html::escapeHTML($task->success()); 
    5555 
    56           return $rsp; 
    57      } 
     56        return $rsp; 
     57    } 
    5858} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map