예제 #1
0
 public function setUp()
 {
     parent::setUp();
     LudoDBRegistry::set('FILE_UPLOAD_PATH', '/tmp/');
     $mv = new MetadataValue();
     $mv->drop()->yesImSure();
     $m = new Move();
     $m->drop()->yesImSure();
     $g = new Game();
     $g->drop()->yesImSure();
     $g->createTable();
     $m->createTable();
     $mv->createTable();
     $db = new Database(1);
     if (!$db->getId()) {
         $db->setTitle('My database');
         $db->commit();
     }
 }
예제 #2
0
 public function setUp()
 {
     if (!self::$connected) {
         date_default_timezone_set('Europe/Berlin');
         LudoDB::setHost('localhost');
         LudoDB::setUser('root');
         LudoDB::setPassword('administrator');
         LudoDB::setDb('PHPUnit');
         self::$connected = true;
         LudoDBRegistry::set('FILE_UPLOAD_PATH', '/tmp/');
     }
     if (!self::$logCleared) {
         self::$logCleared = true;
         $this->clearLog();
     }
     $classes = array('Game', 'Move', 'Database', 'Folder', 'Metadata', 'MetadataValue', 'Session', 'Seek', 'Chat', 'ChatMessage', 'ChatMessages', 'Fen', 'Player', 'TimeControl', 'ChessFileUpload', 'Elo', 'PasswordLookup');
     $util = new LudoDBUtility();
     $util->dropAndCreate($classes);
     $this->createAdminUserAndSignIn();
 }
예제 #3
0
 /**
  * Set name of database used in database connection.
  * @param $dbName
  */
 public static function setDb($dbName)
 {
     LudoDBRegistry::set('DB_NAME', $dbName);
 }
예제 #4
0
 public static function setUploadPath($path)
 {
     LudoDBRegistry::set(self::FILE_UPLOAD_KEY, $path);
 }
예제 #5
0
 /**
  * Set instance name for Oracle connection
  * @param $instance
  */
 public function setInstanceName($instance)
 {
     LudoDBRegistry::set('DB_INSTANCE', $instance);
 }
예제 #6
0
<?php

require_once dirname(__FILE__) . "/autoload.php";
require_once "php/jsonwrapper/jsonwrapper.php";
date_default_timezone_set("Europe/Berlin");
ini_set('display_errors', 'on');
if (file_exists("connection.php")) {
    require "connection.php";
}
LudoDBRegistry::set('FILE_UPLOAD_PATH', '/tmp/');
LudoDBRegistry::set('DEVELOP_MODE', true);
LudoDB::enableLogging();
// For static(No db) installations
ChessRegistry::setPgnFolder("pgn");
ChessRegistry::setCacheFolder("cache");
// Path to cache
$request = isset($_GET['request']) ? $_GET['request'] : $_POST['request'];
$requestData = isset($_POST['data']) ? $_POST['data'] : null;
$handler = new LudoDBRequestHandler();
echo $handler->handle($request, $requestData);