Intended Drupal Version: 7.x
Audience: Developers
Project Page: http://drupal.org/sandbox/tenken/1931774

git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/tenken/1931774.git dbinfo
cd dbinfo

What DBinfo does from sandbox page (screenshots there):

What this Module does for you:

DBinfo adds a small status report item to the /admin/status/reports page of your Drupal website.

DBinfo tells you the database connection information for any configured databases Drupal has connection info for. Optionally, it can test the connection on status report page load.

Why this module was created

Websites I'm deploying use Drpual as a frontend for various database sources. Additionally my development workflow has various servers such as Staging, Development and Production servers. By default Drupal does not output database information anywhere in the administration area. To assure that servers are configured properly this report shows site administrators what databases the Drupal installation can connect to.

Requirements

This module requires Ctools in order to generate the collapsible report(s) divs. If your not using Ctools already you're probably not doing anything much advanced with Drupal to begin with and likely would not need this module.

As a security precaution the db password always displays as omitted from the report page. All other database information is considered administrative knowledge.

Reviews of Other Projects

http://drupal.org/node/1865018#comment-7143472
http://drupal.org/node/1914740#comment-7143922
http://drupal.org/node/1740956#comment-7144312

Comments

klausi’s picture

Status: Needs review » Needs work

Welcome,

please get a review bonus first. Then try to fix issues raised by automated review tools: http://ventral.org/pareview/httpgitdrupalorgsandboxtenken1931774git

bkonetzny’s picture

Hi tenken,

thanks for this useful module. Here are my suggestions:

  • As this module seems to aim on developers, I would add the dev package to the info file. (package = Development)
  • As the password is always omitted in your report, I would remove it from the UI, as it has no benefit for the viewing user.
  • Please make the configuration keys translateable, so different languages show the translated name. (e.g. "Treiber" (DE) instead of "driver" (EN))
  • There are empty rule declarations in the css (css/dbinfo.css) and a image url which should be written as "/misc/message-16-error.png" instead of "/modules/system/../../misc/message-16-error.png".
tenken’s picture

As this module seems to aim on developers, I would add the dev package to the info file. (package = Development)

ok. good idea thanks.

As the password is always omitted in your report, I would remove it from the UI, as it has no benefit for the viewing user.

The report is showing essentially all the config info passed to $db = new PDO(<config info>);. Showing that you supplied a valid password to PDO is important if the connection doesnt work, you clearly had a key (its in the report as omitted) vs not supplying a key. This will help to correlate any MySQL error message shown in a connection test.

Please make the configuration keys translateable, so different languages show the translated name. (e.g. "Treiber" (DE) instead of "driver" (EN))

I'm sorry what? PHP.ini and Drupals settings.php are essentially in English (please correct me if I'm wrong). By providing translated keys you now cannot grep settings.php for a given key shown on the page (translated). I dont see the benefit to showing misleading information.

There are empty rule declarations in the css (css/dbinfo.css) and a image url which should be written as "/misc/message-16-error.png" instead of "/modules/system/../../misc/message-16-error.png".

Oops your right, I'll clean up the css.

tenken’s picture

Status: Needs work » Needs review

Updated code to amend 2 issues comment #2.

I'm currently not translating db config keys because they array keys are not translatable. You cannot write PHP code for FAPI such as:

// This is spanish and english.
$form['sample_field'] = array(
  'tipo' => 'select',
  'selectiones' => array(0 => t('yes'), 1 => t('no'),),
  'eleccion_por_defecto' => 'yes',
);

Array keys are array keys and not translatable strings. Drupal FAPI would choke on the above, and it's meaningless.

I am leaving the password as omitted. Would people like asterisks instead of omitted if a password is provided?

I have re-tested against Parview:

FILE: /var/www/drupal-7-pareview/pareview_temp/dbinfo/dbinfo.install
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
171 | ERROR | Use XHTML style tags instead of
--------------------------------------------------------------------------------

I have an html 5 compatible <br> tag .... as I feel HTML 5 is the way to go, I have no love for XHTML.

bkonetzny’s picture

Instead of "omitted", would a Yes/No make more sense?

Of course you are right, translating the keys in the array doesn't make sense and was not my intention. I thought about translating the output of your report. So instead of outputting the $key and it's value (driver: mysql), you could pass $key to t(), so "t($key): $value" would become "driver: mysql" and (if translations exist) "Treiber: mysql" in german. But I'm fine with your current implementation, this was just a suggestion for a "more translated" report :)

tenken’s picture

Instead of "omitted", would a Yes/No make more sense?

A fellow module maintainer whom I showed the project to offlist recommended the string text [omitted] as the password so that the password appears similar to a token text description and developers would better understand it was a replaced value not being shown.

I was debating asterisks exactly strelen($password) long as a second option.

Of course you are right, translating the keys in the array doesn't make sense and was not my intention. I thought about translating the output of your report. So instead of outputting the $key and it's value (driver: mysql), you could pass $key to t(), so "t($key): $value" would become "driver: mysql" and (if translations exist) "Treiber: mysql" in german. But I'm fine with your current implementation, this was just a suggestion for a "more translated" report :)

Ah, I see what you're saying I think ... hmm ... for now I'll leave it as-is. The report(s) table headers, and the status row title are translatable. Thanks for the input.

tenken’s picture

Issue summary: View changes

added review of 1 project dx_cache

tenken’s picture

Issue summary: View changes

reviewed github_pages module

tenken’s picture

Issue tags: +PAreview: review bonus

reviewed 3 modules in needs review listing.

Changes

  • refactored non-hook functions to own file.
  • added configuration page
  • changed omitted string for password
klausi’s picture

Assigned: Unassigned » jthorson
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

manual review:

  1. move your files to the root of the repository and remove the extra dbinfo folder.
  2. dbinfo_enable(): why do you need to clear the theme registry here? Please add a comment.
  3. dbinfo.module: do not include files in the global module scope, include them in functions when you actually need them.
  4. "$key . ' (' . $t('the Drupal database') . ')';": do not concatentate translatable strings, use placeholders with t() instead. Also elsewhere.

But otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to jthorson as he might have time to take a final look at this.

tenken’s picture

committed fixes requested by klausi.

jthorson’s picture

Status: Reviewed & tested by the community » Fixed

My only question would be whether you're certain that $vars['handle'] and $vars['content'] is sanitized output, within your dbinfo_ctools_collapsible() function. Other than that, it looks good.

Thanks for your contribution, tenken!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

reviewed csscrush module