예제 #1
0
파일: index.php 프로젝트: eeejayg/F5UXP
    $view = getView($dbName, $dbName, 'id_list');
    //var_dump($view);
    $ids = array();
    if ($view) {
        foreach ($view->rows as $row) {
            if ($row->key != "_design") {
                $ids[] = $row->key[0];
            }
        }
    }
    wrapResponse(null, $ids);
});
F3::route('GET /@db/delete-all', function () {
    global $views;
    $dbName = F3::get('PARAMS["db"]');
    deleteDatabase($dbName);
    createDatabase($dbName);
    updateViews($dbName, $dbName, $views);
    wrapResponse(array("success" => true), null);
});
function wrapResponse($response, $doc)
{
    if (isset($response)) {
        if (isset($response->error)) {
            $data = '{"error":"' . $response->error . '"}';
        } else {
            $data = '{"success":true, "obj":' . json_encode($doc) . '}';
        }
    } else {
        $data = json_encode($doc);
    }
예제 #2
0
             }
         }
     }
     include "pages/_setcontents.php";
 } else {
     if (isset($_GET['page']) && $_GET['page'] == "managegraphs" && isset($_GET['section']) && ($section = $data->getSectionById($_GET['section']))) {
         // SET CONTENTS
         if (isset($_POST['action'])) {
             // Create Database
             if ($_POST['action'] == 'createDatabase' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
                 $dbh = createDatabase($document->getId());
                 parseGEXF($document->getFile(), $dbh);
             }
             // Delete Database
             if ($_POST['action'] == 'deleteDatabase' && isset($_POST['delete']) && $_POST['delete'] == "y" && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
                 if (!deleteDatabase($document->getId())) {
                     echo "Deletion failed";
                 }
             }
             // Reset Database (formerly 'update')
             if ($_POST['action'] == 'updateDatabase' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
                 $dbh = resetDatabase($document->getId());
                 parseGEXF($document->getFile(), $dbh);
             }
             // Change Attribute Viz Type
             if ($_POST['action'] == 'changeViz' && isset($_POST['document']) && ($document = $section->getDocumentById($_POST['document']))) {
                 if (isset($_POST['attribute']) && isset($_POST['viz'])) {
                     try {
                         $dbh = new PDO("sqlite:../data/exploredbs/" . $document->getId());
                         $g = new gRaph($dbh);
                         if ($attribute = $g->getAttributeById($_POST['attribute'])) {
     $email = getEMail();
     $password = getPassword();
     $dbName = getDbName();
     $response = addDatabase($email, $password, $dbName);
     if (isOK($response)) {
         printResult($response, "CREATING CVS DB FAILED", " Database {$dbName} has been created." . PHP_EOL . " ---- CREATING CVS DB SUCCESSFULLY COMPLETED ----");
     } else {
         echo $response->getMessage();
     }
     break;
 case "deleteDatabase":
     echo "Deleting CVS Database..." . PHP_EOL;
     $email = getEMail();
     $password = getPassword();
     $dbName = getDbName();
     $response = deleteDatabase($email, $password, $dbName);
     if (isOK($response)) {
         printResult($response, "DELETING CVS DB FAILED", " Database {$dbName} has been deleted." . PHP_EOL . " ---- DELETING CVS DB SUCCESSFULLY COMPLETED ----");
     } else {
         echo $response->getMessage();
     }
     break;
 case "getDatabases":
     echo "Getting CVS Databases..." . PHP_EOL;
     $email = getEMail();
     $password = getPassword();
     $response = getDatabases($email, $password);
     if (isOK($response)) {
         printDatabasesResult($response, "GETTING CVS DBs FAILED", " ---- GETTING CVS DBs SUCCESSFULLY COMPLETED ----");
     } else {
         echo $response->getMessage();
예제 #4
0
<?php

ini_set('memory_limit', '1024M');
require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
$kernel = new AppKernel('test', true);
$kernel->boot();
$application = new Application($kernel);
$application->setAutoExit(false);
deleteDatabase();
executeCommand($application, "doctrine:schema:create");
executeCommand($application, "ojs:install:travis");
executeCommand($application, "h4cc_alice_fixtures:load:sets");
backupDatabase();
function deleteDatabase()
{
    $folder = __DIR__ . '/cache/test/';
    foreach (['test.db', 'test.db.bk'] as $file) {
        if (file_exists($folder . $file)) {
            unlink($folder . $file);
        }
    }
}
function backupDatabase()
{
    copy(__DIR__ . '/cache/test/test.db', __DIR__ . '/cache/test/test.db.bk');
}
function restoreDatabase()
{