Пример #1
0
 /**
  * @preserveGlobalState disabled
  * @runInSeparateProcess
  */
 public function test_connect()
 {
     $this->assertFalse(Hm_DB::connect($this->config));
     setup_db($this->config);
     $this->assertEquals('object', gettype(Hm_DB::connect($this->config)));
     $this->assertEquals('object', gettype(Hm_DB::connect($this->config)));
 }
Пример #2
0
 public function setUp()
 {
     $this->registry = new Registry();
     $this->registry->db = function () {
         return setup_db();
     };
     $this->registry->event = function () {
         return setup_events();
     };
     if (DB_DRIVER === 'mysql') {
         $pdo = new PDO('mysql:host=' . DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
         $pdo->exec('DROP DATABASE ' . DB_NAME);
         $pdo->exec('CREATE DATABASE ' . DB_NAME);
         $pdo = null;
     } else {
         if (DB_DRIVER === 'postgres') {
             $pdo = new PDO('pgsql:host=' . DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
             $pdo->exec('DROP DATABASE ' . DB_NAME);
             $pdo->exec('CREATE DATABASE ' . DB_NAME . ' WITH OWNER ' . DB_USERNAME);
             $pdo = null;
         }
     }
 }
Пример #3
0
 public static function setUpBeforeClass()
 {
     if (DB_DRIVER === 'sqlite') {
         @unlink(DB_FILENAME);
         $pdo = new PDO('sqlite:' . DB_FILENAME);
     } else {
         if (DB_DRIVER === 'mysql') {
             $pdo = new PDO('mysql:host=' . DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
             $pdo->exec('DROP DATABASE ' . DB_NAME);
             $pdo->exec('CREATE DATABASE ' . DB_NAME);
             $pdo = new PDO('mysql:host=' . DB_HOSTNAME . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
         } else {
             if (DB_DRIVER === 'postgres') {
                 $pdo = new PDO('pgsql:host=' . DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
                 $pdo->exec('DROP DATABASE ' . DB_NAME);
                 $pdo->exec('CREATE DATABASE ' . DB_NAME . ' WITH OWNER ' . DB_USERNAME);
                 $pdo = new PDO('pgsql:host=' . DB_HOSTNAME . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
             }
         }
     }
     setup_db();
     $pdo->exec("UPDATE config SET api_token='" . API_KEY . "'");
     $pdo = null;
 }
Пример #4
0
function install($options)
{
    $check = check_requirements();
    if ($check[0]) {
        setup_db($options);
        write_config_files($options);
        dir_permissions();
    } else {
        echo 'FAILED! Pre-installation check failed: ' . $check[1] . "\n\n";
        exit(1);
    }
}
Пример #5
0
 /**
  * @preserveGlobalState disabled
  * @runInSeparateProcess
  */
 public function test_db_save()
 {
     $site_config = new Hm_Mock_Config();
     $user_config = new Hm_User_Config_DB($site_config);
     $user_config->reload(array('foo' => 'bar'));
     $this->assertFalse($user_config->save('testuser', 'testkey'));
     $site_config = new Hm_Mock_Config();
     setup_db($site_config);
     $user_config = new Hm_User_Config_DB($site_config);
     $user_config->reload(array('foo' => 'bar'));
     $this->assertTrue($user_config->save('testuser', 'testkey'));
     $this->assertTrue($user_config->save(uniqid(), 'testkey'));
     $this->assertFalse($user_config->save(NULL, 'blah'));
 }
Пример #6
0
 public function setUp()
 {
     require 'bootstrap.php';
     ini_set('session.use_cookies', '0');
     session_cache_limiter('');
     $this->config = new Hm_Mock_Config();
     setup_db($this->config);
 }
Пример #7
0
<?php

include 'lib/fortissimo.php';
$ft->title('Fortissimo Setup');
if ($ft->config('setup_done')) {
    return $ft->errorpage('Sorry, you have already completed the setup process.');
}
# STEP 1: let's create the tables that we need...
include 'lib/db_utils.php';
setup_db();
populate_db();
# okay, make sure they gave us all the inputs
$user = trim($_POST['admin_name']);
$pw1 = trim($_POST['admin_pw1']);
$pw2 = trim($_POST['admin_pw2']);
$ft->assign('admin_name', $user);
if (!$user || !$pw1 || !$pw2) {
    $ft->assign('error1', 'You must fill in all fields in this section.');
    return $ft->makepage('setup');
}
if ($pw1 != $pw2) {
    $ft->assign('error1', 'The chosen passwords do not match.');
    return $ft->makepage('setup');
}
if (strlen($pw1) < 6) {
    $ft->assign('error1', 'Your password must be at least 6 characters long.');
    return $ft->makepage('setup');
}
# setup this account
$id = get_pilot_id($user);
$ft->dbh->_do_query('UPDATE tbl:pilots SET password = ?, roles = 1 WHERE pilotid = ?', array($pw1, $id));
Пример #8
0
 public function setUp()
 {
     require 'bootstrap.php';
     $this->config = new Hm_Mock_Config();
     setup_db($this->config);
 }
Пример #9
0
$serverinfo = $caldavtester_dir . '/serverinfo.xml';
$testspath = 'scripts/tests/';
// must be stripped off when calling testcaldav.py
$db_path = $caldavtester_dir . '/results.sqlite';
// path to git sources to automatic get branch&revision, you can also hardcode default branch&revision here
$git_sources = realpath($caldavtester_dir . '/../egroupware');
$branch = 'master';
$revision = '';
// to link revisions to commits, get autodetected for Github.com
$commit_url = '';
// equivalent of 'https://github.com/EGroupware/egroupware/commit/';
config_from_git($git_sources);
if (!file_exists($caldavtester_dir) || !file_exists($caldavtester_dir . '/testcaldav.py')) {
    usage(4, 'You need to configure $caldavtester_dir with the directory of your CalDAVTester directory!');
}
$db = setup_db($db_path);
// controller for command line
if (php_sapi_name() == 'cli') {
    $options = getopt("h", array('help', 'branch:', 'revision::', 'results', 'scripts::', 'features', 'import::', 'run::', 'delete:', 'result-details::', 'git-sources::', 'serverinfo::', 'gui::'));
    if (isset($options['h']) || isset($options['help'])) {
        usage();
    }
    if (isset($options['serverinfo'])) {
        if (!file_exists($options['serverinfo'])) {
            usage(5, "Specified serverinfo '{$options['serverinfo']}' not found!");
        }
        $serverinfo = realpath($options['serverinfo']);
    }
    if (isset($options['git-sources'])) {
        if (!@file_exists(realpath($options['git-sources'] . '/.git'))) {
            usage(6, "Specified Git sources '{$options['serverinfo']}/.git' not found!");
Пример #10
0
<?php

// Common file between cli and web interface
require __DIR__ . '/Core/Loader.php';
require __DIR__ . '/helpers.php';
require __DIR__ . '/functions.php';
use Core\Loader;
use Core\Registry;
// Include password_compat for PHP < 5.5
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    require __DIR__ . '/../vendor/password.php';
}
// Include custom config file
if (file_exists('config.php')) {
    require 'config.php';
}
require __DIR__ . '/constants.php';
$loader = new Loader();
$loader->setPath('app');
$loader->setPath('vendor');
$loader->execute();
$registry = new Registry();
$registry->db = setup_db();
$registry->event = setup_events();
$registry->mailer = setup_mailer();