Delete install_database.php
This commit is contained in:
@@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
set_time_limit(300);
|
|
||||||
|
|
||||||
$host = getenv('DB_HOST') ?: 'localhost';
|
|
||||||
$user = getenv('DB_USER') ?: 'root';
|
|
||||||
$pass = getenv('DB_PASS') ?: '';
|
|
||||||
$db = getenv('DB_NAME') ?: 'sipantas_webgis';
|
|
||||||
$port = (int)(getenv('DB_PORT') ?: 3306);
|
|
||||||
|
|
||||||
echo "<h2>Install Database UAS SIPANTAS</h2>";
|
|
||||||
echo "<p>Target koneksi: {$host}:{$port}, database: {$db}, user: {$user}</p>";
|
|
||||||
|
|
||||||
$conn = new mysqli($host, $user, $pass, $db, $port);
|
|
||||||
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
die("<p style='color:red'>Koneksi gagal: " . htmlspecialchars($conn->connect_error) . "</p>");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sqlFile = __DIR__ . "/database/sipantas_webgis.sql";
|
|
||||||
|
|
||||||
if (!file_exists($sqlFile)) {
|
|
||||||
die("<p style='color:red'>File SQL tidak ditemukan: {$sqlFile}</p>");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = file_get_contents($sqlFile);
|
|
||||||
|
|
||||||
if ($conn->multi_query($sql)) {
|
|
||||||
do {
|
|
||||||
if ($result = $conn->store_result()) {
|
|
||||||
$result->free();
|
|
||||||
}
|
|
||||||
} while ($conn->more_results() && $conn->next_result());
|
|
||||||
|
|
||||||
if ($conn->errno) {
|
|
||||||
echo "<p style='color:red'>Ada error saat import: " . htmlspecialchars($conn->error) . "</p>";
|
|
||||||
} else {
|
|
||||||
echo "<p style='color:green'>Database berhasil diimport.</p>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "<p style='color:red'>Import gagal: " . htmlspecialchars($conn->error) . "</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn->close();
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user