]> andersk Git - sql-web.git/blob - test.php
6109019462b50d69985cfea536546bf39490c671
[sql-web.git] / test.php
1 <?php
2
3 require_once('mitsql.cfg.php');
4 require_once('mitsql.lib.php');
5
6 include 'tpl/head.php';
7
8 function getManagedDBs($owner=null) {
9         $databases = array_keys(fetchRows(DBSelect('SELECT Name FROM DB WHERE bEnabled=1'),'Name'));
10         $owners = array();
11         foreach($databases as $database) {
12                 if (stristr($database, DELIMETER)) {
13                         $exp = explode(DELIMETER, $database);
14                         $thisowner = array_shift($exp);
15                         if (!is_null($owner) && $thisowner!=$owner) { continue; }
16                         isset($owners[$thisowner]) || $owners[$thisowner] = array();
17                         $owners[$thisowner][] = $database;
18                 }
19         }
20         return $owners;
21 }
22
23 function checkQuotas() {
24         $databases = fetchRows(DBSelect('SELECT DatabaseId,Name FROM DB WHERE bEnabled=1'),'Name');
25         foreach($databases as $db) {
26                 $DBId = $db['DatabaseId'];
27                 $arr['dLastCheck'] = 'NOW()';
28                 $arr['nBytes'] = calcDBSize($db['Name']);
29                 $sql = sprintf("UPDATE DB %s WHERE DatabaseId = '%s'",
30                                                 buildSQLSet($arr),
31                                                 mysql_escape_string($DBId));
32                 DBUpdate($sql);
33         }
34 }
35
36 /*
37 $g = getManagedDBs();
38 print_r($g);
39
40 $User = new User($Login->getUserId());
41 print_r($User->getDBList());
42 */
43
44 checkQuotas();
45
46 include 'tpl/foot.php';
47 ?>
This page took 0.05329 seconds and 3 git commands to generate.