Permalink
Browse files

Updating version number

  • Loading branch information...
Mark Troyer
Mark Troyer committed Jul 30, 2014
1 parent 679ec07 commit 3fd427586a3f70a3b3c3bf0db597d99799e4aaaf
Showing with 17 additions and 2 deletions.
  1. +3 −1 app/index.php
  2. +12 −1 app/sw.php
  3. +2 −0 conf/statuswolf.sql
View
@@ -11,6 +11,8 @@
*
*/
$VERSION = '0.9.2';
// For this version, if the new config file format is in place
// we'll assume the upgrade is complete.
if (file_exists(__DIR__ . '/../conf/sw_config.json')) {
@@ -150,7 +152,7 @@
try {
file_put_contents(__DIR__ . '/../conf/sw_datasource.json', "{\n \"datasource\": {\n" . implode($datasources, ",\n") . "\n }\n}\n");
$sw['db']->executeQuery("CREATE TABLE sw_version ( version varchar(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8");
$sw['db']->insert('sw_version', array('version' => '0.9'));
$sw['db']->insert('sw_version', array('version' => $VERSION));
} catch(\Exception $e) {
return $sw->json($e->getMessage(), 500);
}
View
@@ -75,9 +75,20 @@
'db.options' => $sw['sw_config.config']['db_options'],
));
$sw['logger']->addDebug('Checking DB version against ' . $VERSION);
$ver_query = $sw['db']->executeQuery("SELECT * FROM sw_version");
$ver = $ver_query->fetch();
$sw['version'] = $ver['version'];
if ($ver['version'] !== $VERSION) {
$sw['db']->executeUpdate("UPDATE sw_version SET version = '?' WHERE version = '?'",
array(
$VERSION,
$ver['version']
)
);
$sw['version'] = $VERSION;
} else {
$sw['version'] = $ver['version'];
}
// Controller service provider
$sw->register(new \Silex\Provider\ServiceControllerServiceProvider());
View
@@ -110,6 +110,8 @@ CREATE TABLE `sw_version` (
`version` varchar(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO sw_version (version) VALUES ('0.9.2');
# Dump of table users

0 comments on commit 3fd4275

Please sign in to comment.