mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
DB Dump Working
This commit is contained in:
@@ -26,10 +26,10 @@ class D2TxtParser {
|
||||
|
||||
public $path = TXT_PATH;
|
||||
|
||||
// Files specific to Unique Items
|
||||
|
||||
public $db;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->db = new D2Database();
|
||||
}
|
||||
|
||||
public function parseFile($file) {
|
||||
@@ -46,10 +46,10 @@ class D2TxtParser {
|
||||
$allProps[] = $d['code'];
|
||||
}
|
||||
$filteredProps = array_diff($allProps, $propsToFilter);
|
||||
return $filteredProps;
|
||||
return $filteredProps;
|
||||
}
|
||||
|
||||
public function parseData($file) {
|
||||
public function parseData($file) {
|
||||
$file = $this->path . $file;
|
||||
$rows = array_map(function ($v) {
|
||||
return str_getcsv($v, "\t");
|
||||
@@ -58,9 +58,12 @@ class D2TxtParser {
|
||||
$header = array_shift($rows);
|
||||
foreach ($rows as $row) {
|
||||
$data[] = @array_combine($header, $row);
|
||||
}
|
||||
}
|
||||
$this->db->createTables($file, $data);
|
||||
$this->db->fillsTables($file, $data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user