Esempio n. 1
0
 public function __construct($data = null)
 {
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
     if (!empty($data)) {
         $this->data = $data;
     }
 }
Esempio n. 2
0
File: Db.php Progetto: bjomal/mpmq
 public function __construct($data)
 {
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
     $this->type = 'generic';
     $this->connected = false;
     $this->data = $data;
     if (array_key_exists('prefix', $this->data)) {
         $this->tablePrefix = $this->data['prefix'];
     }
     if (!$this->connect()) {
         throw new \Exception('Unable to connect to database');
     }
 }
Esempio n. 3
0
 public function __construct($id, $name, $description = '', $timeout = self::DEFAULT_TIMEOUT)
 {
     if (empty($timeout)) {
         $timeout = self::DEFAULT_TIMEOUT;
     }
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
     $this->id = $id;
     if ($this->load()) {
         $this->log->debug("id={$id} alredy existed. Cannot create!!!");
         $this->existed = true;
     } else {
         $this->name = $name;
         $this->description = $description;
         $this->timeout = $timeout;
         $this->changed();
     }
 }
Esempio n. 4
0
 public function __construct($queueId, $messageId = null, $title = '', $payload = '', $timeout = self::DEFAULT_TIMEOUT)
 {
     if (empty($timeout)) {
         $timeout = self::DEFAULT_TIMEOUT;
     }
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
     $this->queueId = $queueId;
     $this->messageId = $messageId;
     if ($this->messageId !== null && $this->load()) {
         $this->log->debug("id={$id} alredy existed. Cannot create!!!");
         $this->existed = true;
     } else {
         $this->title = $title;
         $this->payload = $payload;
         $this->timeout = $timeout;
         $this->inFlight = false;
         $this->changed();
     }
 }
Esempio n. 5
0
 public function __construct()
 {
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
     $this->errorMessages = array();
 }
Esempio n. 6
0
File: Misc.php Progetto: bjomal/mpmq
 public function __construct()
 {
     $this->log = \Malmanger\Mpmq\Util\Log::getInstance();
 }
Esempio n. 7
0
<?php

// All file paths relative to root
chdir(dirname(__FILE__));
define('MPMQ_ROOT', dirname(__FILE__) . '/');
require 'vendor/autoload.php';
require 'app/src/autoload.php';
session_start();
if (file_exists('app/settings.php')) {
    $settings = (require 'app/settings.php');
} else {
    $settings = (require 'app/settings.php.dist');
}
// Create a log object
$log = \Malmanger\Mpmq\Util\Log::getInstance(\Malmanger\Mpmq\Util\Log::DEBUG);
$log->debug("Logging started");
// initialize database
$data = $settings["settings"]["db"];
$misc = $settings["settings"]["misc"];
$app = new \Slim\App($settings);
// disable error handler
unset($app->getContainer()['errorHandler']);
// Create or connect to DB
try {
    // TODO: do test on settings to confirm correct database type
    $database = new \Malmanger\Mpmq\Db\SQLite($data);
} catch (\Exception $e) {
    $err = new \Malmanger\Mpmq\Util\ErrorHandler();
    $resp = new Slim\Http\Response();
    $log->debug("Error connecting to database:" . $e->getMessage());
    $log->error("Unable to create or connect to database!, exiting");