Permalink
Browse files

add port option to graylog2

  • Loading branch information...
1 parent 4989b6a commit 98812d76f9cb8f4e938876ac0d0b4e23f919af6f Claas Hilbrecht committed Apr 1, 2012
@@ -34,6 +34,7 @@ public function __construct($filename)
$this->setFormatter(new Zend_Log_Formatter_Simple());
$helper = Mage::helper('hackathon_logger');
$this->options['hostname'] = $helper->getLoggerConfig('graylog2/hostname');
+ $this->options['port'] = $helper->getLoggerConfig('graylog2/port');
$this->options['filename'] = $filename;
}
@@ -92,7 +93,7 @@ public function shutdown()
// Finally, send the Event, but re-throw any exceptions at the
// proper level of abstraction.
try {
- $graylog2 = new GELFMessagePublisher($this->options['hostname']);
+ $graylog2 = new GELFMessagePublisher($this->options['hostname'], $this->options['port']);
$msg = new GELFMessage();
//$msg->setShortMessage('something is broken.');
@@ -164,6 +164,14 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</hostname>
+ <port translate="label">
+ <label>Port</label>
+ <frontend_type>text</frontend_type>
+ <sort_order>10</sort_order>
+ <show_in_default>1</show_in_default>
+ <show_in_website>1</show_in_website>
+ <show_in_store>1</show_in_store>
+ </port>
</fields>
</graylog2>
</groups>
View
@@ -1,125 +0,0 @@
-8
-
-dir
-76
-svn://netflint.net/xmpphp/XMPPHP
-svn://netflint.net/xmpphp
-
-
-
-2009-03-16T14:04:15.599819Z
-76
-fritzy
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-ef36c318-a008-4979-b6e8-6b496270793b
-
-BOSH.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-5d840a3adc6064d8155171e42c46956e
-2009-01-30T09:28:35.424772Z
-75
-temp
-
-XMLObj.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-c03b008fda3814f9ebfbe683f76c17ee
-2008-11-12T00:35:06.546622Z
-64
-gar
-
-XMLStream.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-ebf9581d7e5e0a9e05ae4d6dd32da762
-2009-03-16T14:04:15.599819Z
-76
-fritzy
-
-Exception.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-dd80525374bfd28e250ac748405c7aa2
-2008-11-12T00:35:06.546622Z
-64
-gar
-has-props
-
-Roster.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-eb8e55107910b601e65c56a580bdd5f0
-2008-11-12T00:35:06.546622Z
-64
-gar
-
-Log.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-49e2d5209df8b3f1d509d7bcdb850225
-2008-11-21T08:11:59.923313Z
-65
-fritzy
-
-XMPP_Old.php
-file
-
-
-
-
-2009-07-26T16:57:55.000000Z
-dc6d45fc7fb47c4452d6183a4b772e0a
-2008-11-12T00:35:06.546622Z
-64
-gar
-
-XMPP.php
-file
-77
-
-
-
-2009-07-26T17:01:08.000000Z
-13918023083914fbbf9f30cdf9ff1634
-2009-07-26T17:09:57.681059Z
-77
-fritzy
-
View
@@ -1 +0,0 @@
-8
@@ -1,5 +0,0 @@
-K 14
-svn:executable
-V 1
-*
-END
@@ -1,188 +0,0 @@
-<?php
-/**
- * XMPPHP: The PHP XMPP Library
- * Copyright (C) 2008 Nathanael C. Fritz
- * This file is part of SleekXMPP.
- *
- * XMPPHP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * XMPPHP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XMPPHP; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fritzy@netflint.net>
- * @author Stephan Wentz <JID: stephan@jabber.wentz.it>
- * @author Michael Garvin <JID: gar@netflint.net>
- * @copyright 2008 Nathanael C. Fritz
- */
-
-/** XMPPHP_XMLStream */
-require_once dirname(__FILE__) . "/XMPP.php";
-
-/**
- * XMPPHP Main Class
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fritzy@netflint.net>
- * @author Stephan Wentz <JID: stephan@jabber.wentz.it>
- * @author Michael Garvin <JID: gar@netflint.net>
- * @copyright 2008 Nathanael C. Fritz
- * @version $Id$
- */
-class XMPPHP_BOSH extends XMPPHP_XMPP {
-
- protected $rid;
- protected $sid;
- protected $http_server;
- protected $http_buffer = Array();
- protected $session = false;
-
- public function connect($server, $wait='1', $session=false) {
- $this->http_server = $server;
- $this->use_encryption = false;
- $this->session = $session;
-
- $this->rid = 3001;
- $this->sid = null;
- if($session)
- {
- $this->loadSession();
- }
- if(!$this->sid) {
- $body = $this->__buildBody();
- $body->addAttribute('hold','1');
- $body->addAttribute('to', $this->host);
- $body->addAttribute('route', "xmpp:{$this->host}:{$this->port}");
- $body->addAttribute('secure','true');
- $body->addAttribute('xmpp:version','1.6', 'urn:xmpp:xbosh');
- $body->addAttribute('wait', strval($wait));
- $body->addAttribute('ack','1');
- $body->addAttribute('xmlns:xmpp','urn:xmpp:xbosh');
- $buff = "<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>";
- xml_parse($this->parser, $buff, false);
- $response = $this->__sendBody($body);
- $rxml = new SimpleXMLElement($response);
- $this->sid = $rxml['sid'];
-
- } else {
- $buff = "<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>";
- xml_parse($this->parser, $buff, false);
- }
- }
-
- public function __sendBody($body=null, $recv=true) {
- if(!$body) {
- $body = $this->__buildBody();
- }
- $ch = curl_init($this->http_server);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $body->asXML());
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- $header = array('Accept-Encoding: gzip, deflate','Content-Type: text/xml; charset=utf-8');
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header );
- curl_setopt($ch, CURLOPT_VERBOSE, 0);
- $output = '';
- if($recv) {
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $output = curl_exec($ch);
- $this->http_buffer[] = $output;
- }
- curl_close($ch);
- return $output;
- }
-
- public function __buildBody($sub=null) {
- $xml = new SimpleXMLElement("<body xmlns='http://jabber.org/protocol/httpbind' xmlns:xmpp='urn:xmpp:xbosh' />");
- $xml->addAttribute('content', 'text/xml; charset=utf-8');
- $xml->addAttribute('rid', $this->rid);
- $this->rid += 1;
- if($this->sid) $xml->addAttribute('sid', $this->sid);
- #if($this->sid) $xml->addAttribute('xmlns', 'http://jabber.org/protocol/httpbind');
- $xml->addAttribute('xml:lang', 'en');
- if($sub) { // ok, so simplexml is lame
- $p = dom_import_simplexml($xml);
- $c = dom_import_simplexml($sub);
- $cn = $p->ownerDocument->importNode($c, true);
- $p->appendChild($cn);
- $xml = simplexml_import_dom($p);
- }
- return $xml;
- }
-
- public function __process() {
- if($this->http_buffer) {
- $this->__parseBuffer();
- } else {
- $this->__sendBody();
- $this->__parseBuffer();
- }
- }
-
- public function __parseBuffer() {
- while ($this->http_buffer) {
- $idx = key($this->http_buffer);
- $buffer = $this->http_buffer[$idx];
- unset($this->http_buffer[$idx]);
- if($buffer) {
- $xml = new SimpleXMLElement($buffer);
- $children = $xml->xpath('child::node()');
- foreach ($children as $child) {
- $buff = $child->asXML();
- $this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
- xml_parse($this->parser, $buff, false);
- }
- }
- }
- }
-
- public function send($msg) {
- $this->log->log("SEND: $msg", XMPPHP_Log::LEVEL_VERBOSE);
- $msg = new SimpleXMLElement($msg);
- #$msg->addAttribute('xmlns', 'jabber:client');
- $this->__sendBody($this->__buildBody($msg), true);
- #$this->__parseBuffer();
- }
-
- public function reset() {
- $this->xml_depth = 0;
- unset($this->xmlobj);
- $this->xmlobj = array();
- $this->setupParser();
- #$this->send($this->stream_start);
- $body = $this->__buildBody();
- $body->addAttribute('to', $this->host);
- $body->addAttribute('xmpp:restart', 'true', 'urn:xmpp:xbosh');
- $buff = "<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>";
- $response = $this->__sendBody($body);
- $this->been_reset = true;
- xml_parse($this->parser, $buff, false);
- }
-
- public function loadSession() {
- if(isset($_SESSION['XMPPHP_BOSH_RID'])) $this->rid = $_SESSION['XMPPHP_BOSH_RID'];
- if(isset($_SESSION['XMPPHP_BOSH_SID'])) $this->sid = $_SESSION['XMPPHP_BOSH_SID'];
- if(isset($_SESSION['XMPPHP_BOSH_authed'])) $this->authed = $_SESSION['XMPPHP_BOSH_authed'];
- if(isset($_SESSION['XMPPHP_BOSH_jid'])) $this->jid = $_SESSION['XMPPHP_BOSH_jid'];
- if(isset($_SESSION['XMPPHP_BOSH_fulljid'])) $this->fulljid = $_SESSION['XMPPHP_BOSH_fulljid'];
- }
-
- public function saveSession() {
- $_SESSION['XMPPHP_BOSH_RID'] = (string) $this->rid;
- $_SESSION['XMPPHP_BOSH_SID'] = (string) $this->sid;
- $_SESSION['XMPPHP_BOSH_authed'] = (boolean) $this->authed;
- $_SESSION['XMPPHP_BOSH_jid'] = (string) $this->jid;
- $_SESSION['XMPPHP_BOSH_fulljid'] = (string) $this->fulljid;
- }
-}
@@ -1,41 +0,0 @@
-<?php
-/**
- * XMPPHP: The PHP XMPP Library
- * Copyright (C) 2008 Nathanael C. Fritz
- * This file is part of SleekXMPP.
- *
- * XMPPHP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * XMPPHP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XMPPHP; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fritzy@netflint.net>
- * @author Stephan Wentz <JID: stephan@jabber.wentz.it>
- * @author Michael Garvin <JID: gar@netflint.net>
- * @copyright 2008 Nathanael C. Fritz
- */
-
-/**
- * XMPPHP Exception
- *
- * @category xmpphp
- * @package XMPPHP
- * @author Nathanael C. Fritz <JID: fritzy@netflint.net>
- * @author Stephan Wentz <JID: stephan@jabber.wentz.it>
- * @author Michael Garvin <JID: gar@netflint.net>
- * @copyright 2008 Nathanael C. Fritz
- * @version $Id$
- */
-class XMPPHP_Exception extends Exception {
-}
Oops, something went wrong.

0 comments on commit 98812d7

Please sign in to comment.