diff options
author | Marc Delisle <marc@infomarc.info> | 2005-07-29 21:36:39 +0400 |
---|---|---|
committer | Marc Delisle <marc@infomarc.info> | 2005-07-29 21:36:39 +0400 |
commit | 09891f898dae014b14ef276bf6abb1ec6eabc7c2 (patch) | |
tree | b70586ffb76b478b3d7bbf7cb57492829d06e752 /scripts | |
parent | 985d073dbb6c5e3e9fb33689e097a4caaaed69a2 (diff) |
patch #1198492, current version check
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/upgrade.pl | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/scripts/upgrade.pl b/scripts/upgrade.pl index 063addeb60..06af2a8e68 100755 --- a/scripts/upgrade.pl +++ b/scripts/upgrade.pl @@ -8,8 +8,6 @@ # 2005-05-08, swix@users.sourceforge.net: # - created script # -# TODO: check if current version is not already uptodate -# (let's assume the sysadmin still has a brain... :-) # @@ -23,10 +21,10 @@ my $source_url = "http://www.phpmyadmin.net/latest.txt"; if (!$ARGV[0]) { print "\n"; - print "usage: upgrade.pl target_directory\n\n"; - print " target_directory will be backuped and replaced\n"; - print " by the current version of phpMyAdmin, by keeping your\n"; - print " config.inc.php file.\n\n"; + print "usage: $0 <target_directory>\n\n"; + print " The location specified by <target_directory> will be backed up and replaced\n"; + print " by the latest stable version of phpMyAdmin.\n"; + print " Your config.inc.php file will be preserved.\n\n"; exit(0); } @@ -88,6 +86,33 @@ if (-d $directory) { exit(0); } +# +# check the installed version +# + +if (open(DEFINES, $targetdirectory .'/libraries/defines.lib.php')) { + my $versionStatus = 0; + while(my $line = <DEFINES>) { + + next unless $line =~ /'PMA_VERSION',\ '(.*)?'\);$/; + + if ($1 gt $version) { + print "Local version newer than latest stable release, not updating.\n"; + exit(0); + + } elsif ($1 eq $version) { + print "Local version already up to date, not updating\n"; + exit(0); + + } else { + $versionStatus = 1; + } + } + if (!$versionStatus) { + print "Old version could not be identified, not updating\n"; + exit(0); + } +} # # get file @@ -110,7 +135,7 @@ if (!-f $filename) { } -if (!-filename) { +if (!-f $filename) { print "error: $filename download failed\n"; exit(0); } @@ -140,6 +165,7 @@ system("mv $targetdirectory $backupdir"); system("mv $directory $targetdirectory"); -print "\ndone! phpMyAdmin $version installed in $directory\n"; -print "backup of your old installation in $backupdir\n\n"; +print "\ndone! phpMyAdmin $version installed in $targetdirectory\n"; +print "backup of your old installation in $backupdir\n"; +print "downloaded archive saved as $filename\n\n"; print "Enjoy! :-)\n\n"; |