]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/queuemanager.php
change Laconica and Control Yourself to StatusNet in PHP files
[quix0rs-gnu-social.git] / lib / queuemanager.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  *
5  * Abstract class for queue managers
6  *
7  * PHP version 5
8  *
9  * LICENCE: This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Affero General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Affero General Public License for more details.
18  *
19  * You should have received a copy of the GNU Affero General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * @category  QueueManager
23  * @package   StatusNet
24  * @author    Evan Prodromou <evan@controlyourself.ca>
25  * @author    Sarven Capadisli <csarven@controlyourself.ca>
26  * @copyright 2009 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28  * @link      http://laconi.ca/
29  */
30
31 class QueueManager
32 {
33     static $qm = null;
34
35     static function get()
36     {
37         if (empty(self::$qm)) {
38
39             if (Event::handle('StartNewQueueManager', array(&self::$qm))) {
40
41                 $enabled = common_config('queue', 'enabled');
42                 $type = common_config('queue', 'subsystem');
43
44                 if (!$enabled) {
45                     // does everything immediately
46                     self::$qm = new UnQueueManager();
47                 } else {
48                     switch ($type) {
49                      case 'db':
50                         self::$qm = new DBQueueManager();
51                         break;
52                      case 'stomp':
53                         self::$qm = new StompQueueManager();
54                         break;
55                      default:
56                         throw new ServerException("No queue manager class for type '$type'");
57                     }
58                 }
59             }
60         }
61
62         return self::$qm;
63     }
64
65     function enqueue($object, $queue)
66     {
67         throw ServerException("Unimplemented function 'enqueue' called");
68     }
69
70     function service($queue, $handler)
71     {
72         throw ServerException("Unimplemented function 'service' called");
73     }
74 }