Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Updated feature: Gleez Mango component v1.0.0
Browse files Browse the repository at this point in the history
- Moved Gleez Mango component to submodule
- Added Client::getCollectionClass
- Added Client::getMongoVersion
- Fixed Log_Mango, Session_Mango, Cache_Mango classes
- Updated PHPDoc
- Updated guide
- Updated Russian i18n
- Initial pass for PSR-0 autoloading support
- PSR-1/PSR-2 code style
- Removed more not needed dependencies
- Minor fixes
- Cleanup code
  • Loading branch information
sergeyklay committed Aug 28, 2014
1 parent 30ccdf3 commit 0ea7e68
Show file tree
Hide file tree
Showing 14 changed files with 1,516 additions and 1,773 deletions.
15 changes: 8 additions & 7 deletions application/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@
* Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'user' => MODPATH.'user', // User and group Administration
'database' => MODPATH.'database', // Database access
'image' => MODPATH.'image', // Image manipulation
'captcha' => MODPATH.'captcha', // Captcha implementation
'user' => MODPATH.'user', // User and group Administration
'database' => MODPATH.'database', // Database access
'image' => MODPATH.'image', // Image manipulation
'captcha' => MODPATH.'captcha', // Captcha implementation
'minion' => MODPATH.'minion', // For running tasks via the CLI
//'unittest' => MODPATH.'unittest', // Unit testing
//'codebench' => MODPATH.'codebench', // Benchmarking tool
//'mango' => MODPATH.'mango', // Gleez Mango
//'unittest' => MODPATH.'unittest', // Unit testing
//'codebench' => MODPATH.'codebench', // Benchmarking tool
//'mongodb' => MODPATH.'mongodb', // Gleez Mango Component
//'mango' => MODPATH.'mango', // Mango Reader
));

/**
Expand Down
26 changes: 17 additions & 9 deletions modules/gleez/classes/cache/mango.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?php
/**
* [Cache](api/Cache) Mango driver
* Gleez CMS (http://gleezcms.org)
*
* @link https://github.com/cleez/cms Canonical source repository
* @copyright Copyright (c) 2011-2014 Gleez Technologies
* @license http://gleezcms.org/license Gleez CMS License
*/

use \Gleez\Mango\Client;

/**
* [Cache](api/Cache) MongoDB driver
*
* ### System requirements
*
Expand All @@ -9,15 +19,13 @@
*
* @package Gleez\Cache\Base
* @author Gleez Team
* @version 1.2.0
* @copyright (c) 2012-2014 Gleez Technologies
* @license http://gleezcms.org/license Gleez CMS License
* @version 1.2.1
*/
class Cache_Mango extends Cache implements Cache_Tagging {

/**
* Mango_Collection instance
* @var Mango_Collection
* @var \Gleez\Mango\Collection
*/
private $collection;

Expand All @@ -42,7 +50,7 @@ public function __construct(array $config)
// Set default config
$default = array(
'driver' => 'mango',
'group' => Mango::$default,
'group' => Client::$default,
'collection' => 'cache',
'default_expire' => Cache::DEFAULT_EXPIRE,
);
Expand All @@ -56,8 +64,8 @@ public function __construct(array $config)
// Get collection name
$collection = $this->config('collection');

// Get Mango_Collection instance
$this->collection = Mango::instance($this->config('group'))->{$collection};
// Get \Gleez\Mango\Collection instance
$this->collection = Client::instance($this->config('group'))->{$collection};
}

/**
Expand Down Expand Up @@ -367,4 +375,4 @@ public function find($tag)

return $retval;
}
}
}
2 changes: 1 addition & 1 deletion modules/gleez/classes/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ public static function label($text, $label = 'default')
case 'critical':
case 'error':
case 'emergency':
$status = 'important';
$status = 'danger';
break;
case 'alert':
$status = 'warning';
Expand Down
28 changes: 18 additions & 10 deletions modules/gleez/classes/log/mango.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
<?php
/**
* Gleez CMS (http://gleezcms.org)
*
* @link https://github.com/cleez/cms Canonical source repository
* @copyright Copyright (c) 2011-2014 Gleez Technologies
* @license http://gleezcms.org/license Gleez CMS License
*/

use \Gleez\Mango\Client;

/**
* MongoDB log writer
*
Expand All @@ -9,9 +19,7 @@
*
* @package Gleez\Logging
* @author Gleez Team
* @version 0.2.3
* @copyright (c) 2011-2014 Gleez Technologies
* @license http://gleezcms.org/license Gleez CMS License
* @version 0.2.4
*/
class Log_Mango extends Log_Writer {

Expand All @@ -38,25 +46,25 @@ class Log_Mango extends Log_Writer {
/**
* Class constructor
*
* Creates a new MongoDB logger using Gleez [Mango]
* Creates a new MongoDB logger using [\Gleez\Mango\Client]
*
* Example:
* ~~~
* $writer = new Log_Mango($collection);
* ~~~
*
* @param string $collection Collection Name [Optional]
* @param string $collection Collection name [Optional]
* @param string $name Database instance name [Optional]
*
* @throws Mango_Exception
* @throws \Gleez\Mango\Exception
*/
public function __construct($collection = 'logs', $name = 'default')
{
$this->_collection = $collection;
$this->_name = $name;

// Getting Mango instance
$this->_db = Mango::instance($this->_name);
$this->_db = Client::instance($this->_name);
}

/**
Expand Down Expand Up @@ -92,10 +100,10 @@ public function write(array $messages)
// FIX: $message should consist of an array of strings
$message = array_filter($message, 'is_string');

// See MongoDate::__toString
// See \MongoDate::__toString
$message['time'] = new MongoDate(strtotime($message['time']));

if ($exception)
if ($exception && method_exists($exception, 'getTraceAsString'))
{
// Re-use as much as possible, just resetting the body to the trace
$message['body'] = $exception->getTraceAsString();
Expand All @@ -109,4 +117,4 @@ public function write(array $messages)
// Write messages
$this->_db->{$this->_collection}->batchInsert($logs);
}
}
}
Loading

0 comments on commit 0ea7e68

Please sign in to comment.