From: Moritz Bunkus Date: Fri, 17 Feb 2006 08:50:07 +0000 (+0000) Subject: Automatische Datenbankupgrades. Einfach upgrade Datei ins sql/ Verzeichnis legen... X-Git-Tag: release-2.4.0^2~331 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0d6920540b289a59b021a6be86445279b39a26ef;p=kivitendo-erp.git Automatische Datenbankupgrades. Einfach upgrade Datei ins sql/ Verzeichnis legen, einloggen, fertig. SL/Form.pm::dbversion ist nicht mehr noetig. [r806:808 aus LINET prog-Repo] --- diff --git a/SL/Form.pm b/SL/Form.pm index 90f412018..3c0e2e6bb 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -143,7 +143,6 @@ sub new { $self->{action} =~ s/( |-|,|#)/_/g; $self->{version} = "2.2.0"; - $self->{dbversion} = "2.2.0"; $main::lxdebug->leave_sub(); diff --git a/SL/User.pm b/SL/User.pm index f989e86f5..fbc022357 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -162,7 +162,7 @@ sub login { $rc = 0; - if ($form->{dbversion} ne $dbversion) { + if (&update_available($dbversion)) { # update the tables open FH, ">$userspath/nologin" or die " @@ -652,6 +652,16 @@ sub cmp_script_version { } ## /LINET +sub update_available { + ($cur_version) = @_; + opendir SQLDIR, "sql/." or &error("", "$!"); + my @upgradescripts = + grep(/$form->{dbdriver}-upgrade-$cur_version.*\.sql/, readdir(SQLDIR)); + closedir SQLDIR; + + return ($#upgradescripts > -1); +} + sub dbupdate { $main::lxdebug->enter_sub();