$reschk = $pdo->query("SELECT COUNT(*) AS num FROM tmux"); if ($reschk === false) { $cfg->dbCreateCheck = false; $cfg->error = true; $cfg->emessage = 'Could not select data from your database, check that tables and data are properly created/inserted.'; } else { foreach ($reschk as $row) { if ($row['num'] > 0) { $dbInstallWorked = true; break; } } } $ver = new \nzedb\utility\Versions(); $patch = $ver->getSQLPatchFromFiles(); $pdo->setSetting(['..sqlpatch' => $patch]); if ($dbInstallWorked) { $ver = new \nzedb\utility\Versions(); $patch = $ver->getSQLPatchFromFiles(); if ($patch > 0) { $updateSettings = $pdo->setSetting(['section' => '', 'subsection' => '', 'name' => 'sqlpatch', 'value' => $patch]); } else { $updateSettings = false; } // If it all worked, move to the next page. if ($updateSettings) { header("Location: ?success"); if (file_exists($cfg->DB_DIR . '/post_install.php')) { exec("php " . $cfg->DB_DIR . "/post_install.php {$pdo}"); } exit;
/** * Sets the database time for last full AniDB update */ private function setLastUpdated() { $this->pdo->setSetting(['APIs.anidb.last_full_update' => time()]); }