mirror of https://github.com/itflow-org/itflow
Implement Installation ID for optional telemetry
This commit is contained in:
parent
4b6faae6f7
commit
0a1fb2227e
|
|
@ -790,14 +790,27 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
|
||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.5'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.5'");
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(CURRENT_DATABASE_VERSION == '0.3.5'){
|
if(CURRENT_DATABASE_VERSION == '0.3.5'){
|
||||||
// Insert queries here required to update to DB version 0.3.6
|
$installation_id = randomString(32);
|
||||||
|
|
||||||
|
// Update config.php var with new version var for use with docker
|
||||||
|
file_put_contents("config.php", "\n\$installation_id = '$installation_id';" . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.6'");
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(CURRENT_DATABASE_VERSION == '0.3.6'){
|
||||||
|
// Insert queries here required to update to DB version 0.3.7
|
||||||
|
|
||||||
// Then, update the database to the next sequential version
|
// Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.6'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.3.7'");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Up-to-date
|
// Up-to-date
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@
|
||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "0.3.5");
|
DEFINE("LATEST_DATABASE_VERSION", "0.3.6");
|
||||||
|
|
|
||||||
1
post.php
1
post.php
|
|
@ -1215,6 +1215,7 @@ if(isset($_POST['send_telemetry_data'])){
|
||||||
|
|
||||||
$postdata = http_build_query(
|
$postdata = http_build_query(
|
||||||
array(
|
array(
|
||||||
|
'installation_id' => "$installation_id",
|
||||||
'version' => "$current_version",
|
'version' => "$current_version",
|
||||||
'company_name' => "$company_name",
|
'company_name' => "$company_name",
|
||||||
'city' => "$city",
|
'city' => "$city",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
<h3 class="card-title"><i class="fa fa-fw fa-broadcast-tower"></i> Telemetry</h3>
|
<h3 class="card-title"><i class="fa fa-fw fa-broadcast-tower"></i> Telemetry</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
<p class="text-center">Installation ID: <strong><?php echo $installation_id; ?></strong></p>
|
||||||
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -782,6 +782,8 @@ if (isset($_POST['add_database'])) {
|
||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
$config_base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
|
$config_base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
$installation_id = randomString(32);
|
||||||
|
|
||||||
// Test database connection before writing it to config.php
|
// Test database connection before writing it to config.php
|
||||||
try {
|
try {
|
||||||
mysqli_connect($host, $username, $password, $database);
|
mysqli_connect($host, $username, $password, $database);
|
||||||
|
|
@ -800,6 +802,7 @@ if (isset($_POST['add_database'])) {
|
||||||
$new_config[] = sprintf("\$config_base_url = '%s';\n", addslashes($config_base_url));
|
$new_config[] = sprintf("\$config_base_url = '%s';\n", addslashes($config_base_url));
|
||||||
$new_config[] = "\$config_https_only = TRUE;\n";
|
$new_config[] = "\$config_https_only = TRUE;\n";
|
||||||
$new_config[] = "\$repo_branch = 'master';\n";
|
$new_config[] = "\$repo_branch = 'master';\n";
|
||||||
|
$new_config[] = "\$installation_id = '$installation_id';\n";
|
||||||
|
|
||||||
file_put_contents("config.php", $new_config);
|
file_put_contents("config.php", $new_config);
|
||||||
|
|
||||||
|
|
@ -1033,6 +1036,7 @@ if (isset($_POST['add_telemetry'])) {
|
||||||
|
|
||||||
$postdata = http_build_query(
|
$postdata = http_build_query(
|
||||||
array(
|
array(
|
||||||
|
'installation_id' => "$installation_id",
|
||||||
'company_name' => "$company_name",
|
'company_name' => "$company_name",
|
||||||
'city' => "$city",
|
'city' => "$city",
|
||||||
'state' => "$state",
|
'state' => "$state",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue