public function onActionResponse(MWP_Event_ActionResponse $event) { $rawData = $event->getRequest()->getData(); if (empty($rawData['stateParams'])) { return; } $stateAction = new MWP_Action_GetState(); $stateAction->setContainer($this->container); $stateData = $stateAction->execute($rawData['stateParams']); $actionData = $event->getData(); $actionData['state'] = $stateData; }
public function onActionResponse(MWP_Event_ActionResponse $event) { $data = $event->getData(); if ($event->getRequest()->getAction() !== 'execute_php_code') { return; } if ($event->getRequest()->getProtocol() >= 1) { return; } if (!empty($data['fatalError']['message'])) { throw new MWP_Worker_Exception(MWP_Worker_Exception::PHP_EVAL_ERROR, sprintf('Fatal error [%s]: %s in %s on line %d', self::$errorMap[$data['fatalError']['type']], $data['fatalError']['message'], $data['fatalError']['file'], $data['fatalError']['line'])); } $event->setData(isset($data['output']) ? $data['output'] : ''); }
public function onActionResponse(MWP_Event_ActionResponse $event) { $response = $event->getResponse(); if ($response === null) { return; } $messages = $this->updaterSkin->get_upgrade_messages(); if (!$messages) { return; } $data = $response->getContent(); $data['updaterLog'] = $messages; $response->setContent($data); }
/** * Set MWP_Action_IncrementalBackup_FetchFiles action response */ public function onActionResponse(MWP_Event_ActionResponse $event) { $action = $event->getRequest()->getAction(); if ($action !== 'fetch_files' && $action !== 'dump_tables') { return; } // Prevent other listeners from hijacking this response $event->stopPropagation(); /** @var MWP_IncrementalBackup_Model_FetchFilesResult $result */ $result = $event->getData(); $parts = array(); $parts[] = new MWP_Http_MultipartResponsePart(array('content-type' => 'application/json'), json_encode($result->getServerStatistics()->toArray())); foreach ($result->getFiles() as $file) { $parts[] = new MWP_Http_MultipartResponsePart(array('content-type' => 'application/octet-stream', 'content-location' => $file->getPathname()), $file->getStream(), $file->getEncoding()); } $event->setResponse(new MWP_Http_MultipartResponse($parts, $this->boundary)); }
public function onActionResponse(MWP_Event_ActionResponse $event) { if ($event->getRequest()->getAction() !== 'add_site') { return; } if ($event->getRequest()->getProtocol() >= 100) { return; } $params = $event->getRequest()->getParams(); $this->context->requireWpRewrite(); $this->context->requireTaxonomies(); $this->context->requirePostTypes(); $this->context->requireTheme(); $this->context->requireCookieConstants(); $stats = new MMB_Stats(); if (!empty($params['notifications'])) { $this->context->optionSet('mwp_notifications', $params['notifications']); } $event->setData($stats->get_initial_stats()); }
public function encodeResponse(MWP_Event_ActionResponse $event) { $event->setData(array('success' => $event->getData())); }
public function onActionResponse(MWP_Event_ActionResponse $event) { $event->setResponse($this->getResponseForRequest($event->getRequest(), $event->getData())); }