This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into acceptHandling
Conflicts: library/Zend/Http/Header/AbstractAccept.php library/Zend/Http/Header/AcceptEncoding.php library/Zend/Http/Header/AcceptLanguage.php tests/Zend/Http/Header/AcceptCharsetTest.php tests/Zend/Http/Header/AcceptEncodingTest.php tests/Zend/Http/Header/AcceptLanguageTest.php tests/Zend/Http/Header/AcceptTest.php
- Loading branch information
Showing
22 changed files
with
266 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Log | ||
*/ | ||
|
||
namespace Zend\Log\Writer; | ||
|
||
use Mongo; | ||
use Zend\Log\Exception\InvalidArgumentException; | ||
use Zend\Log\Exception\RuntimeException; | ||
use Zend\Log\Formatter\FormatterInterface; | ||
|
||
/** | ||
* MongoDB log writer. | ||
* | ||
* @category Zend | ||
* @package Zend_Log | ||
* @subpackage Writer | ||
*/ | ||
class MongoDB extends AbstractWriter | ||
{ | ||
/** | ||
* MongoCollection instance | ||
* | ||
* @var MongoCollection | ||
*/ | ||
protected $mongoCollection; | ||
|
||
/** | ||
* Options used for MongoCollection::save() | ||
* | ||
* @var array | ||
*/ | ||
protected $saveOptions; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param Mongo $mongo | ||
* @param string $database | ||
* @param string $collection | ||
* @param array $saveOptions | ||
* @return Zend\Log\Writer\MongoDB | ||
*/ | ||
public function __construct(Mongo $mongo, $database, $collection, array $saveOptions = array()) | ||
{ | ||
$this->mongoCollection = $mongo->selectCollection($database, $collection); | ||
$this->saveOptions = $saveOptions; | ||
} | ||
|
||
/** | ||
* This writer does not support formatting. | ||
* | ||
* @param Zend\Log\Formatter\FormatterInterface $formatter | ||
* @return void | ||
* @throws Zend\Log\Exception\InvalidArgumentException | ||
*/ | ||
public function setFormatter(FormatterInterface $formatter) | ||
{ | ||
throw new InvalidArgumentException(get_class() . ' does not support formatting'); | ||
} | ||
|
||
/** | ||
* Write a message to the log. | ||
* | ||
* @param array $event Event data | ||
* @return void | ||
* @throws Zend\Log\Exception\RuntimeException | ||
*/ | ||
protected function doWrite(array $event) | ||
{ | ||
if (null === $this->mongoCollection) { | ||
throw new RuntimeException('MongoCollection must be defined'); | ||
} | ||
|
||
$this->mongoCollection->save($event, $this->saveOptions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.