mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
fixes
This commit is contained in:
@@ -36,6 +36,7 @@ if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
|
||||
case 'setDeviceData': setDeviceData(); break;
|
||||
case 'deleteDevice': deleteDevice(); break;
|
||||
case 'deleteAllWithEmptyMACs': deleteAllWithEmptyMACs(); break;
|
||||
case 'upgradeDatabase': upgradeDB(); break;
|
||||
case 'createBackupDB': createBackupDB(); break;
|
||||
case 'restoreBackupDB': restoreBackupDB(); break;
|
||||
case 'deleteAllDevices': deleteAllDevices(); break;
|
||||
@@ -211,6 +212,36 @@ function deleteAllWithEmptyMACs() {
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Upgrade the database to enable new functionality
|
||||
//------------------------------------------------------------------------------
|
||||
function upgradeDB() {
|
||||
global $db;
|
||||
global $pia_lang;
|
||||
|
||||
// sql
|
||||
$sql = '
|
||||
-- Online_History definition
|
||||
|
||||
CREATE TABLE "Online_History" (
|
||||
"Index" INTEGER,
|
||||
"Scan_Date" TEXT,
|
||||
"Online_Devices" INTEGER,
|
||||
"Down_Devices" INTEGER,
|
||||
"All_Devices" INTEGER,
|
||||
PRIMARY KEY("Index" AUTOINCREMENT)
|
||||
);';
|
||||
// execute sql
|
||||
$result = $db->query($sql);
|
||||
|
||||
// check result
|
||||
if ($result == TRUE) {
|
||||
echo $pia_lang['BackDevices_DBTools_Upgrade'];
|
||||
} else {
|
||||
echo $pia_lang['BackDevices_DBTools_UpgradeError']."\n\n$sql \n\n". $db->lastErrorMsg();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Delete all devices with empty MAC addresses
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -226,11 +226,6 @@ function show_pia_servertime() {
|
||||
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('maintenance.php') ) ){ echo 'active'; } ?>">
|
||||
<a href="maintenance.php"><i class="fa fa-cog"></i> <span><?php echo $pia_lang['Navigation_Maintenance'];?></span></a>
|
||||
</li>
|
||||
|
||||
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('maintenance.php') ) ){ echo 'active'; } ?>">
|
||||
<a href="maintenance.php"><i class="fa fa-cog"></i> <span>Maintenance</span></a>
|
||||
</li>
|
||||
|
||||
<!--
|
||||
<li class="treeview">
|
||||
<a href="#"><i class="fa fa-link"></i> <span>Config</span>
|
||||
|
||||
@@ -186,6 +186,8 @@ $pia_lang['Maintenance_Tool_del_empty_macs'] = 'Delete Devices with empty MACs';
|
||||
$pia_lang['Maintenance_Tool_del_empty_macs_text'] = 'Before using this function, please make a backup. The deletion cannot be undone. All devices without MAC will be deleted from the database.';
|
||||
$pia_lang['Maintenance_Tool_del_empty_macs_noti'] = 'Delete Devices';
|
||||
$pia_lang['Maintenance_Tool_del_empty_macs_noti_text'] = 'Are you sure you want to delete all devices with empty MAC addresses?<br>(maybe you prefer to archive it)';
|
||||
$pia_lang['Maintenance_Tool_upgrade_database_noti'] = 'Upgrade database';
|
||||
$pia_lang['Maintenance_Tool_upgrade_database_noti_text'] = 'Are you sure you want to upgrade the database?<br>(maybe you prefer to archive it)';
|
||||
$pia_lang['Maintenance_Tool_del_alldev'] = 'Delete all Devices';
|
||||
$pia_lang['Maintenance_Tool_del_alldev_text'] = 'Before using this function, please make a backup. The deletion cannot be undone. All devices will be deleted from the database.';
|
||||
$pia_lang['Maintenance_Tool_del_alldev_noti'] = 'Delete Devices';
|
||||
@@ -229,5 +231,7 @@ $pia_lang['BackDevices_DBTools_DelDevError_a'] = 'Error deleting Device';
|
||||
$pia_lang['BackDevices_DBTools_DelDevError_b'] = 'Error deleting Devices';
|
||||
$pia_lang['BackDevices_DBTools_UpdDev'] = 'Device updated successfully';
|
||||
$pia_lang['BackDevices_DBTools_UpdDevError'] = 'Error updating device';
|
||||
$pia_lang['BackDevices_DBTools_Upgrade'] = 'Database upgraded successfully';
|
||||
$pia_lang['BackDevices_DBTools_UpgradeError'] = 'Database upgrade failed';
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user