]>
Commit | Line | Data |
---|---|---|
b43ab1a6 JP |
1 | <?php |
2 | ||
997305cf JP |
3 | require_once('mitsql.cfg.php'); |
4 | require_once('mitsql.lib.php'); | |
5 | ||
377015e0 JP |
6 | function getManagedDBs($owner=null) { |
7 | $databases = array_keys(fetchRows(DBSelect('SHOW DATABASES'),'Database')); | |
8 | $owners = array(); | |
9 | foreach($databases as $database) { | |
10 | if (stristr($database, DELIMETER)) { | |
11 | $exp = explode(DELIMETER, $database); | |
12 | $thisowner = array_shift($exp); | |
13 | if (!is_null($owner) && $thisowner!=$owner) { continue; } | |
14 | isset($owners[$thisowner]) || $owners[$thisowner] = array(); | |
15 | $owners[$thisowner][] = $database; | |
16 | } | |
17 | } | |
18 | return $owners; | |
19 | } | |
997305cf | 20 | |
377015e0 JP |
21 | $g = getManagedDBs(); |
22 | print_r($g); | |
997305cf | 23 | |
377015e0 | 24 | ?> |