本文整理汇总了PHP中core\Database::disconnect方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::disconnect方法的具体用法?PHP Database::disconnect怎么用?PHP Database::disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Database
的用法示例。
在下文中一共展示了Database::disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (@$opts['n']) {
$pid = 0;
// fork mimic
} else {
$pid = pcntl_fork();
}
// parent: $forked == false
// child: $forked == true
$forked = $pid == 0;
// unset($pid);
// parent will die here
if (!$forked) {
exit(1);
}
// Avoid forking connection crash, renew the connection.
Database::disconnect();
// Get maximum allowed connections before table lock.
$capLimit = (int) @conf::get('system::crontab.process_limit');
if (!$capLimit) {
$capLimit = Process::MAXIMUM_CAPACITY;
}
// Start transaction before lock tables.
Database::beginTransaction();
// Pick next awaiting process
Database::locKTables([FRAMEWORK_COLLECTION_PROCESS . ' READ']);
$res = (int) Database::fetchField('SELECT IFNULL(SUM(`capacity`), 0) as occupation
FROM `' . FRAMEWORK_COLLECTION_PROCESS . '`
WHERE `pid` IS NOT NULL AND `pid` > 0');
Database::unlockTables(true);
if ($res >= $capLimit) {
Log::debug('Active processes has occupied maximum server capacity, daemon exits.');