/** * Deploy batch. * * Send batch from content staging environment to production. Data is * stored on the production environment. * * Display any messages that is returned by production. */ public function deploy() { // Check that the current request carries a valid nonce. check_admin_referer('sme-deploy-batch', 'sme_deploy_batch_nonce'); $batch = null; // Requested batch ID. $batch_id = intval($_GET['id']); // Get batch. $batch = $this->batch_dao->find($batch_id); // Make sure a valid batch has been requested. if (!$batch instanceof Batch || $batch->get_status() !== 'publish') { wp_die(__('No batch found.', 'sme-content-staging')); } // Deploy the batch. $response = $this->api->deploy($batch); // Get messages received from production. $status = isset($response['status']) ? $response['status'] : 0; $messages = isset($response['messages']) ? $response['messages'] : array(); // Render page. $this->template->render('deploy-batch', array('status' => $status, 'messages' => $messages)); }