From 3e2f6481750aa3fef100bc0e2113c7113bf537c2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 29 Apr 2011 23:13:50 -0700 Subject: [PATCH] Use define() instead of PHP 5.3-only global 'const' in upgrade_schema.php Summary: This global 'const' syntax was introduced in PHP 5.3: http://www.php.net/manual/en/language.constants.syntax.php We're PHP 5.2.x elsewhere so just use define(). Made the constant a little more specific too. Test Plan: Ran upgrade_schema.php script. Reviewed By: Girish Reviewers: tuomaspelkonen, Girish, davidrecordon CC: jungejason, aran, epriestley, Girish Differential Revision: 190 --- scripts/sql/upgrade_schema.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/sql/upgrade_schema.php b/scripts/sql/upgrade_schema.php index 26417647c2..2b2d590639 100755 --- a/scripts/sql/upgrade_schema.php +++ b/scripts/sql/upgrade_schema.php @@ -23,7 +23,7 @@ require_once $root.'/scripts/__init_env__.php'; phutil_require_module('phutil', 'console'); -const TABLE_NAME = 'schema_version'; +define('SCHEMA_VERSION_TABLE_NAME', 'schema_version'); if (isset($argv[1]) && !is_numeric($argv[1])) { print @@ -82,7 +82,7 @@ if ($next_version === null) { $version = queryfx_one( $conn, 'SELECT * FROM %T', - TABLE_NAME); + SCHEMA_VERSION_TABLE_NAME); if (!$version) { print "*** No version information in the database ***\n"; @@ -142,12 +142,16 @@ foreach ($patches as $patch) { // Patch was successful, update the db with the latest applied patch version // 'DELETE' and 'INSERT' instead of update, because the table might be empty - queryfx($conn, 'DELETE FROM %T', TABLE_NAME); - queryfx($conn, 'INSERT INTO %T values (%d)', TABLE_NAME, $patch['version']); + queryfx($conn, 'DELETE FROM %T', SCHEMA_VERSION_TABLE_NAME); + queryfx( + $conn, + 'INSERT INTO %T values (%d)', + SCHEMA_VERSION_TABLE_NAME, + $patch['version']); $patch_applied = true; } if (!$patch_applied) { - print "Your database is already up-to-date\n"; + print "Your database is already up-to-date.\n"; }