29 |
* Calls its parent's constructor and fills the contents array with the |
* Calls its parent's constructor and fills the contents array with the |
30 |
* keys that are to be searched for in the incoming JSON data. |
* keys that are to be searched for in the incoming JSON data. |
31 |
*/ |
*/ |
32 |
function __construct() { |
public function __construct() { |
33 |
parent::__construct(); |
parent::__construct(); |
34 |
$this->contents['module'] = ''; |
$this->contents['module'] = ''; |
35 |
$this->contents['data'] = ''; |
$this->contents['data'] = ''; |
41 |
* |
* |
42 |
* Call's its parent's destructor. |
* Call's its parent's destructor. |
43 |
*/ |
*/ |
44 |
function __destruct() { |
public function __destruct() { |
45 |
parent::__destruct(); |
parent::__destruct(); |
46 |
} |
} |
47 |
|
|
61 |
* 400 is sent on error. |
* 400 is sent on error. |
62 |
* 200 is sent on success. |
* 200 is sent on success. |
63 |
*/ |
*/ |
64 |
function post($request_data) { |
public function post($request_data) { |
|
|
|
65 |
if (!$this->requestValid($request_data)) { |
if (!$this->requestValid($request_data)) { |
66 |
|
print ' request_data:'; |
67 |
|
print_r($request_data); |
68 |
return $this->sendHttpCode(400, 'Missing mandatory data.'); |
return $this->sendHttpCode(400, 'Missing mandatory data.'); |
69 |
} |
} |
70 |
|
|
71 |
$this->metier_manager = new MaintenanceManager(); |
$this->metier_manager = new MaintenanceManager(); |
72 |
$ret = $this->metier_manager->performMaintenance( |
$ret = $this->metier_manager->performMaintenance( |
73 |
$request_data['module'], $request_data['data']); |
$request_data['module'], $request_data['data']); |
|
|
|
74 |
// send the reply |
// send the reply |
75 |
return $this->sendReply($ret, 'Error when synchronizing.'); |
$msg = $this->metier_manager->getMessage(); |
76 |
|
if ($ret != 'KO') { |
77 |
|
return $this->sendHttpCode(200, $msg); |
78 |
|
} |
79 |
|
return $this->sendHttpCode(500, $msg); |
80 |
} |
} |
81 |
|
|
82 |
|
|