[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4522] branches/1.3
- Subject: SF.net SVN: ledger-smb:[4522] branches/1.3
- From: ..hidden..
- Date: Thu, 22 Mar 2012 02:46:56 +0000
Revision: 4522
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4522&view=rev
Author: einhverfr
Date: 2012-03-22 02:46:56 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
Experimental support for SL 2.8 to LSMB migrations via setup.pl
Modified Paths:
--------------
branches/1.3/Changelog
branches/1.3/scripts/setup.pl
Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog 2012-03-22 02:25:16 UTC (rev 4521)
+++ branches/1.3/Changelog 2012-03-22 02:46:56 UTC (rev 4522)
@@ -14,6 +14,7 @@
* Clarified error message when contrib scripts not found (Chris T)
* Corrected warnings for missin glog initalization (Andres B)
* XAL and ODS buttons are now disabled if prereqs are missing (Erik H)
+* Experimental support for migrating from SQL-Ledger via Setup.pl (Chris T)
Andres B is Andres Basile
Modified: branches/1.3/scripts/setup.pl
===================================================================
--- branches/1.3/scripts/setup.pl 2012-03-22 02:25:16 UTC (rev 4521)
+++ branches/1.3/scripts/setup.pl 2012-03-22 02:46:56 UTC (rev 4522)
@@ -280,6 +280,66 @@
company_name => $request->{database},
password => $creds->{password}}
);
+
+ # ENVIRONMENT NECESSARY
+ $ENV{PGUSER} = $creds->{login};
+ $ENV{PGPASSWORD} = $creds->{password};
+ $ENV{PGDATABASE} = $request->{database};
+
+ # Credentials set above via environment variables --CT
+ $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+ my $dbh = $request->{dbh};
+ $dbh->do('ALTER SCHEMA public RENAME TO lsmb12');
+ $dbh->do('CREATE SCHEMA PUBLIC');
+ # Copying contrib script loading for now
+ my $rc = 0;
+ my $temp = $LedgerSMB::Sysconfig::tempdir;
+ my @contrib_scripts = qw(tsearch2 tablefunc);
+
+ for my $contrib (@contrib_scripts){
+ my $rc2;
+ $rc2=system("psql -f $ENV{PG_CONTRIB_DIR}/$contrib.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
+ $rc ||= $rc2
+ }
+ my $rc2 = system("psql -f sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
+
+ $rc ||= $rc2;
+
+ $database->load_modules('LOADORDER');
+ $database->process_roles('Roles.sql');
+ my $dbtemplate = LedgerSMB::Template->new(
+ user => {},
+ path => 'sql/upgrade',
+ template => 'sl2.8-1.3',
+ no_auto_output => 1,
+ format_options => {extension => 'sql'},
+ output_file => 'sl2.8-1.3-upgrade',
+ format => 'TXT' );
+ $dbtemplate->render($request);
+ $rc2 = system("psql -f $temp/sl2.8-1.3-upgrade.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
+ $rc ||= $rc2;
+
+ $request->{dbh} = DBI->connect("dbi:Pg:dbname=$request->{database}");
+
+ @{$request->{salutations}}
+ = $request->call_procedure(procname => 'person__list_salutations' );
+
+ @{$request->{countries}}
+ = $request->call_procedure(procname => 'location_list_country' );
+
+ my $locale = $request->{_locale};
+
+ @{$request->{perm_sets}} = (
+ {id => '0', label => $locale->text('Manage Users')},
+ {id => '1', label => $locale->text('Full Permissions')},
+ );
+ my $template = LedgerSMB::Template->new(
+ path => 'UI/setup',
+ template => 'new_user',
+ format => 'HTML',
+ );
+ $template->render($request);
+
}
=item upgrade
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.