docs+CSV import logging
This commit is contained in:
@@ -53,7 +53,7 @@ Highest to lowest:
|
|||||||
* Refactoring enabling faster implementation of future functionality
|
* Refactoring enabling faster implementation of future functionality
|
||||||
* UI improvements
|
* UI improvements
|
||||||
|
|
||||||
Design philosophy: Focus on core functionality and leverage existing apps and tools to make PiAlert integratable into other workflows.
|
Design philosophy: Focus on core functionality and leverage existing apps and tools to make PiAlert integrate into other workflows.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
|
|||||||
@@ -477,6 +477,7 @@ function ImportCSV() {
|
|||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
$skipped = "";
|
||||||
$error = "";
|
$error = "";
|
||||||
|
|
||||||
// sql
|
// sql
|
||||||
@@ -492,12 +493,13 @@ function ImportCSV() {
|
|||||||
|
|
||||||
|
|
||||||
// Parse data from CSV file line by line (max 10000 lines)
|
// Parse data from CSV file line by line (max 10000 lines)
|
||||||
|
$index = 0;
|
||||||
foreach($data as $row)
|
foreach($data as $row)
|
||||||
{
|
{
|
||||||
// Check if not empty and skipping first line
|
// Check if not empty and skipping first line
|
||||||
$rowArray = explode(',',$row);
|
$rowArray = explode(',',$row);
|
||||||
|
|
||||||
if(count($rowArray) > 20)
|
if(count($rowArray) > 23)
|
||||||
{
|
{
|
||||||
$cleanMac = str_replace("\"","",$rowArray[0]);
|
$cleanMac = str_replace("\"","",$rowArray[0]);
|
||||||
|
|
||||||
@@ -513,19 +515,21 @@ function ImportCSV() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
$skipped = $skipped . ($index+1) . ",";
|
||||||
}
|
}
|
||||||
|
$index = $index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($error == "")
|
if($error == "")
|
||||||
{
|
{
|
||||||
// import succesful
|
// import succesful
|
||||||
echo lang('BackDevices_DBTools_ImportCSV');
|
echo lang('BackDevices_DBTools_ImportCSV') . "(Skipped lines: " .$skipped .")";
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// an error occurred while writing to the DB, display the last error message
|
// an error occurred while writing to the DB, display the last error message
|
||||||
echo lang('BackDevices_DBTools_ImportCSVError')."\n\n$sql \n\n".$result;
|
echo lang('BackDevices_DBTools_ImportCSVError')."\n".$error."\n$sql \n\n".$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user