@@ -28,40 +28,28 @@ public function outputXmlTree(): void
2828 $ serverIdParam = RequestParameter::getString ('server ' );
2929 $ serverSession = !is_null ($ serverIdParam ) ? ServerSession::fromServerId ($ serverIdParam ) : null ;
3030 if (!is_null ($ serverSession )) {
31- $ db = $ serverSession ->getDatabaseConnection ();
32- $ dbs = $ db ->getDatabases ();
33- if ($ dbs instanceof \ADORecordSet) {
34- while (!$ dbs ->EOF ) {
35- if (
36- is_array ($ dbs ->fields ) &&
37- isset ($ dbs ->fields ['datname ' ]) &&
38- is_string ($ dbs ->fields ['datname ' ])
39- ) {
40- $ actionUrl = 'redirect.php ' ;
41- $ actionUrlParams = [
42- 'subject ' => 'database ' ,
43- 'server ' => $ serverSession ->id (),
44- 'database ' => $ dbs ->fields ['datname ' ]
45- ];
46- $ srcUrl = 'database.php ' ;
47- $ srcUrlParams = $ actionUrlParams ;
48- $ srcUrlParams ['action ' ] = 'tree ' ;
49-
50- $ tree = $ dom ->createElement ('tree ' );
51- $ tree ->setAttribute ('text ' , $ dbs ->fields ['datname ' ]);
52- $ tree ->setAttribute ('action ' , $ actionUrl . '? ' . http_build_query ($ actionUrlParams ));
53- $ tree ->setAttribute ('src ' , $ srcUrl . '? ' . http_build_query ($ srcUrlParams ));
54- $ tree ->setAttribute ('icon ' , Config::getIcon ('Database ' ));
55- $ tree ->setAttribute ('openicon ' , Config::getIcon ('Database ' ));
56- if (isset ($ dbs ->fields ['datcomment ' ]) && is_string ($ dbs ->fields ['datcomment ' ])) {
57- $ tree ->setAttribute ('tooltip ' , $ dbs ->fields ['datcomment ' ]);
58- }
31+ $ dbConnection = $ serverSession ->getDatabaseConnection ();
32+ $ dbs = $ dbConnection ->getDatabases ();
33+ foreach ($ dbs as $ dbData ) {
34+ $ actionUrl = 'redirect.php ' ;
35+ $ actionUrlParams = [
36+ 'subject ' => 'database ' ,
37+ 'server ' => $ serverSession ->id (),
38+ 'database ' => $ dbData ['datname ' ]
39+ ];
40+ $ srcUrl = 'database.php ' ;
41+ $ srcUrlParams = $ actionUrlParams ;
42+ $ srcUrlParams ['action ' ] = 'tree ' ;
5943
60- $ root ->appendChild ($ tree );
61- }
44+ $ tree = $ dom ->createElement ('tree ' );
45+ $ tree ->setAttribute ('text ' , $ dbData ['datname ' ]);
46+ $ tree ->setAttribute ('action ' , $ actionUrl . '? ' . http_build_query ($ actionUrlParams ));
47+ $ tree ->setAttribute ('src ' , $ srcUrl . '? ' . http_build_query ($ srcUrlParams ));
48+ $ tree ->setAttribute ('icon ' , Config::getIcon ('Database ' ));
49+ $ tree ->setAttribute ('openicon ' , Config::getIcon ('Database ' ));
50+ $ tree ->setAttribute ('tooltip ' , $ dbData ['datcomment ' ]);
6251
63- $ dbs ->MoveNext ();
64- }
52+ $ root ->appendChild ($ tree );
6553 }
6654 } else {
6755 $ configuredServers = Config::getServers ();
0 commit comments