1: <?php
2: /**
3: * Copyright 2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Compose storage driver for the IMP_Maillog class.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: class IMP_Maillog_Storage_Composite extends IMP_Maillog_Storage_Base
24: {
25: /**
26: * List of drivers.
27: *
28: * @var array
29: */
30: protected $_drivers;
31:
32: /**
33: * Constructor.
34: *
35: * @param array $drivers List of drivers.
36: */
37: public function __construct(array $drivers)
38: {
39: $this->_drivers = $drivers;
40: }
41:
42: /**
43: */
44: public function saveLog(
45: IMP_Maillog_Message $msg, IMP_Maillog_Log_Base $log
46: )
47: {
48: foreach ($this->_drivers as $val) {
49: if ($val->saveLog($msg, $log)) {
50: return true;
51: }
52: }
53:
54: return false;
55: }
56:
57: /**
58: */
59: public function getLog(IMP_Maillog_Message $msg, array $filter = array())
60: {
61: $out = array();
62:
63: foreach ($this->_drivers as $val) {
64: $out = array_merge($out, $val->getLog($msg, $filter));
65: }
66:
67: return $out;
68: }
69:
70: /**
71: */
72: public function deleteLogs(array $msgs)
73: {
74: foreach ($this->_drivers as $val) {
75: $val->deleteLogs($msgs);
76: }
77: }
78:
79: /**
80: */
81: public function getChanges($ts)
82: {
83: $out = array();
84:
85: foreach ($this->_drivers as $val) {
86: $out = array_merge($out, $val->getChanges($ts));
87: }
88:
89: return $out;
90: }
91:
92: }
93: