package.xml0000664000175000017500000001553512453722330011311 0ustar janjan Horde_Scribe pear.horde.org Scribe Packaged version of the PHP Scribe client. Chuck Hagenbuch chuck chuck@horde.org yes 2015-01-09 2.0.2 1.0.0 stable stable Apache 2.0 * [jan] Add Composer definition. 5.3.0 6.0.0alpha1 6.0.0alpha1 1.7.0 Horde_Thrift pear.horde.org 1.0.0alpha1 1.0.0 alpha alpha 2011-03-08 Apache 2.0 * First alpha release for Horde 4. * Initial packaging of autogenerated Scribe thrift code 1.0.0beta1 1.0.0 beta beta 2011-03-16 Apache 2.0 * First beta release for Horde 4. 1.0.0RC1 1.0.0 beta beta 2011-03-22 Apache 2.0 * First release candidate for Horde 4. 1.0.0RC2 1.0.0 beta beta 2011-03-29 Apache 2.0 * Second release candidate for Horde 4. 1.0.0 1.0.0 stable stable 2011-04-06 Apache 2.0 * First stable release for Horde 4. 1.0.1 1.0.0 stable stable 2011-07-27 Apache 2.0 * [cjh] Add dependency on Horde_Thrift. 1.0.2 1.0.0 stable stable 2012-04-10 Apache 2.0 * [rla] Add license file. 2.0.0alpha1 1.0.0 alpha stable 2012-07-05 Apache 2.0 * First alpha release for Horde 5. 2.0.0beta1 1.0.0 beta stable 2012-07-19 Apache 2.0 * First beta release for Horde 5. 2.0.0 1.0.0 stable stable 2012-10-30 Apache 2.0 * First stable release for Horde 5. 2.0.1 1.0.0 stable stable 2012-11-22 Apache 2.0 * [jan] Re-packaged 2.0.0 release. 2.0.2 1.0.0 stable stable 2015-01-09 Apache 2.0 * [jan] Add Composer definition. Horde_Scribe-2.0.2/doc/Horde/Scribe/examples/scribe.php0000664000175000017500000000041412453722330020762 0ustar janjanconnect('localhost', 1463); $scribe->log('keyword', 'This is a message for the keyword category'); Horde_Scribe-2.0.2/doc/Horde/Scribe/COPYING0000664000175000017500000000413612453722330016224 0ustar janjan Version 1.0 Copyright 1999-2015 Horde LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by Horde LLC (http://www.horde.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Horde" and "Horde LLC" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact core@horde.org. 5. Products derived from this software may not be called "Horde", nor may "Horde" appear in their name, without prior written permission of Horde LLC. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HORDE PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of Horde LLC. For more information on Horde LLC, please see . Horde_Scribe-2.0.2/lib/Horde/Scribe/Client.php0000664000175000017500000000204512453722330017116 0ustar janjan_transport = new TFramedTransport($socket); $protocol = new TBinaryProtocol($this->_transport, false, false); $this->_client = new scribeClient($protocol, $protocol); } public function log($category, $message) { $this->logMulti(array($this->makeEntry($category, $message))); } public function logMulti(array $messages) { $this->_transport->open(); $this->_client->Log($messages); $this->_transport->close(); } public function makeEntry($category, $message) { return new LogEntry(array('category' => $category, 'message' => $message)); } } Horde_Scribe-2.0.2/lib/Horde/Thrift/thrift_root/packages/scribe/scribe_types.php0000664000175000017500000000516412453722330026021 0ustar janjan 0, 'TRY_LATER' => 1, ); final class ResultCode { const OK = 0; const TRY_LATER = 1; public static $__names = array( 0 => 'OK', 1 => 'TRY_LATER', ); } class LogEntry { static $_TSPEC; public $category = null; public $message = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( 1 => array( 'var' => 'category', 'type' => TType::STRING, ), 2 => array( 'var' => 'message', 'type' => TType::STRING, ), ); } if (is_array($vals)) { if (isset($vals['category'])) { $this->category = $vals['category']; } if (isset($vals['message'])) { $this->message = $vals['message']; } } } public function getName() { return 'LogEntry'; } public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 1: if ($ftype == TType::STRING) { $xfer += $input->readString($this->category); } else { $xfer += $input->skip($ftype); } break; case 2: if ($ftype == TType::STRING) { $xfer += $input->readString($this->message); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; } public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('LogEntry'); if ($this->category !== null) { $xfer += $output->writeFieldBegin('category', TType::STRING, 1); $xfer += $output->writeString($this->category); $xfer += $output->writeFieldEnd(); } if ($this->message !== null) { $xfer += $output->writeFieldBegin('message', TType::STRING, 2); $xfer += $output->writeString($this->message); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; } } ?> Horde_Scribe-2.0.2/lib/Horde/Thrift/thrift_root/scribe.php0000664000175000017500000001656612453722330021560 0ustar janjansend_Log($messages); return $this->recv_Log(); } public function send_Log($messages) { $args = new scribe_Log_args(); $args->messages = $messages; $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { thrift_protocol_write_binary($this->output_, 'Log', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); } else { $this->output_->writeMessageBegin('Log', TMessageType::CALL, $this->seqid_); $args->write($this->output_); $this->output_->writeMessageEnd(); $this->output_->getTransport()->flush(); } } public function recv_Log() { $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'scribe_Log_result', $this->input_->isStrictRead()); else { $rseqid = 0; $fname = null; $mtype = 0; $this->input_->readMessageBegin($fname, $mtype, $rseqid); if ($mtype == TMessageType::EXCEPTION) { $x = new TApplicationException(); $x->read($this->input_); $this->input_->readMessageEnd(); throw $x; } $result = new scribe_Log_result(); $result->read($this->input_); $this->input_->readMessageEnd(); } if ($result->success !== null) { return $result->success; } throw new Exception("Log failed: unknown result"); } } // HELPER FUNCTIONS AND STRUCTURES class scribe_Log_args { static $_TSPEC; public $messages = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( 1 => array( 'var' => 'messages', 'type' => TType::LST, 'etype' => TType::STRUCT, 'elem' => array( 'type' => TType::STRUCT, 'class' => 'LogEntry', ), ), ); } if (is_array($vals)) { if (isset($vals['messages'])) { $this->messages = $vals['messages']; } } } public function getName() { return 'scribe_Log_args'; } public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 1: if ($ftype == TType::LST) { $this->messages = array(); $_size0 = 0; $_etype3 = 0; $xfer += $input->readListBegin($_etype3, $_size0); for ($_i4 = 0; $_i4 < $_size0; ++$_i4) { $elem5 = null; $elem5 = new LogEntry(); $xfer += $elem5->read($input); $this->messages []= $elem5; } $xfer += $input->readListEnd(); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; } public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('scribe_Log_args'); if ($this->messages !== null) { if (!is_array($this->messages)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } $xfer += $output->writeFieldBegin('messages', TType::LST, 1); { $output->writeListBegin(TType::STRUCT, count($this->messages)); { foreach ($this->messages as $iter6) { $xfer += $iter6->write($output); } } $output->writeListEnd(); } $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; } } class scribe_Log_result { static $_TSPEC; public $success = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( 0 => array( 'var' => 'success', 'type' => TType::I32, ), ); } if (is_array($vals)) { if (isset($vals['success'])) { $this->success = $vals['success']; } } } public function getName() { return 'scribe_Log_result'; } public function read($input) { $xfer = 0; $fname = null; $ftype = 0; $fid = 0; $xfer += $input->readStructBegin($fname); while (true) { $xfer += $input->readFieldBegin($fname, $ftype, $fid); if ($ftype == TType::STOP) { break; } switch ($fid) { case 0: if ($ftype == TType::I32) { $xfer += $input->readI32($this->success); } else { $xfer += $input->skip($ftype); } break; default: $xfer += $input->skip($ftype); break; } $xfer += $input->readFieldEnd(); } $xfer += $input->readStructEnd(); return $xfer; } public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('scribe_Log_result'); if ($this->success !== null) { $xfer += $output->writeFieldBegin('success', TType::I32, 0); $xfer += $output->writeI32($this->success); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; } } class scribeProcessor extends FacebookServiceProcessor { public function __construct($handler) { parent::__construct($handler); } public function process($input, $output) { $rseqid = 0; $fname = null; $mtype = 0; $input->readMessageBegin($fname, $mtype, $rseqid); $methodname = 'process_'.$fname; if (!method_exists($this, $methodname)) { $input->skip(TType::STRUCT); $input->readMessageEnd(); $x = new TApplicationException('Function '.$fname.' not implemented.', TApplicationException::UNKNOWN_METHOD); $output->writeMessageBegin($fname, TMessageType::EXCEPTION, $rseqid); $x->write($output); $output->writeMessageEnd(); $output->getTransport()->flush(); return; } $this->$methodname($rseqid, $input, $output); return true; } protected function process_Log($seqid, $input, $output) { $args = new scribe_Log_args(); $args->read($input); $input->readMessageEnd(); $result = new scribe_Log_result(); $result->success = $this->handler_->Log($args->messages); $output->writeMessageBegin('Log', TMessageType::REPLY, $seqid); $result->write($output); $output->getTransport()->flush(); } } ?> Horde_Scribe-2.0.2/lib/Horde/Scribe.php0000664000175000017500000000026212453722330015677 0ustar janjan