本文整理汇总了PHP中Application::getDbConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getDbConnection方法的具体用法?PHP Application::getDbConnection怎么用?PHP Application::getDbConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getDbConnection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($moduleName)
{
$con = Application::getDbConnection();
$con->queryExecute("INSERT INTO b_module(ID) VALUES('" . $con->getSqlHelper()->forSql($moduleName) . "')");
self::$installedModules = array();
$cacheManager = Application::getInstance()->getManagedCache();
$cacheManager->clean("b_module");
}
示例2: __construct
public function __construct()
{
$this->_configMain = Registry::get('main', 'config');
$this->_lang = Lang::lang();
$this->_db = Application::getDbConnection();
$this->_config = Config::factory(Config::File_Array, $this->_configMain['configs'] . 'designer.php');
$this->_session = Store_Session::getInstance('Designer');
$this->_storage = Designer_Storage::getInstance($this->_config->get('storage'), $this->_config);
}
示例3: loadEventHandlers
private function loadEventHandlers()
{
$cache = Application::getInstance()->getManagedCache();
if ($cache->read(3600, self::$cacheKey)) {
$arEvents = $cache->get(self::$cacheKey);
} else {
$arEvents = array();
$con = Application::getDbConnection();
$rs = $con->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM b_module_to_module m2m\n\t\t\t\t\tINNER JOIN b_module m ON (m2m.TO_MODULE_ID = m.ID)\n\t\t\t\tORDER BY SORT\n\t\t\t");
while ($ar = $rs->fetch()) {
$ar['TO_NAME'] = $this->formatEventName(array("MODULE_ID" => $ar["TO_MODULE_ID"], "CLASS" => $ar["TO_CLASS"], "METHOD" => $ar["TO_METHOD"]));
$ar["~FROM_MODULE_ID"] = strtoupper($ar["FROM_MODULE_ID"]);
$ar["~MESSAGE_ID"] = strtoupper($ar["MESSAGE_ID"]);
if (strlen($ar["TO_METHOD_ARG"]) > 0) {
$ar["TO_METHOD_ARG"] = unserialize($ar["TO_METHOD_ARG"]);
} else {
$ar["TO_METHOD_ARG"] = array();
}
$arEvents[] = $ar;
}
$cache->set(self::$cacheKey, $arEvents);
}
if (!is_array($arEvents)) {
$arEvents = array();
}
$handlers = $this->handlers;
foreach ($arEvents as $ar) {
$this->handlers[$ar["~FROM_MODULE_ID"]][$ar["~MESSAGE_ID"]][] = array("SORT" => $ar["SORT"], "MODULE_ID" => $ar["TO_MODULE_ID"], "PATH" => $ar["TO_PATH"], "CLASS" => $ar["TO_CLASS"], "METHOD" => $ar["TO_METHOD"], "METHOD_ARG" => $ar["TO_METHOD_ARG"], "VERSION" => $ar["VERSION"], "NAME" => $ar["TO_NAME"]);
}
// need to re-sort because of AddEventHandler() calls
$funcSort = create_function('$a, $b', 'if ($a["SORT"] == $b["SORT"]) return 0; return ($a["SORT"] < $b["SORT"]) ? -1 : 1;');
foreach (array_keys($handlers) as $moduleId) {
foreach (array_keys($handlers[$moduleId]) as $event) {
uasort($this->handlers[$moduleId][$event], $funcSort);
}
}
$this->isHandlersLoaded = true;
}
示例4: testAction
public function testAction()
{
Application::getDbConnection()->getProfiler()->setEnabled(false);
$this->_tManager->launch(Bgtask_Manager::LAUNCHER_JSON, 'Task_Test', array());
}
示例5: viewDbsyncAction
/**
* Request server db state
* Start background task
*/
public function viewDbsyncAction()
{
$serverId = Request::post('server_id', 'pagecode', '');
if (!strlen($serverId)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$list = $this->_serversConfig->get('list');
if (!isset($list[$serverId])) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
Application::getDbConnection()->getProfiler()->setEnabled(false);
$bgStorage = new Bgtask_Storage_Orm(Model::factory('Bgtask'), Model::factory('Bgtask_Signal'));
$logger = new Bgtask_Log_File($this->_configMain['task_log_path'] . 'syncdb_' . $serverId . '_' . date('d_m_Y__H_i_s'));
$tm = Bgtask_Manager::getInstance();
$tm->setStorage($bgStorage);
$tm->setLogger($logger);
$cfg = $list[$serverId];
$cfg['id'] = $serverId;
$tm->launch(Bgtask_Manager::LAUNCHER_JSON, 'Task_Deploy_Dbsync', $cfg);
}