mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
Case insensitive array_diff for files, test on windows
This commit is contained in:
parent
ce01b0e602
commit
f7e3fe9560
@ -3,7 +3,6 @@
|
|||||||
// have been created. Config writes active mod to session.
|
// have been created. Config writes active mod to session.
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
include "./_pdo.php";
|
include "./_pdo.php";
|
||||||
function processCubeMain(){
|
function processCubeMain(){
|
||||||
|
|
||||||
@ -36,19 +35,18 @@ if (file_exists("d2im.db")) {
|
|||||||
$parser = new D2TxtParser();
|
$parser = new D2TxtParser();
|
||||||
$db = new D2Database();
|
$db = new D2Database();
|
||||||
|
|
||||||
$data = null;
|
|
||||||
|
|
||||||
// Parse all files
|
// Parse all files
|
||||||
foreach ($files->files as $k => $v) {
|
foreach ($files->files as $k => $v) {
|
||||||
$data[$v] = $parser->parseFile($v);
|
$data[$v] = $parser->parseFile($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write all parse data to mod db
|
// Write all parse data to mod db
|
||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
$db->createTables($k, $v);
|
$db->createTables($k, $v);
|
||||||
$db->fillsTables($k, $v);
|
$db->fillsTables($k, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data);
|
|
||||||
processCubeMain('cubemain.txt');
|
processCubeMain('cubemain.txt');
|
||||||
// put in html redirect as backup, because
|
// put in html redirect as backup, because
|
||||||
// for some odd reason windows gives
|
// for some odd reason windows gives
|
||||||
|
@ -29,9 +29,9 @@ class D2Files {
|
|||||||
];
|
];
|
||||||
$glob = glob($_SESSION['path'].'*.txt');
|
$glob = glob($_SESSION['path'].'*.txt');
|
||||||
foreach ($glob as $g){
|
foreach ($glob as $g){
|
||||||
$files[] = strtolower(basename($g));
|
$files[] = basename($g);
|
||||||
}
|
}
|
||||||
$this->files = array_diff($files, $filesToIgnore);
|
$this->files = array_udiff($files, $filesToIgnore, 'strcasecmp');
|
||||||
return $this->files;
|
return $this->files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user