public function __construct($data = null) { $this->log = \Malmanger\Mpmq\Util\Log::getInstance(); if (!empty($data)) { $this->data = $data; } }
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'); } }
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(); } }
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(); } }
public function __construct() { $this->log = \Malmanger\Mpmq\Util\Log::getInstance(); $this->errorMessages = array(); }
public function __construct() { $this->log = \Malmanger\Mpmq\Util\Log::getInstance(); }
<?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");