Example #1
0
 /**
  * Handle event hooks.
  */
 function registerEventHooks()
 {
     parent::registerEventHooks();
     \Idno\Core\Idno::site()->addEventHook('upgrade', function (\Idno\Core\Event $event) {
         $new_version = $event->data()['new_version'];
         $last_update = $event->data()['last_update'];
         if ($last_update < 2016042301) {
             \Idno\Core\Idno::site()->logging()->debug("Mongo: Applying mongo upgrades - adding index.");
             $this->database->entities->createIndex(['created' => 1]);
         }
     });
 }
Example #2
0
 function __construct($dbstring = null, $dbuser = null, $dbpass = null, $dbname = null, $dbauthsrc = null)
 {
     $this->dbstring = $dbstring;
     $this->dbuser = $dbuser;
     $this->dbpass = $dbpass;
     $this->dbname = $dbname;
     $this->dbauthsrc = $dbauthsrc;
     if (empty($dbstring)) {
         $this->dbstring = \Idno\Core\Idno::site()->config()->dbstring;
     }
     if (empty($dbuser)) {
         $this->dbuser = \Idno\Core\Idno::site()->config()->dbuser;
     }
     if (empty($dbpass)) {
         $this->dbpass = \Idno\Core\Idno::site()->config()->dbpass;
     }
     if (empty($dbname)) {
         $this->dbname = \Idno\Core\Idno::site()->config()->dbname;
     }
     if (empty($dbauthsrc)) {
         $this->dbauthsrc = \Idno\Core\Idno::site()->config()->dbauthsrc;
     }
     parent::__construct();
 }
Example #3
0
 function __construct($dbuser = null, $dbpass = null, $dbname = null, $dbhost = null, $dbport = null)
 {
     $this->dbuser = $dbuser;
     $this->dbpass = $dbpass;
     $this->dbname = $dbname;
     $this->dbhost = $dbhost;
     $this->dbport = $dbport;
     if (empty($dbuser)) {
         $this->dbuser = \Idno\Core\Idno::site()->config()->dbuser;
     }
     if (empty($dbpass)) {
         $this->dbpass = \Idno\Core\Idno::site()->config()->dbpass;
     }
     if (empty($dbname)) {
         $this->dbname = \Idno\Core\Idno::site()->config()->dbname;
     }
     if (empty($dbhost)) {
         $this->dbhost = \Idno\Core\Idno::site()->config()->dbhost;
     }
     if (empty($dbport)) {
         $this->dbport = \Idno\Core\Idno::site()->config()->dbport;
     }
     parent::__construct();
 }