[Jifty-commit] r7245 - jifty/trunk/lib/Jifty/Plugin/SetupWizard

Jifty commits jifty-commit at lists.jifty.org
Thu Jun 11 17:06:32 EDT 2009


Author: sartak
Date: Thu Jun 11 17:06:32 2009
New Revision: 7245

Modified:
   jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm

Log:
Only notify you about installing the drivers you're missing

Modified: jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/SetupWizard/View.pm	Thu Jun 11 17:06:32 2009
@@ -143,12 +143,21 @@
     $onchange =~ s/PLACEHOLDER/'+this.value+'/;
 
     # Only show them drivers they have available
-    my @available_drivers =
-        grep { Jifty->handle->is_available_driver($_->{value}) } (
-            { display => 'SQLite',     value => 'SQLite' },
-            { display => 'MySQL',      value => 'mysql' },
-            { display => 'PostgreSQL', value => 'Pg' },
-        );
+    my (@available_drivers, @unavailable_drivers);
+    my @all_drivers = (
+        { display => 'SQLite',     value => 'SQLite' },
+        { display => 'MySQL',      value => 'mysql' },
+        { display => 'PostgreSQL', value => 'Pg' },
+    );
+    for (@all_drivers) {
+        if (Jifty->handle->is_available_driver($_->{value})) {
+            push @available_drivers, $_;
+        }
+        else {
+            push @unavailable_drivers, $_;
+        }
+    }
+
     my $current_driver = Jifty->config->framework('Database')->{Driver};
     my $appname = Jifty->config->framework('ApplicationName');
 
@@ -160,7 +169,14 @@
 
     p { _("MySQL and PostgreSQL are well-supported production-quality database engines. ") };
 
-    p { _("If your preferred database is not listed in the dropdown below, that means we could not find a database driver for it. You may be able to remedy this by using CPAN to download and install DBD::MySQL, DBD::Pg, or DBD::Oracle.") };
+    if (@unavailable_drivers) {
+        my @drivers = map { "DBD::$_->{value}" } @unavailable_drivers;
+        my $drivers = join ', ', @drivers;
+
+        $drivers =~ s/, (?!.*,)/ or /;
+
+        p { _("If your preferred database is not listed in the dropdown below, that means we could not find a database driver for it. You may be able to remedy this by using CPAN to download and install $drivers.") };
+    }
 
     config_field(
         field      => 'Driver',


More information about the Jifty-commit mailing list