You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.4 KiB
75 lines
2.4 KiB
<?php
|
|
error_reporting( E_ALL );
|
|
require_once('settings.php');
|
|
require_once('defines.php');
|
|
$UPGRADE = false;
|
|
$TT_123 = explode( '.', PHP_VERSION );
|
|
if( $TT_123[0] == '4' ){
|
|
require_once( 'php/db/MySQL_class.php' );
|
|
$DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
|
|
} elseif( $TT_123[0] > '4' ){
|
|
require_once( 'php/db/MySQLi_class.php' );
|
|
$DATABASE = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword);
|
|
} else {
|
|
echo "CANNOT DETERMINE DATABASE ENGINE!!!!!!!\n\n";
|
|
exit();
|
|
};
|
|
|
|
$QS="SHOW INDEX FROM `modbus_modules` WHERE Column_name='platform_id'";
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) ){
|
|
$QS = "ALTER TABLE `modbus_modules` DROP INDEX `{$R[0]['Key_name']}`";
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$QS = "SHOW COLUMNS FROM `modbus_modules` LIKE 'label'";
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) == 0 ){
|
|
$QS = "ALTER TABLE `modbus_modules` ADD `label` CHAR(32) DEFAULT ''";
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$QS = "SHOW COLUMNS FROM `metro_stations` LIKE 'short'";
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) == 0 ){
|
|
$QS = "ALTER TABLE `metro_stations` ADD `short` CHAR(32) DEFAULT ''";
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$QS = "SHOW TABLES LIKE 'session_composer_queue'"
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) ){
|
|
$QS = "ALTER TABLE `session_composer_queue` RENAME TO `media_composer_queue`";
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$QS = "SHOW TABLES LIKE 'media_composer_queue1'"
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) == 0 ){
|
|
$QS =<<<DATA_BOUNDARY
|
|
CREATE TABLE `argus`.`media_composer_queue` (
|
|
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`ts` int UNSIGNED NOT NULL,
|
|
`session_id` int UNSIGNED NOT NULL,
|
|
`uuid` char(64) NOT NULL,
|
|
`status` char(1) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT 'N',
|
|
`progress` tinyint(3) UNSIGNED NULL DEFAULT 0,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE = MyISAM;
|
|
DATA_BOUNDARY;
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
$QS = "SHOW TABLES LIKE 'media_encoder_queue'"
|
|
$R = $DATABASE->Query( $QS );
|
|
if( count( $R ) == 0 ){
|
|
$QS = "ALTER TABLE `media_queue` RENAME TO `media_encoder_queue`";
|
|
$UPGRADE = true;
|
|
$DATABASE->Query( $QS );
|
|
};
|
|
if( $UPGRADE ){
|
|
echo "Upgrade Done!\n\n";
|
|
} else {
|
|
echo "No Upgrade Needed!\n\n";
|
|
};
|
|
?>
|