/** * @service banner read * @param $bannerId * @return Gpf_Rpc_Action */ public function check(Gpf_Rpc_Params $params) { $response = new Gpf_Rpc_Action($params); $bannerFactory = new Pap_Common_Banner_Factory(); $site = $bannerFactory->getBanner($params->get('id')); $site->setDestinationUrl(rtrim($params->get('url'), "/\\").'/'); $response->setInfoMessage('Site replication .htaccess is working at this location'); $response->setErrorMessage('Site replication .htaccess is not set up at this location or it is not working correctly. Please make sure that you have mod_rewrite and mod_proxy enabled in your Apache configuration'); $testUser = new Pap_Common_User(); $testUser->setRefId(Pap_Features_SiteReplication_Replicator::TEST_STRING); $request = new Gpf_Net_Http_Request(); $request->setUrl($site->getUrl($testUser).Pap_Features_SiteReplication_Replicator::TEST_STRING); $httpClient = new Gpf_Net_Http_Client(); try { $testResponse = $httpClient->execute($request); if ($testResponse->getBody() == Pap_Features_SiteReplication_Replicator::TEST_RESPONSE) { $response->addOk(); } else { $response->addError(); } } catch (Gpf_Exception $e) { $response->addError(); } return $response; }
public function setUsernameRefid(Pap_Common_User $user) { $user->setRefId($user->getUserName()); }