/** * Ask Production for current deploy status and messages. * * Runs on Content Stage. * * @param int $batch_id * * @return array */ public function import_status_request($batch_id) { $request = array('batch_id' => $batch_id); $response = $this->client->request('smeContentStaging.importStatus', $request); $response = apply_filters('sme_deploy_status', $response); // Get production deploy status. $status = isset($response['status']) ? $response['status'] : 2; // Get production deploy messages. $messages = isset($response['messages']) ? $response['messages'] : array(); return array('status' => $status, 'messages' => $messages); }
/** * Runs on production when a import status request is received. * * @param array $args * @return string */ public function import_status(array $args) { $this->xmlrpc_client->handle_request($args); $result = $this->xmlrpc_client->get_request_data(); $batch = $this->batch_dao->find(intval($result['batch_id'])); $importer = $this->importer_factory->get_importer($batch); $importer->status(); $response = array('status' => $this->api->get_deploy_status($batch->get_id()), 'messages' => $this->api->get_deploy_messages($batch->get_id())); $response = apply_filters('sme_import_status_response', $response, $batch); // Get status. $status = isset($response['status']) ? $response['status'] : 2; // Get messages. $messages = isset($response['messages']) ? $response['messages'] : array(); // Prepare and return the XML-RPC response data. return $this->xmlrpc_client->prepare_response(array('status' => $status, 'messages' => $messages)); }