本文整理汇总了PHP中Log::fatal方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::fatal方法的具体用法?PHP Log::fatal怎么用?PHP Log::fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::fatal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callRest
/**
* sends POST request to REST service via CURL
* @param string $url URL to call
* @param string $postArgs POST args
*/
public function callRest($url, $postArgs)
{
if (!function_exists("curl_init")) {
$this->last_error = 'ERROR_NO_CURL';
Log::fatal("REST call failed - no cURL!");
return false;
}
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
Log::debug("HTTP client call: {$url} -> {$postArgs}");
$response = curl_exec($curl);
if ($response === false) {
$this->last_error = 'ERROR_REQUEST_FAILED';
$curl_errno = curl_errno($curl);
$curl_error = curl_error($curl);
Log::error("HTTP client: cURL call failed: error {$curl_errno}: {$curl_error}");
return false;
}
Log::debug("HTTP client response: {$response}");
curl_close($curl);
return $response;
}
示例2: sendmail
public static function sendmail($toList, $subject, $content)
{
$mail = new \PHPMailer();
$mail->isSMTP();
$mail->Host = self::SMTP_HOST;
$mail->SMTPAuth = true;
$mail->Username = self::SMTP_USER;
$mail->Password = self::SMTP_PASSWD;
$mail->SMTPSecure = self::SMTP_SECURE;
$mail->Port = self::SMTP_PORT;
$mail->Timeout = 3;
// seconds
$mail->From = self::MAIL_FROM;
$mail->CharSet = 'utf-8';
$mail->FromName = 'xxx';
// TODO
foreach ($toList as $to) {
$mail->addAddress($to);
}
//$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $content;
$mail->AltBody = $content;
if (!$mail->send()) {
Log::fatal('mailer error: ' . $mail->ErrorInfo);
return false;
}
return true;
}
示例3: tableColumns
function tableColumns($table_name)
{
Log::fatal('********TABLE PASSED******* ' . $table_name);
global $sugar_config;
global $setup_db_database_name;
global $setup_db_host_name;
global $setup_db_host_instance;
global $setup_db_admin_user_name;
global $setup_db_admin_password;
//$db = &DBManagerFactory::getInstance('information_schema');
$db_name = $sugar_config['dbconfig']['db_name'];
$setup_db_host_name = $sugar_config['dbconfig']['db_host_name'];
$setup_db_admin_user_name = $sugar_config['dbconfig']['db_user_name'];
$setup_db_host_instance = $sugar_config['dbconfig']['db_host_instance'];
$setup_db_admin_password = $sugar_config['dbconfig']['db_password'];
$link = @mysql_connect($setup_db_host_name, $setup_db_admin_user_name, $setup_db_admin_password);
mysql_select_db('information_schema');
$qu = "SELECT column_name FROM information_schema.columns WHERE table_schema = '" . $db_name . "' AND table_name = '" . $table_name . "'";
$ct = mysql_query($qu, $link);
//$cols= '';
$colsDrop = array();
while ($row = mysql_fetch_assoc($ct)) {
$colsDrop[] = $row['column_name'];
}
return $colsDrop;
}
示例4: getController
public function getController()
{
if ($this->controller == null) {
Log::fatal('Not found the controller: [%s]', var_export($this->controller, 1));
trigger_error('Not found the controller: [' . var_export($this->controller, 1) . ']', E_USER_ERROR);
}
return $this->controller;
}
示例5: LogAction
public function LogAction()
{
Log::fatal('something');
Log::warn('something');
Log::notice('something');
Log::debug('something');
Log::sql('something');
echo '请到Log文件夹查看效果。如果是SAE环境,可以在日志中心的DEBUG日志查看。';
}
示例6: display
public function display()
{
if (!isset($this->view_object_map['jsonData']) || !is_array($this->view_object_map['jsonData'])) {
Log::fatal("JSON data has not been passed from Calendar controller");
sugar_cleanup(true);
}
$jsonData = $this->view_object_map['jsonData'];
ob_clean();
echo json_encode($jsonData);
}
示例7: load
public static function load($class)
{
if (!in_array($class, self::$valid)) {
Log::fatal('Not a valid class. class:[%s]', var_export($class, 1));
trigger_error('Not a valid class. class:[' . var_export($class, 1) . ']', E_USER_ERROR);
}
if (empty(self::$loaded[$class])) {
self::$loaded[$class] = new $class();
}
return self::$loaded[$class];
}
示例8: halt
/**
* 终止程序运行
* @param string $str 终止原因
* @param bool $display 是否显示调用栈,默认不显示
* @return void
*/
function halt($str, $display = false)
{
Log::fatal($str . ' debug_backtrace:' . var_export(debug_backtrace(), true));
header("Content-Type:text/html; charset=utf-8");
if ($display) {
echo "<pre>";
debug_print_backtrace();
echo "</pre>";
}
echo $str;
exit;
}
示例9: process
public function process()
{
if ($this->field_data['tmp_name'] !== '') {
$destination = BASE_PATH . '/' . $this->settings['destination'];
$filename = File::cleanFilename($this->field_data['name']);
if (File::upload($this->field_data['tmp_name'], $destination, $filename)) {
return Path::tidy('/' . $this->settings['destination'] . '/' . $filename);
} else {
Log::fatal($this->field_data['tmp_name'] . ' could up not be uploaded to ' . $destination, 'core');
return '';
}
}
}
示例10: loadStructure
/**
* Loads the structure cache into the local structure variable if not done yet
*
* @return void
* @throws Exception
*/
public static function loadStructure()
{
if (self::$structure_loaded) {
return;
}
self::$structure_loaded = true;
self::$structure = unserialize(File::get(Path::tidy(BASE_PATH . "/_cache/_app/content/structure.php")));
if (!is_array(self::$structure)) {
// something has gone wrong, log a message and set to an empty array
self::$cache = array();
Log::fatal('Could not find or access your cache. Try checking your file permissions.', 'core', 'ContentService');
throw new Exception('Could not find or access your cache. Try checking your file permissions.');
}
}
示例11: dispatch
public static function dispatch(Router $router)
{
// ob_start();
$className = ucfirst($router->getController()) . 'Controller';
$actionName = $router->getAction() . 'Action';
$controllerFile = CONTROLLER_DIR . '/' . $className . '.class.php';
if (file_exists($controllerFile)) {
include_once $controllerFile;
$app = new $className($router->getParams(), $router->getController());
$app->{$actionName}();
// $output = ob_get_clean();
// echo $output;
} else {
// throw new Exception('Controller not found. className:['.$className.']');
Log::fatal('Controller not found. className:[%s]', var_export($className, 1));
trigger_error('Controller not found. className:[' . var_export($className, 1) . ']', E_USER_ERROR);
}
}
示例12: __construct
/**
* One2MRelationship constructor.
*
* @param array $def
*/
public function __construct($def)
{
global $dictionary;
$this->def = $def;
$this->name = $def['name'];
$this->selfReferencing = $def['lhs_module'] == $def['rhs_module'];
$lhsModule = $def['lhs_module'];
$rhsModule = $def['rhs_module'];
if ($this->selfReferencing) {
$links = VardefManager::getLinkFieldForRelationship($lhsModule, BeanFactory::getObjectName($lhsModule), $this->name);
if (empty($links)) {
Log::fatal("No Links found for relationship {$this->name}");
} else {
if (!is_array($links)) {
//Only one link for a self referencing relationship, this is very bad.
$this->lhsLinkDef = $this->rhsLinkDef = $links;
} else {
if (!empty($links[0]) && !empty($links[1])) {
if (!empty($links[0]['side']) && $links[0]['side'] == "right" || !empty($links[0]['link_type']) && $links[0]['link_type'] == "one") {
//$links[0] is the RHS
$this->lhsLinkDef = $links[1];
$this->rhsLinkDef = $links[0];
} else {
//$links[0] is the LHS
$this->lhsLinkDef = $links[0];
$this->rhsLinkDef = $links[1];
}
}
}
}
} else {
$this->lhsLinkDef = VardefManager::getLinkFieldForRelationship($lhsModule, BeanFactory::getObjectName($lhsModule), $this->name);
$this->rhsLinkDef = VardefManager::getLinkFieldForRelationship($rhsModule, BeanFactory::getObjectName($rhsModule), $this->name);
if (!isset($this->lhsLinkDef['name']) && isset($this->lhsLinkDef[0])) {
$this->lhsLinkDef = $this->lhsLinkDef[0];
}
if (!isset($this->rhsLinkDef['name']) && isset($this->rhsLinkDef[0])) {
$this->rhsLinkDef = $this->rhsLinkDef[0];
}
}
$this->lhsLink = $this->lhsLinkDef['name'];
$this->rhsLink = $this->rhsLinkDef['name'];
}
示例13: display
function display($name, $xmlFile, $width = '320', $height = '480', $resize = false)
{
$this->chartId = $name;
$this->height = $height;
$this->width = $width;
$this->xmlFile = $xmlFile;
$this->chartType = $this->chart_properties['type'];
$style = array();
$chartConfig = array();
try {
$xmlStr = $this->processXML($this->xmlFile);
$json = $this->buildJson($xmlStr);
} catch (Exception $e) {
Log::fatal("Unable to return chart data, invalid xml for file {$this->xmlFile}");
return '';
}
$this->saveJsonFile($json);
$this->ss->assign("chartId", $this->chartId);
$this->ss->assign("filename", $this->jsonFilename);
global $mod_strings, $app_strings;
if (isset($mod_strings['LBL_REPORT_SHOW_CHART'])) {
$this->ss->assign("showchart", $mod_strings['LBL_REPORT_SHOW_CHART']);
}
$dimensions = $this->getChartDimensions($xmlStr);
$this->ss->assign("width", $dimensions['width']);
$this->ss->assign("height", $dimensions['height']);
$config = $this->getConfigProperties();
$style['gridLineColor'] = str_replace("0x", "#", $config->gridLines);
$style['font-family'] = $config->labelFontFamily;
$style['color'] = str_replace("0x", "#", $config->labelFontColor);
$this->ss->assign("css", $style);
foreach ($this->getChartConfigParams($xmlStr) as $key => $value) {
$chartConfig[$key] = $value;
}
$chartConfig['imageExportType'] = $this->image_export_type;
$this->ss->assign("config", $chartConfig);
if ($json == "No Data") {
$this->ss->assign("error", $app_strings['LBL_NO_DATA']);
}
if (!$this->isSupported($this->chartType)) {
$this->ss->assign("error", "Unsupported Chart Type");
}
}
示例14: loadUserOnLogin
/**
* this is called when a user logs in
*
* @param STRING $name
* @param STRING $password
* @return boolean
*/
function loadUserOnLogin($name, $password)
{
global $login_error;
Log::debug("Starting user load for " . $name);
if (empty($name) || empty($password)) {
return false;
}
if (empty($_SESSION['lastUserId'])) {
$input_hash = SugarAuthenticate::encodePassword($password);
$user_id = $this->authenticateUser($name, $input_hash);
if (empty($user_id)) {
Log::fatal('SECURITY: User authentication for ' . $name . ' failed');
return false;
}
}
if (empty($_SESSION['emailAuthToken'])) {
$_SESSION['lastUserId'] = $user_id;
$_SESSION['lastUserName'] = $name;
$_SESSION['emailAuthToken'] = '';
for ($i = 0; $i < $this->passwordLength; $i++) {
$_SESSION['emailAuthToken'] .= chr(mt_rand(48, 90));
}
$_SESSION['emailAuthToken'] = str_replace(array('<', '>'), array('#', '@'), $_SESSION['emailAuthToken']);
$_SESSION['login_error'] = 'Please Enter Your User Name and Emailed Session Token';
$this->sendEmailPassword($user_id, $_SESSION['emailAuthToken']);
return false;
} else {
if (strcmp($name, $_SESSION['lastUserName']) == 0 && strcmp($password, $_SESSION['emailAuthToken']) == 0) {
$this->loadUserOnSession($_SESSION['lastUserId']);
unset($_SESSION['lastUserId']);
unset($_SESSION['lastUserName']);
unset($_SESSION['emailAuthToken']);
return true;
}
}
$_SESSION['login_error'] = 'Please Enter Your User Name and Emailed Session Token';
return false;
}
示例15: checkTempImage
function checkTempImage($path)
{
if (!verify_uploaded_image($path)) {
$error = translate('LBL_ALERT_TYPE_IMAGE');
Log::fatal("A user ({$GLOBALS['current_user']->id}) attempted to use an invalid file for the logo - {$path}");
$this->error = $error;
return false;
}
return $path;
}