[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5304] trunk



Revision: 5304
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5304&view=rev
Author:   einhverfr
Date:     2012-12-06 09:16:23 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
Merging from branches/1.3

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/Database.pm
    trunk/LedgerSMB/Scripts/setup.pm
    trunk/UI/setup/complete.html
    trunk/UI/setup/confirm_operation.html

Property Changed:
----------------
    trunk/
    trunk/LedgerSMB/Scripts/setup.pm


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3:3711-5299
   + /branches/1.3:3711-5303

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-12-06 09:09:16 UTC (rev 5303)
+++ trunk/Changelog	2012-12-06 09:16:23 UTC (rev 5304)
@@ -79,6 +79,9 @@
 Initial Release:  Monday, Oct 12 2011
 Supported Presently
 
+Changelog for 1.3.26
+* Added db statistics post-upgrade and pre/post rebuild (Chris T, 3586113)
+
 Changelog for 1.3.25
 * Fixed internal server errors on LedgerSMB->error() during new() (Chris T)
 * Fixed pricematrix rows not showing where pricegroups are used (Chris T)

Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm	2012-12-06 09:09:16 UTC (rev 5303)
+++ trunk/LedgerSMB/Database.pm	2012-12-06 09:16:23 UTC (rev 5304)
@@ -545,12 +545,65 @@
                         log    => "$temp/dblog"});
 }
 
-=item $db->log_from_logfile();
+=item $db->lsmb_info()
 
-Process log file and log relevant pieces via the log classes.
+This routine retrieves general stats about the database and returns the output
+as a hashref with the following key/value pairs:
 
+=over
+
+=item ar_rows 
+
+=item ap_rows
+
+=item gl_rows
+
+=item acc_trans_rows
+
+=item eca_rows
+
+=item oe_rows
+
+=item transactions_rows
+
+=item users_rows
+
+=back
+
 =cut
 
+sub lsmb_info {
+    my ($self) = @_;
+    my @tables = qw(ar ap gl acc_trans entity_credit_account oe transactions 
+                    users);
+    my $retval = {};
+    my $qtemp = 'SELECT count(*) FROM TABLE';
+    my $dbh = 
+    my $dbh = DBI->connect(
+        "dbi:Pg:dbname=$self->{company_name}",  
+         $self->{username}, $self->{password},
+         { AutoCommit => 0, PrintError => $logger->is_warn(), }
+    );
+    for my $t (@tables) {
+        my $query = $qtemp;
+        $query =~ s/TABLE/$t/;
+        my ($count) = $dbh->selectrow_array($query);
+        my $key = $t;
+        $key = 'eca' if $t eq 'entity_credit_account';
+        $retval->{"${key}_count"} = $count;
+    }
+    return $retval;
+}
+    
+
+=item $db->db_tests()
+
+This routine runs general db tests.
+
+TODO
+
+=cut
+
 #TODO
 #
 1;

Modified: trunk/LedgerSMB/Scripts/setup.pm
===================================================================
--- trunk/LedgerSMB/Scripts/setup.pm	2012-12-06 09:09:16 UTC (rev 5303)
+++ trunk/LedgerSMB/Scripts/setup.pm	2012-12-06 09:16:23 UTC (rev 5304)
@@ -121,6 +121,7 @@
                     'Upgrade?'
              );
              $request->{next_action} = 'upgrade';
