Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/config/global.inc.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
**/
$config['version'] = '0.0.8';
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/public/include/version.inc.php';
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';

/**
* Unless you disable this, we'll do a quick check on your config first.
Expand Down
2 changes: 1 addition & 1 deletion include/version.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;

define('MPOS_VERSION', '0.0.4');
define('DB_VERSION', '0.0.10');
define('DB_VERSION', '0.0.11');
define('CONFIG_VERSION', '0.0.8');
define('HASH_VERSION', 1);

Expand Down
4 changes: 2 additions & 2 deletions sql/000_base_structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS `shares` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `shares_archive` (
`id` int(255) unsigned NOT NULL AUTO_INCREMENT,
`share_id` int(255) unsigned NOT NULL,
`id` bigint(30) NOT NULL AUTO_INCREMENT,
`share_id` bigint(30) NOT NULL,
`username` varchar(120) NOT NULL,
`our_result` enum('Y','N') DEFAULT NULL,
`upstream_result` enum('Y','N') DEFAULT NULL,
Expand Down
31 changes: 31 additions & 0 deletions upgrade/definitions/0.0.10_to_0.0.11.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
function run_0011() {
// Ugly but haven't found a better way
global $setting, $config, $user, $mysqli;

// Version information
$db_version_old = '0.0.10'; // What version do we expect
$db_version_new = '0.0.11'; // What is the new version we wish to upgrade to
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed

// Upgrade specific variables
$aSql[] = "ALTER TABLE `shares_archive` MODIFY `id` bigint(30)";
$aSql[] = "ALTER TABLE `shares_archive` MODIFY `share_id` bigint(30)";
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '0.0.11' WHERE name = 'DB_VERSION'";

if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
// Run the upgrade
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
foreach ($aSql as $sql) {
echo '- Preparing: ' . $sql . PHP_EOL;
$stmt = $mysqli->prepare($sql);
if ($stmt && $stmt->execute()) {
echo '- success' . PHP_EOL;
} else {
echo '- failed: ' . $mysqli->error . PHP_EOL;
exit(1);
}
}
}
}
?>