Exemplo n.º 1
0
function checkdatabase()
{
    if (is_readable(getDatabasePath())) {
        return true;
    } else {
        return false;
    }
}
Exemplo n.º 2
0
<h2>Installation.</h2>
<div id="installation">
    <h3>Server Message</h3>
<?php 
require_once 'lib/common.php';
$error = '';
$root = getRootPath();
$database = getDatabasePath();
unset($_SESSION['id']);
//Falls Datenbank schon existiert
if (is_readable($database)) {
    $error = "Bitte loesche die vorhandene Datenbank manuell bevor du diese Installation durchfuehrst und aktualisiere die Seite";
}
//Datenbank erstellen
if (!$error) {
    $db = db();
    if (!$db) {
        $error = "Es konnte keine Datenbank erstellt werden.";
    }
}
//SQL Datei finden
if (!$error) {
    $sql = @file_get_contents($root . '/database/init.sql');
    if ($sql == false) {
        $error = 'Die SQL Datei konnte nicht gefunden werden';
    }
}
//Mit Datenbank verbinden und SQL ausführen
if (!$error) {
    $result = $db->exec($sql);
    if ($result == false) {
Exemplo n.º 3
0
/**
 * Gets the DSN for the SQLite connection
 *
 * @return string
 */
function getDsn()
{
    return 'sqlite:' . getDatabasePath();
}