+             $request->{lsmb_info} = $database->lsmb_info();
          } else {
             $request->{message} = $request->{_locale}->text(
                  'Unknown version found.'
@@ -876,6 +877,7 @@
     
     $database->load_modules('LOADORDER');
     $database->process_roles('Roles.sql');
+    $request->{lsmb_info} = $database->lsmb_info();
     # Credentials set above via environment variables --CT
     #avoid msg commit ineffective with AutoCommit enabled
     $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}",$creds->{login},$creds->{password},{AutoCommit=>0});


Property changes on: trunk/LedgerSMB/Scripts/setup.pm
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4945
/branches/1.3/scripts/setup.pl:3711-5182,5189-5206
   + /branches/1.3/LedgerSMB/Scripts/setup.pm:3712-4945
/branches/1.3/scripts/setup.pl:3711-5303

Modified: trunk/UI/setup/complete.html
===================================================================
--- trunk/UI/setup/complete.html	2012-12-06 09:09:16 UTC (rev 5303)
+++ trunk/UI/setup/complete.html	2012-12-06 09:16:23 UTC (rev 5304)
@@ -12,5 +12,23 @@
 <p><?lsmb text('This database operation has completed successfully.  LedgerSMB may now be used.'); ?></p>
 <p><a href="setup.pl"><?lsmb text('Return to setup') ?></a></p>
 <p><a href="login.pl"><?lsmb text('Start Using LedgerSMB') ?></a></p>
+<?lsmb IF lsmb_info ?>
+<table class='lsmb_info'>
+  <thead>
+  <tr><th colspan="2"><?lsmb text('LedgerSMB Database Statistics') ?></th></tr>
+  <tr><th colspan="2"><?lsmb text('Row counts') ?></th></tr>
+  </thead>
+  <tbody>
+  <tr><th><?lsmb text('AP') ?></th><td><?lsmb lsmb_info.ap_count ?></td></tr>
+  <tr><th><?lsmb text('AR') ?></th><td><?lsmb lsmb_info.ar_count ?></td></tr>
+  <tr><th><?lsmb text('GL') ?></th><td><?lsmb lsmb_info.gl_count ?></td></tr>
+  <tr><th><?lsmb text('Journal Lines') ?></th><td><?lsmb lsmb_info.acc_trans_count ?></td></tr>
+  <tr><th><?lsmb text('Orders') ?></th><td><?lsmb lsmb_info.oe_count ?></td></tr>
+  <tr><th><?lsmb text('Customer/Vendor Accounts') ?></th><td><?lsmb lsmb_info.eca_count ?></td></tr>
+  <tr><th><?lsmb text('Transactions') ?></th><td><?lsmb lsmb_info.transactions_count ?></td></tr>
+  <tr><th><?lsmb text('Users') ?></th><td><?lsmb lsmb_info.users_count ?></td></tr>
+  </tbody>
+</table>
+<?lsmb END ?>
 </body>
 </html>

Modified: trunk/UI/setup/confirm_operation.html
===================================================================
--- trunk/UI/setup/confirm_operation.html	2012-12-06 09:09:16 UTC (rev 5303)
+++ trunk/UI/setup/confirm_operation.html	2012-12-06 09:16:23 UTC (rev 5304)
@@ -57,5 +57,23 @@
 </div>
 <?lsmb END ?>
 </form>
+<?lsmb IF lsmb_info ?>
+<table class='lsmb_info'>
+  <thead>
+  <tr><th colspan="2"><?lsmb text('LedgerSMB Database Statistics') ?></th></tr>
+  <tr><th colspan="2"><?lsmb text('Row counts') ?></th></tr>
+  </thead>
+  <tbody>
+  <tr><th><?lsmb text('AP') ?></th><td><?lsmb lsmb_info.ap_count ?></td></tr>
+  <tr><th><?lsmb text('AR') ?></th><td><?lsmb lsmb_info.ar_count ?></td></tr>
+  <tr><th><?lsmb text('GL') ?></th><td><?lsmb lsmb_info.gl_count ?></td></tr>
+  <tr><th><?lsmb text('Journal Lines') ?></th><td><?lsmb lsmb_info.acc_trans_count ?></td></tr>
+  <tr><th><?lsmb text('Orders') ?></th><td><?lsmb lsmb_info.oe_count ?></td></tr>
+  <tr><th><?lsmb text('Customer/Vendor Accounts') ?></th><td><?lsmb lsmb_info.eca_count ?></td></tr>
+  <tr><th><?lsmb text('Transactions') ?></th><td><?lsmb lsmb_info.transactions_count ?></td></tr>
+  <tr><th><?lsmb text('Users') ?></th><td><?lsmb lsmb_info.users_count ?></td></tr>
+  </tbody>
+</table>
+<?lsmb END ?>
 </body>
 </html>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.