$cfg['Servers'][$i]['hide_db'] = '^(information_schema|performance_schema|mysql)$';
Does work in 3.5.6 but doesn't seem to do anything in 4.0.0(_beta1). I also tried something simpler without regex but it also doesn't work, the databases are still displayed in the navigation sidebar.
However, hide_db works in the Databases tab.
I had a quick glance at it, and it seems that these functions need to be fixed:
https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/navigation/Nodes/Node.class.php#L360
and
https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/navigation/Nodes/Node.class.php#L397
Not sure what's the best way yet...
Also, the only_db directive is not respected in the navigation panel.
Rouslan, any particular reason why PMA_DBI_get_databases_full() was not used in the navigation?
I'm not sure how using PMA_DBI_get_databases_full would help with this bug. I had a look at that function, it doesn't do any filtering on hide_db or only_db. And it's slow...
The Node should use PMA_List_Database class for listing databases or integrate it's functionality - it was only used in navigation and current is not used at all.
Talking about being slow, we had to add the DisableIS directive which disables the use of information_schema, and it's true by default. The reason is explained in Documentation.html for this directive.
So, PMA_DBI_get_databases_full(), by default, executes the "else" part starting with
foreach ($GLOBALS['pma']->databases as $database_name) {
and this references the object created with libraries/PMA.php, which does the filtering later in the code (see checkHideDatabase() in libraries/List_Database.class.php).
Michal, PMA_List_Database is used, that's why in the Databases tab, the hide_db and only_db directives work.
@nijel: It's used in the PMA class
@lem9: I know about the DisableIS directive, the Node class uses that, too.
So, what you're saying is that if DisableIS is set to false, the code will run the if clause instead of the else clause, thus ignoring the hide_db and only_db directives? That sounds like another bug to me...
Ah okay, I did miss that PMA class overrides __get method.
Also it should do filtering in both cases - in if(!DisableIS) there is array_diff against filtered database list, the else part uses that directly. I can say I understand fully the logic, but it seems to do the filtering in both cases.
Rouslan,
if DisableIS is set to false, the "if" clause will run but the hide_db and only_db directives are obeyed, I just tested the case.
The hide_db issue is fixed with https://github.com/phpmyadmin/phpmyadmin/pull/205
The only_db issue is fixed with https://github.com/phpmyadmin/phpmyadmin/pull/207
This appears to be broken again in 4.2.5. Regex works correctly in Databases tab, but not in left panel. Have not tested any other versions at this time.
EDIT: using hide_db, haven't tested only_db yet either.
Last edit: rjk 2014-06-30
This should be fixed when PR #1375[1] is merged. I've tested both only_db and hide_db directives when DisableIS = true as well as when DisableIS = false.
[1] https://github.com/phpmyadmin/phpmyadmin/pull/1375