Example #1
0
        echo PHP_EOL . '===================================' . PHP_EOL;
    }
} else {
    echo sprintf(PHP_EOL . 'Sorry, an unexpected error has occured : %s' . PHP_EOL, $updateError->getMessage());
    print $updateError->getTraceAsString() . PHP_EOL;
    print "Trace: " . PHP_EOL;
    foreach ($update->getLogs() as $log) {
        echo sprintf('[%s] %s' . PHP_EOL, $log[0], $log[1]);
    }
    if (true === $backup) {
        while (1) {
            echo "Would you like to restore the backup database ? (Y/n)" . PHP_EOL;
            $rep = readStdin(true);
            if ($rep == 'y') {
                echo "Database restore started. Wait, it could take a while..." . PHP_EOL;
                if (false === $update->restoreDb()) {
                    echo sprintf(PHP_EOL . 'Sorry, your database can\'t be restore. Try to do it manually : %s' . PHP_EOL, $update->getBackupFile());
                    exit(5);
                } else {
                    echo "Database successfully restore." . PHP_EOL;
                    exit(5);
                }
                break;
            } elseif ($rep == 'n') {
                exit(0);
            }
        }
    }
}
/***************************************************
 * Try to delete cache