private function loadModl() { // We load Movim Data Layer $db = Modl\Modl::getInstance(); $db->setModelsPath(APP_PATH . 'models'); Modl\Utils::loadModel('Config'); Modl\Utils::loadModel('Presence'); Modl\Utils::loadModel('Contact'); Modl\Utils::loadModel('Privacy'); Modl\Utils::loadModel('RosterLink'); Modl\Utils::loadModel('Cache'); Modl\Utils::loadModel('Postn'); Modl\Utils::loadModel('Subscription'); Modl\Utils::loadModel('Caps'); Modl\Utils::loadModel('Item'); Modl\Utils::loadModel('Message'); Modl\Utils::loadModel('Sessionx'); Modl\Utils::loadModel('Conference'); if (file_exists(DOCUMENT_ROOT . '/config/db.inc.php')) { require DOCUMENT_ROOT . '/config/db.inc.php'; } else { throw new MovimException('Cannot find config/db.inc.php file'); } $db->setConnectionArray($conf); $db->connect(); return true; }
use Movim\Bootstrap; use React\EventLoop\Factory; use React\Socket\Server as Reactor; define('DOCUMENT_ROOT', dirname(__FILE__)); $bootstrap = new Bootstrap(); $booted = $bootstrap->boot(); $argsize = count($argv); if ($argsize == 1) { echo colorize("Please specify a base uri eg.", "red") . colorize(" http://myhost.com/movim/\n", 'yellow'); exit; } if ($argsize == 2) { echo colorize("Please specify a port eg.", "red") . colorize(" 8080\n", 'yellow'); exit; } $md = Modl\Modl::getInstance(); $infos = $md->check(); if ($infos != null) { echo colorize("The database need to be updated before running the daemon\n", 'green'); foreach ($infos as $i) { echo colorize($i . "\n", 'blue'); } echo colorize("\nTo update the database run\n", 'green'); echo colorize("php mud.php db --set\n", 'purple'); exit; } $loop = Factory::create(); $core = new Core($loop, $argv[1], $argv[2]); $app = new HttpServer(new WsServer($core)); $socket = new Reactor($loop); $socket->listen($argv[2], '127.0.0.1');
private function startingSession() { $s = \Sessionx::start(); $s->load(); $user = new User(); $db = Modl\Modl::getInstance(); $db->setUser($user->getLogin()); }