本文整理匯總了PHP中Scalr::errorHandler方法的典型用法代碼示例。如果您正苦於以下問題:PHP Scalr::errorHandler方法的具體用法?PHP Scalr::errorHandler怎麽用?PHP Scalr::errorHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Scalr
的用法示例。
在下文中一共展示了Scalr::errorHandler方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run1
protected function run1($stage)
{
$this->console->out(sprintf("Reencrypting %s database from %s/%s to %s/%s!", \Scalr::getContainer()->config->get('scalr.connections.mysql.name'), $this->source->getCryptoAlgo(), $this->source->getCipherMode(), $this->target->getCryptoAlgo(), $this->target->getCipherMode()));
set_error_handler(function ($code, $message, $file, $line, $context) {
\Scalr::errorHandler($code, $message, $file, $line, $context);
if ($code == E_STRICT) {
throw new Exception($message);
}
}, E_USER_ERROR | E_STRICT | E_RECOVERABLE_ERROR | E_ERROR);
try {
$this->db->Execute('START TRANSACTION;');
$this->recrypt('ssh_keys', ['private_key', 'public_key']);
$this->recrypt('services_ssl_certs', ['ssl_pkey', 'ssl_pkey_password']);
$this->recrypt('account_user_settings', ['value'], "WHERE `name` = 'security.2fa.ggl.key'", ['user_id', 'name']);
$this->recrypt('services_chef_servers', ['auth_key', 'v_auth_key']);
$this->recrypt('variables', ['value'], '', ['name'], $this->globals);
$this->recrypt('account_variables', ['value'], '', ['name', 'account_id'], $this->globals);
$this->recrypt('client_environment_variables', ['value'], '', ['name', 'env_id'], $this->globals);
$this->recrypt('role_variables', ['value'], '', ['name', 'role_id'], $this->globals);
$this->recrypt('farm_variables', ['value'], '', ['name', 'farm_id'], $this->globals);
$this->recrypt('farm_role_variables', ['value'], '', ['name', 'farm_role_id'], $this->globals);
$this->recrypt('server_variables', ['value'], '', ['name', 'server_id'], $this->globals);
$reflection = new ReflectionClass('Scalr_Environment');
$method = $reflection->getMethod('getEncryptedVariables');
$method->setAccessible(true);
$this->recrypt('client_environment_properties', ['value'], "WHERE `name` IN ('" . implode("','", array_keys($method->invoke(null))) . "')");
$this->db->Execute("COMMIT;");
} catch (\Exception $e) {
$this->rollback($e->getCode(), $e->getMessage());
restore_error_handler();
throw $e;
}
restore_error_handler();
}