Skip to content

Commit

Permalink
Create dbupload.cli.php
Browse files Browse the repository at this point in the history
  • Loading branch information
auxlife authored Nov 29, 2017
1 parent 76c676f commit 5cddb42
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dbupload.cli.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
$time_start = microtime(true);
include_once "tidepool.inc.php";
error_reporting(E_ALL);

ConnectDB();
$results = RunQuery("SELECT * FROM `Data` WHERE `Uploaded` IS NULL ORDER BY `Data`.`DateString` ASC LIMIT 250");
if(mysqli_num_rows($results)>0)
{
Login();
while ($row = mysqli_fetch_array($results)){
echo UploadBG($row["DateString"],$row["Type"],$row["Value"],$row["Payload"]);
ConfirmUpload($row["Payload"]);
}
Logout();
}
else
{
$cronjob = fopen("c:\\xampp\\htdocs\\drip\\cronjob.bat","w");
fwrite($cronjob, "exit");
fclose($cronjob);
}
DisconnectDB();
$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
echo PHP_EOL . 'Total Execution Time: '.$execution_time.' secs';
?>

0 comments on commit 5cddb42

Please sign in to comment.