fix #8131 - chinese translations
[Pman.Core] / Heartbeat.php
1 <?php
2
3 // check if database is workign - used by nagios checking - to see if server is really up.
4
5 require_once 'Pman.php';
6
7 class Pman_Core_Heartbeat extends Pman
8 {
9     function getAuth()
10     {
11         return true;
12     }
13     
14     function get($req, $opts = array())
15     {
16         $this->post($req);
17         die("POST only");
18     }
19     
20     function post($req)
21     {
22         $this->initErrorHandling();
23         $cd = DB_DataObject::Factory('core_enum');
24         $cd->setFrom(array(
25             'etype' => 'heartbeat',
26             'name' => 'last_update'
27         ));
28         if (!$cd->count()) {
29             $cd->display_name = date("Y-m-d H:i:s");
30             $cd->insert();
31             die("OK - HEARTBEAT WORKING");
32         }
33         $cd->find(true);
34         $cc = clone($cd);
35         $cd->display_name = date("Y-m-d H:i:s");
36         $cd->update($cc);
37         die("OK - HEARTBEAT WORKING");
38     }
39     
40      
41     function onPearError($err)
42     {
43       //  print_r($err);
44         die("FAILED");
45     }
46     function onException($err)
47     {
48       //  print_r($err);
49         die("FAILED");
50     }
51 }