This commit is contained in:
2019-10-19 05:54:29 -07:00
parent 754c5a0d2e
commit 8166dfa42f
13 changed files with 245 additions and 142 deletions

View File

@@ -38,7 +38,6 @@ require("filetypes.php");
$wopt_steps = 7; // total number of steps
$wopt_currstep = 1;
if ($p['debug']) { $wopt_clear = 0; } else { $wopt_clear = 1; }
$wopt_debug_unique = 0;
$parser = new plistParser();
@@ -103,7 +102,7 @@ if (!is_dir($bdest)) { if (!mkdir($bdest,0777,true)) { echo "Error creating dest
// Check for bundle
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
if ($wopt_debug_unique) { $blabel .= "-".$mytime; }
if (!$p['reuse']) { $blabel .= "-".$mytime; }
if (is_writable($zpath)) { echo "Warning: source is writeable\n"; }
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
@@ -228,10 +227,10 @@ $dbo = new PDO("sqlite:".$bpath."/".$stamp.".sqlite3");
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
//$dbo->query("PRAGMA page_size = 4096");
//$dbo->query("PRAGMA cache_size = 10000");
//$dbo->query("PRAGMA locking_mode = EXCLUSIVE");
//$dbo->query("PRAGMA synchronous = NORMAL");
$dbo->query("PRAGMA page_size = 4096");
$dbo->query("PRAGMA cache_size = 10000");
$dbo->query("PRAGMA synchronous = NORMAL");
$dbo->query("PRAGMA locking_mode = NORMAL");
$dbo->query("PRAGMA journal_mode = WAL");
$dbo->exec("CREATE TABLE _skim (
@@ -399,20 +398,6 @@ if (!$passed_total) {
echo msg("Total files: ".$passed_total."");
// Pool DB
//////////////////////////////////////////
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbp->exec("CREATE TABLE IF NOT EXISTS md5 (fid TEXT, hash TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS icons (fid TEXT, hash TEXT, created INTEGER, relative_path TEXT, tool TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, relative_path TEXT)");
// Prescan
//////////////////////////////////////////
@@ -488,6 +473,7 @@ foreach ($files as $splFileInfo) {
$parts[] = $splFileInfo->getType();
$parts[] = escapeshellarg($bpath);
$parts[] = $mytime;
$parts[] = $p['spotlight'];
$tcmd = implode(" ",$parts);
//msg($tcmd);
@@ -598,6 +584,26 @@ $wopt_currstep++;
if ($p['spotlight']) { $dbo->exec("CREATE TABLE mdls (id INTEGER PRIMARY KEY,".implode(",",$cbuild).")"); }
// Pool DB
//////////////////////////////////////////
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbp->query("PRAGMA page_size = 4096");
$dbp->query("PRAGMA cache_size = 10000");
$dbp->query("PRAGMA synchronous = NORMAL");
$dbp->query("PRAGMA locking_mode = NORMAL");
$dbp->query("PRAGMA journal_mode = WAL");
$dbp->exec("CREATE TABLE IF NOT EXISTS md5 (fid TEXT, hash TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS icons (fid TEXT, hash TEXT, created INTEGER, relative_path TEXT, tool TEXT)");
$dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, relative_path TEXT)");
// Helper
//////////////////////////////////////////
@@ -625,8 +631,6 @@ $dbp->exec("CREATE INDEX IF NOT EXISTS mediainfo_index ON mediainfo (fid)");
$dbp->exec("CREATE INDEX IF NOT EXISTS thumbs_index ON thumbs (fid)");
$dbp->exec("CREATE INDEX IF NOT EXISTS icons_index ON icons (fid)");
$dbo->exec("CREATE INDEX IF NOT EXISTS mdls_index ON mdls (id)");
// Files
//////////////////////////////////////////