Quick Search:

View

Revision:

Diff

Diff from 153 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/includes/classes/services.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
153
3   $Id: services.php 153 2005-08-04 12:57:59Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
8   Copyright (c) 2004 osCommerce
9
10   Released under the GNU General Public License
11 */
12
13   class osC_Services {
14     var $services,
15         $started_services;
16
17     function osC_Services() {
18       $this->services = explode(';', MODULE_SERVICES_INSTALLED);
19     }
20
21     function startServices() {
22       $this->started_services = array();
23
24       foreach ($this->services as $service) {
25         $this->startService($service);
26       }
27     }
28
29     function stopServices() {
30 /*
31   ugly workaround to force the output_compression/GZIP service module to be stopped last
32   to make sure all content in the buffer is compressed and sent to the client
33 */
34       if ($this->isStarted('output_compression')) {
35         $key = array_search('output_compression', $this->started_services);
36         unset($this->started_services[$key]);
37
38         $this->started_services[] = 'output_compression';
39       }
40
41       foreach ($this->started_services as $service) {
42         $this->stopService($service);
43       }
44     }
45
46     function startService($service) {
47       include('includes/modules/services/' . $service . '.php');
48
49       if (@call_user_func(array('osC_Services_' . $service, 'start'))) {
50         $this->started_services[] = $service;
51       }
52     }
53
54     function stopService($service) {
55       @call_user_func(array('osC_Services_' . $service, 'stop'));
56     }
57
58
59     function isStarted($service) {
60       return in_array($service, $this->started_services);
61     }
62   }
63 ?>