use HTML::Entities ;
use vars qw/$dbh @reqlist $query/ ;
-use vars qw/$sys_default_domain $sys_cvs_host $sys_download_host
+use vars qw/$sys_default_domain $sys_cvs_host
$sys_shell_host $sys_users_host $sys_docs_host $sys_lists_host
$sys_dns1_host $sys_dns2_host $FTPINCOMING_DIR $FTPFILES_DIR
$sys_urlroot $sf_cache_dir $sys_name $sys_themeroot
$sys_news_group $sys_dbhost $sys_dbname $sys_dbuser $sys_dbpasswd
$sys_ldap_base_dn $sys_ldap_host $admin_login $admin_password
- $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
+ $domain_name
$skill_list/ ;
use vars qw/$pluginname/ ;
$dbh->commit () ;
}
+ &update_with_sql("/usr/share/gforge/plugins/$pluginname/lib/20121019-multiple-repos.sql","0.2");
+
debug "It seems your database install/upgrade went well and smoothly. That's cool." ;
debug "Please enjoy using Debian GForge." ;
$sth->finish () ;
} until $array[0] >= $targetvalue ;
}
+
+sub update_with_sql ( $$ ) {
+ my $sqlfile = shift or die "Not enough arguments" ;
+ my $target = shift or die "Not enough arguments" ;
+ $sqlfile =~ s/\.sql$//;
+ my $version = &get_db_version ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Upgrading database with $sqlfile.sql") ;
+
+ @reqlist = @{ &parse_sql_file ("$sqlfile.sql") } ;
+ foreach my $s (@reqlist) {
+ my $query = $s ;
+ # debug $query ;
+ my $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ $sth->finish () ;
+ }
+ @reqlist = () ;
+
+ &update_db_version ($target) ;
+ &debug ("...OK.") ;
+ $dbh->commit () ;
+ }
+}