-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcleanDB.php
More file actions
executable file
·38 lines (27 loc) · 914 Bytes
/
Copy pathcleanDB.php
File metadata and controls
executable file
·38 lines (27 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php require_once "config.php" ?>
<?php require_once "db.php" ?>
<?php require_once "funs.php" ?>
<?php
$verbose=$config["verbose"];
$filename = "db.lck";
$s = 'DO NOT REMOVE THIS FILE! Unless you want to clean your DB!';
if (file_exists($filename)){
if($verbose) {
echo "DB cleaning is locked. Delete $filename to clean database!";
}
}
else {
//DROP TABLE
//y: for some reason - this stoped working on my rpi...doesn't drop the table... will check what's that.
DB::exec("DROP TABLE IF EXISTS rpi_temp");
if($verbose)
echo "DB Droped! <br>";
DB::exec("CREATE TABLE 'rpi_temp' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'temp' REAL, 'time' TEXT, 'cpu' REAL,'rtemp' REAL,'hum' REAL)");
if($verbose)
echo "DB created! <br>";
Stats::measureTemp();
if($verbose)
echo "First values inserted! Good luck:) <br>";
file_put_contents($filename, $s);
}
?>