From 02e70da914c198719b737cfea91d5e7979ce3e63 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 24 Oct 2012 17:55:26 -0400 Subject: [PATCH] - Fix the db schema check functionality so that it will work with make_project and upgrade correctly. We no longer rely on svnversion for this sort of thing. --- checkin_notes | 13 +++++++++++ html/ops/db_schemaversion.php | 41 +++++++++++++++++++++++++++++++++++ tools/make_project | 12 ++-------- tools/upgrade | 6 ----- 4 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 html/ops/db_schemaversion.php diff --git a/checkin_notes b/checkin_notes index d587d91f11..e2dd03da98 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6349,3 +6349,16 @@ David 24 Oct 2012 client/ app.cpp,h cpp_control.cpp + +Rom 24 Oct 2012 + - Fix the db schema check functionality so that it will work with make_project + and upgrade correctly. We no longer rely on svnversion for this sort of + thing. + + db\ + init_db + html\ops\ + db_schemaversion.php + tools\ + make_project + upgrade diff --git a/html/ops/db_schemaversion.php b/html/ops/db_schemaversion.php new file mode 100644 index 0000000000..3554c9bb1a --- /dev/null +++ b/html/ops/db_schemaversion.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +. + +// Perform DB updates. +// Used by "upgrade". +// Can also be run manually in project/html/ops. + +require_once("../inc/util_ops.inc"); + +$db_revision = 0; +if (file_exists("../../db_revision")) { + $db_revision = (int) file_get_contents("../../db_revision"); +} +require_once("db_update.php"); + +$updates = array(); +foreach($db_updates as $db_update) { + if ($db_update[0] > $db_revision) { + $db_revision = $db_update[0]; + } +} + +echo "\n$db_version\n"; + +?> diff --git a/tools/make_project b/tools/make_project index 0ade4c7f33..034f42c846 100755 --- a/tools/make_project +++ b/tools/make_project @@ -287,18 +287,10 @@ t.disabled = 1 project.config.write() -svn_version_file = proot+'/local.revision' try: - cmd = '/bin/sh -c \'/usr/bin/svnversion ' + options.srcdir + '\' > '+svn_version_file - os.system(cmd) + os.system('cd '+proot+'/html/ops; ./db_schemaversion.php > '+proot+'/db_revision') except: - print '''Couldn't find svnversion''' - -try: - cmd = '/bin/sh -c \'/usr/bin/svnversion ' + options.srcdir + '\' > '+proot+'/db_revision' - os.system(cmd) -except: - print '''Couldn't find svnversion''' + print '''Couldn't set db schema version number''' try: os.system('cd '+proot+'/html/ops; ./update_translations.php -d 1') diff --git a/tools/upgrade b/tools/upgrade index 467370ae54..092f9ccc62 100755 --- a/tools/upgrade +++ b/tools/upgrade @@ -78,12 +78,6 @@ install_boinc_files(INSTALL_DIR, not options.server_only, not options.web_only) print "Upgrading files... done" print "Finding SVN revision" -svn_version_file = INSTALL_DIR+'/local.revision' -try: - os.system('/bin/sh -c /usr/bin/svnversion > '+svn_version_file) -except: - print '''Couldn't find svnversion''' - print "Updating translations" try: os.system('cd '+INSTALL_DIR+'/html/ops; ./update_translations.php -d 1')