diff options
author | Camil Staps | 2016-07-27 16:48:53 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-27 17:08:12 +0200 |
commit | 21455bfd1004c4a3153050ac5995b8dc680c2042 (patch) | |
tree | b448f9d94cd9b6addb6d6b391001c418243cc13d /install/upgrade.php | |
parent | Removed error reporting (diff) |
Class names start with a capital
Diffstat (limited to 'install/upgrade.php')
-rw-r--r-- | install/upgrade.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/install/upgrade.php b/install/upgrade.php index 0643ff5..aea97ce 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -40,7 +40,7 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.1')) { try { - $_pdo->query("ALTER TABLE `".constants::db_prefix."assignment` CHANGE `hours` `hours` FLOAT UNSIGNED NOT NULL"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."assignment` CHANGE `hours` `hours` FLOAT UNSIGNED NOT NULL"); } catch (PDOException $e) { echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}<br/>" . $e->getTraceAsString(); } @@ -48,8 +48,8 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.2.2')) { try { - $_pdo->query("ALTER TABLE `".constants::db_prefix."assignment` DROP FOREIGN KEY `assignment_ibfk_1`"); - $_pdo->query("ALTER TABLE `".constants::db_prefix."assignment` ADD CONSTRAINT `assignment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".constants::db_prefix."offer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."assignment` DROP FOREIGN KEY `assignment_ibfk_1`"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."assignment` ADD CONSTRAINT `assignment_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE"); } catch (PDOException $e) { echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}<br/>" . $e->getTraceAsString(); } @@ -57,7 +57,7 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.3')) { try { - $_pdo->query("CREATE TABLE IF NOT EXISTS `".constants::db_prefix."discount` ( + $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."discount` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `offerId` smallint(5) unsigned NOT NULL, `title` tinytext NOT NULL, @@ -66,8 +66,8 @@ if (isset($_GET['upgrade'])) { `VAT_percentage` float NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"); - $_pdo->query("ALTER TABLE `".constants::db_prefix."discount` - ADD CONSTRAINT `discount_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".constants::db_prefix."offer` (`id`);"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."discount` + ADD CONSTRAINT `discount_ibfk_1` FOREIGN KEY (`offerId`) REFERENCES `".Constants::db_prefix."offer` (`id`);"); } catch (PDOException $e) { echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}<br/>" . $e->getTraceAsString(); } @@ -75,7 +75,7 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.4')) { try { - $_pdo->query("CREATE TABLE IF NOT EXISTS `".constants::db_prefix."user` ( + $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."user` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(24) NOT NULL, `password` varchar(255) NOT NULL, @@ -88,21 +88,21 @@ if (isset($_GET['upgrade'])) { if (lower_version($_GET['upgrade'], '0.4.2')) { try { - $_pdo->query("CREATE TABLE IF NOT EXISTS `".constants::db_prefix."payment` ( + $_pdo->query("CREATE TABLE IF NOT EXISTS `".Constants::db_prefix."payment` ( `id` smallint(5) unsigned NOT NULL, `offerId` smallint(5) unsigned NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1;"); - $offers = $_pdo->query("SELECT `id`,`payment_received` FROM `".constants::db_prefix."offer` WHERE `payment_received` IS NOT NULL"); + $offers = $_pdo->query("SELECT `id`,`payment_received` FROM `".Constants::db_prefix."offer` WHERE `payment_received` IS NOT NULL"); $offers = $offers->fetchAll(PDO::FETCH_ASSOC); foreach ($offers as $offer) { $received = $offer['payment_received']; - $offer = new offer($_pdo, $offer['id']); + $offer = new Offer($_pdo, $offer['id']); $offer->createPayment($received); } - $_pdo->query("ALTER TABLE `".constants::db_prefix."offer` DROP `payment_received`;"); + $_pdo->query("ALTER TABLE `".Constants::db_prefix."offer` DROP `payment_received`;"); } catch (PDOException $e) { echo "Altering the database structure failed with a PDOException ({$e->getCode()}): {$e->getMessage()}<br/>" . $e->getTraceAsString(); } @@ -112,7 +112,7 @@ if (isset($_GET['upgrade'])) { } ?> -<p>You're going to upgrade to version <?=constants::version?>. What was your old version number?</p> +<p>You're going to upgrade to version <?=Constants::version?>. What was your old version number?</p> <form method="GET"> <input type="text" name="upgrade" placeholder="Old version"/> <input type="submit" value="Upgrade"/> |