/**
  * @return void
  */
 public function testGetOption()
 {
     $this->assertEquals('map-file.xml', $this->config->getOption('map_file'));
     $this->assertEquals('etc/settings.xml', $this->config->getOption('settings_map_file'));
     $this->assertEquals('100', $this->config->getOption('bulk_size'));
     $this->assertEquals('custom_option_value', $this->config->getOption('custom_option'));
     $this->assertEquals('map-sales.xml', $this->config->getOption('sales_order_map_file'));
 }
Example #2
0
 /**
  * Constructor
  *
  * @param string $name   The name of the repository. Must match /[A-Za-z0-9_-]{1,63}+/
  * @param Config $config The config to use for this repo
  */
 public function __construct($name, Config $config)
 {
     // Setup class properties
     $this->name = $name;
     $this->path = $config->getPath() . DIRECTORY_SEPARATOR . $name;
     $this->formatter = $config->getOption('formatter');
     $this->queryClass = $config->getOption('query_class');
     $this->documentClass = $config->getOption('document_class');
     // Ensure the repo name is valid
     $this->validateName($this->name);
     // Ensure directory exists and we can write there
     if (!is_dir($this->path)) {
         if (!@mkdir($this->path, 0777, true)) {
             throw new \RuntimeException(sprintf('`%s` doesn\'t exist and can\'t be created.', $this->path));
         }
     } else {
         if (!is_writable($this->path)) {
             throw new \RuntimeException(sprintf('`%s` is not writable.', $this->path));
         }
     }
 }
Example #3
0
 /**
  * Constructor
  *
  * @param string $name   The name of the repository. Must match /[A-Za-z0-9_-]{1,63}+/
  * @param Config $config The config to use for this repo
  */
 public function __construct($name, Config $config)
 {
     // Setup class properties
     $this->name = $name;
     $this->path = $config->getPath() . DIRECTORY_SEPARATOR . $name;
     $this->formatter = $config->getOption('formatter');
     // Ensure the repo name is valid
     $this->validateName($this->name);
     // Ensure directory exists and we can write there
     if (!file_exists($this->path)) {
         mkdir($this->path);
         chmod($this->path, 0777);
     }
 }
Example #4
0
 /**
  * Get the list of current tasks and transform them into 
  * the corresponding classes
  *
  * @return array $taskObjects Objects made from task data
  */
 public function getTasks()
 {
     // pull them from the config file and make them classes
     $tasks = Config::getOption('project.tasks');
     $project = Config::getOption('project');
     $taskObjects = array();
     foreach ($tasks as $index => $task) {
         $typeParts = explode('.', $task->type);
         $typePath = '';
         foreach ($typeParts as $part) {
             $typePath .= ucwords(strtolower($part)) . '\\';
         }
         $typePath = substr($typePath, 0, strlen($typePath) - 1);
         $taskName = '\\Usher\\Lib\\Task\\' . $typePath;
         $className = $taskName . 'Task';
         $taskObject = new $className($project);
         $task->id = $index;
         $taskObject->configure($task);
         $taskObjects[] = $taskObject;
     }
     return $taskObjects;
 }
Example #5
0
 public function testSettingFormatter()
 {
     $path = __DIR__ . '/fixtures/datastore/writable';
     $config = new Config($path . '/', array('formatter' => new Formatter\YAML()));
     $this->assertInstanceOf('JamesMoss\\Flywheel\\Formatter\\YAML', $config->getOption('formatter'));
 }
Example #6
0
function __autoload($className)
{
    if ($className == "AbstractModule") {
        require AOX_MODULE_PATH . "/AbstractModule.class.php";
    }
}
set_exception_handler('writeException');
OutlineTpl::globalAssign('pageTitle', 'aoxPages Devel');
try {
    aoxPages::setDB($dbHost, $dbUser, $dbPassword, $dbName, $dbSystem);
} catch (Exception $e) {
    writeException($e);
}
try {
    $_config = new Config();
    $configID = $_config->getOption('standardConfigID');
    $_config->resetConfig($configID);
} catch (Exception $e) {
    writeException($e);
}
$getModule = $_GET['module'];
if (empty($getModule)) {
    $getModule = $_config->getOption('standardModule');
}
$module = NULL;
if (AbstractModule::isValidModule($getModule, true)) {
    require AOX_MODULE_PATH . "/" . $getModule . ".class.php";
    $module = new $getModule();
} else {
    require AOX_MODULE_PATH . "/ErrorModule.class.php";
    $module = new ErrorModule();
Example #7
0
<?php

include 'Config.php';
//$cfg = new Config("/home/tyler/Desktop/dev/Ping-Monitor/pingMonitor.cfg");
$cfg = new Config("/var/www/pingMonitor.cfg");
$user = $cfg->getOption("DB_USER");
$pass = $cfg->getOption("DB_PASS");
$host = $cfg->getOption("DB_HOST");
$name = $cfg->getOption("DB_NAME");
$link = mysqli_connect($host, $user, $pass);
if (!$link) {
    die("Error when opening connection:\n\t" . mysqli_error());
}
$success = mysqli_select_db($link, $name);
if (!$success) {
    die('Error when opening database:\\n\\t' . mysqli_error());
}
// TODO: Add ability to filter data via parameters
function readData($ip_filter = "", $date_start_filter = "", $date_end_filter = "")
{
    global $link;
    $sql_query = 'SELECT * FROM dataTable';
    // Filter stuff
    // ...
    if ($ip_filter != "" || $date_start_filter != "" || $date_end_filter != "") {
        $sql_query = $sql_query . ' WHERE ';
    }
    if ($ip_filter != "") {
        $sql_query = $sql_query . ' IP="' . $ip_filter . '"';
        if ($date_start_filter != "" || $date_end_filter != "") {
            $sql_query = $sql_query . ' AND';