/** * Forces the server to refresh its configuration. * * @since 5.1 * @return string Server result string. */ public function refresh() { try { $result = ''; $auth = ModuleServerAuthenticator::instance('ModuleServerAuthenticator'); $this->socket->connect($this->host, $this->port); $request = 'REFRESH Module/1.0' . "\r\n"; $request .= 'User: admin' . "\r\n"; $request .= 'Password: '******'admin') . "\r\n"; $this->socket->write($request); $result = $this->socket->readAll(); $this->socket->disconnect(); } catch (\Innomatic\Net\Socket\SocketException $e) { $result = 'Module server is down.' . "\n"; } return $result; }
/** * force the ModuleServiceSocketHandler to refresh the registry * * @since 5.1 */ protected function force_refresh() { print "force_refresh" . "\n"; $request = ''; $address = '127.0.0.1'; $context = \Innomatic\Module\Server\ModuleServerContext::instance('\\Innomatic\\Module\\Server\\ModuleServerContext'); try { $port = $context->getConfig()->getKey('service_port'); $this->socket->connect($address, $port); $request = 'REFRESH Module/1.1' . "\r\n"; $request .= 'User: admin' . "\r\n"; $request .= 'Password: '******'admin') . "\r\n"; $this->socket->write($request); $result = $this->socket->readAll(); $this->socket->disconnect(); } catch (\Innomatic\Net\Socket\SocketException $e) { print "Cannot refresh: server " . $address . ":" . $port . " down!" . "\n"; } print $result; }