Skip to content

Commit

Permalink
Merge pull request #4416 from FengZh61/FengZh61-patch-1
Browse files Browse the repository at this point in the history
Updating the items file import process
  • Loading branch information
nilsteampassnet authored Oct 14, 2024
2 parents 990d5bc + 3de8a16 commit 5a5e6be
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sources/import.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,20 @@
if ($fp = fopen($file, 'r')) {
// data from CSV
$valuesToImport = array();

$header = fgetcsv($fp);
// Lexer configuration
$config = new LexerConfig();
$lexer = new Lexer($config);
$config->setIgnoreHeaderLine('true');
$interpreter = new Interpreter();
$interpreter->addObserver(function (array $row) use (&$valuesToImport) {
$interpreter->addObserver(function (array $row) use (&$valuesToImport,$header) {
$rowData = array_combine($header, $row);
$valuesToImport[] = array(
'Label' => $row[0],
'Login' => $row[1],
'Password' => $row[2],
'url' => $row[3],
'Comments' => $row[4],
'Label' => $rowData['label'],
'Login' => $rowData['login'],
'Password' => $rowData['pw'],
'url' => $rowData['url'],
'Comments' => $rowData['description'],
);
});
$lexer->parse($file, $interpreter);
Expand Down

0 comments on commit 5a5e6be

Please sign in to comment.