本文整理汇总了PHP中writeLog函数的典型用法代码示例。如果您正苦于以下问题:PHP writeLog函数的具体用法?PHP writeLog怎么用?PHP writeLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataJson
function getDataJson()
{
if (isset($_GET['sfrom'])) {
$jordanGUID = $_GET['jordanGUID'];
$domain = $_GET['domain'];
$protocol = $_GET['protocol'];
$path = $_GET['path'];
$location = $protocol . $domain . $path;
$sfrom = $_GET['sfrom'];
initConnection($db_config);
//redis 使用
require '../Predis/Autoloader.php';
Predis\Autoloader::register();
$redis = new Predis\Client(array('database' => '0', 'host' => '49.4.129.122', 'port' => 6379));
$datestr = date("Y_m_d_H");
$tableName = "request_" . $datestr;
if ($redis->get("tableName") != $tableName) {
create_request($tableName);
$redis->set("tableName", $tableName);
}
$request_datetime = date('Y-m-d H:i:s', time());
writeLog('../logs/' . $tableName . '.log', "{$jordanGUID}\t{$domain}\t{$location}\t{$request_datetime}\n", "a");
insert_request_entry($jordanGUID, $domain, $location, $sfrom, $request_datetime, $tableName);
insert_request_entry($jordanGUID, $domain, $location, $sfrom, $request_datetime, "request");
//echo "success";
} else {
//echo "failure";
}
}
示例2: saveFile
/**
* Save the revieved XML to file
*
* @param string $xml The xml recieved
* @return boolean True on success or false
*/
function saveFile($xml)
{
global $db;
//In your database, log that you have received new xml data
$db->query("INSERT INTO saved_xml () VALUES ()") or $db->raise_error('Failed saving xml');
// Will use the message we give it + the SQL
$id = $db->insert_id();
//Save the data in a file, and name it using the autoincrement id from your database
$filename = "files/{$id}.xml.gz";
if (move_uploaded_file($xml, $filename)) {
$unzipped_file = 'files/' . $id . '.xml';
system("gunzip {$filename} 2>&1");
if (file_exists($unzipped_file)) {
//file is ready to parse
} else {
writeLog(array(), "Failed to gunzip file " . $filename);
$db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
// Will use the message we give it + the SQL
return false;
}
//echo "The file $filename has been uploaded";
} else {
//echo "There was an error uploading the file, please try again!";
$db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
// Will use the message we give it + the SQL
return false;
}
return true;
}
示例3: clear
/**
* 清除数据表
* @author Mr.Cong <i@cong5.net>
*/
public function clear(Request $request)
{
/**
* 简单的判断,防止恶意执行
*/
$pass = $request->input('auth', '0');
if (md5($pass) != 'ceb8ecf822745c53f78a10c05cf01919') {
echo "Auth failed.";
exit;
}
/*
* 每天定时清空数据库指定的表和日志、标注文件
*/
$dir = './log/';
if ($od = opendir($dir)) {
while (($file = readdir($od)) !== false) {
//跳过当前目录和上一级目录
if (in_array($file, array(".", ".."))) {
continue;
}
if (preg_match('/\\.lock/', $file) || preg_match('/(\\w+)\\.html/', $file)) {
unlink($dir . $file);
}
}
}
DB::table('news')->truncate();
DB::table('forums')->truncate();
writeLog(date('Y-m-d H:i:s') . " Clear table and log file.");
/*
* 退出
*/
print 0;
exit;
}
示例4: updatePicture
/** \brief Updates database ticket with stored image url
* \param picture_url Part of URL to the image
* \param upload_dir Directory in which the images are stored
* \param interaction_id Ticket identifier for updated image
* \returns Successful database update or unsuccessful
*/
function updatePicture($picture_url, $upload_dir, $interaction_id)
{
try {
require "/var/database_config.php";
$pdo = new PDO('mysql:host=' . $db_config['host'] . ';dbname=' . $db_config['dbname'], $db_config['username'], $db_config['password']);
$sql_str = "SELECT image from tickets WHERE interaction_id = ?";
$statement = $pdo->prepare($sql_str);
$statement->execute(array($interaction_id));
$picture = $statement->fetch(PDO::FETCH_ASSOC);
if ($picture['image'] !== NULL) {
$temp = explode("/", $picture['image']);
$file = end($temp);
$picture_path = $upload_dir . $file;
if (file_exists($picture_path)) {
if (unlink($picture_path)) {
//return array('status' => 'File deleted');
}
}
}
$sql_str = "UPDATE tickets SET image = ? WHERE interaction_id = ?";
$statement = $pdo->prepare($sql_str);
$statement->execute(array($picture_url, $interaction_id));
$logs = array();
$logs[] = "Image added to ticket.";
require "../log.php";
writeLog($interaction_id, $logs);
return array('status' => 'Successful image update');
} catch (PDOException $e) {
return array('error' => 'Error updating the image in the database');
}
}
示例5: kataDebugOutput
/**
* replace internal katadebug-function
*/
function kataDebugOutput($var = null, $isTable = false)
{
if (!$isTable) {
writeLog(var_export($var, true), 'boot');
} else {
$widths = array();
foreach ($var as $line) {
$cellNo = 0;
foreach ($line as $cell) {
if (!isset($widths[$cellNo])) {
$widths[$cellNo] = 0;
}
$widths[$cellNo] = max($widths[$cellNo], strlen($cell));
$cellNo++;
}
}
$output = "\n";
foreach ($var as $line) {
$s = '';
$cellNo = 0;
foreach ($line as $cell) {
$s .= $cell . str_repeat(' ', $widths[$cellNo] - strlen($cell)) . ' | ';
$cellNo++;
}
$output .= $s . "\n";
}
writeLog($output, 'boot');
}
}
示例6: RatepayRequestAction
/**
* RatePAY action method handles payment request
*/
public function RatepayRequestAction()
{
include_once dirname(__FILE__) . '/../../Views/Frontend/Ratenrechner/php/pi_ratepay_xml_service.php';
Shopware()->Session()->pi_ratepay_Confirm = false;
$user = $this->getUser();
$payName = $this->getPaymentShortName();
$ratepay = new pi_ratepay_xml_service();
$ratepay->live = checkSandboxMode($payName);
$request = $ratepay->getXMLObject();
setRatepayHead($request, 'PAYMENT_REQUEST', $user);
if ($payName == 'RatePAYInvoice') $content = setRatepayContent($request, 'rechnung');
elseif ($payName == 'RatePAYDebit') $content = setRatepayContent($request, 'directDebit');
else $content = setRatepayContent($request, 'ratenzahlung');
$customer = $user['billingaddress']['firstname'] . ' ' . $user['billingaddress']['lastname'];
$response = $ratepay->paymentOperation($request);
if($payName == 'RatePAYDebit' ||($payName == 'RatePAYRate' && Shopware()->Session()->RatepayDirectDebit))
$request = checkBankDataSave($request, $user);
writeLog("", Shopware()->Session()->pi_ratepay_transactionID, "PAYMENT_REQUEST", "", $request, $response, $customer, $payName);
if ($response && (string) $response->head->processing->status->attributes()->code == "OK"
&& (string) $response->head->processing->result->attributes()->code == "402"
) {
Shopware()->Session()->pi_ratepay_rechnung_descriptor = (string) $response->content->payment->descriptor;
return $this->forward('end');
} else {
Shopware()->Session()->pi_ratepay_no_ratepay = true;
$sql = "SELECT `userID` FROM `s_user_billingaddress` WHERE `id` = ?";
$userID = Shopware()->Db()->fetchOne($sql, array((int)$user['billingaddress']['userID']));
$sql = "UPDATE `s_user` SET `paymentID` = ? WHERE `id` = ?";
Shopware()->Db()->query($sql, array((int)Shopware()->Config()->Defaultpayment, (int)$userID));
$this->saveStats(false);
return $this->redirect(array('controller' => 'account', 'action' => 'payment', 'sTarget' => 'checkout', 'forceSecure' => true));
}
}
示例7: addEntry
public function addEntry($data, $program)
{
$entry = new Entry();
$entry->fromData($data, $program);
array_push($this->entries, $entry);
writeLog('Loaded entry for program ' . $program->id . ' (', $program->year . ')');
return $entry;
}
示例8: displayChunk
/**
*
* @param type $file_path
*/
function displayChunk($file_path)
{
writeLog($file_path);
if (is_file($file_path)) {
readfile($file_path);
} else {
writeLog("ERROR ! Invalid path " . $file_path);
}
}
示例9: check_for_configfile
function check_for_configfile()
{
if (!file_exists(absolute_path('config.xml'))) {
if (file_exists(absolute_path('cofig.xml-dist'))) {
writeLog('Vor der Nutzung »config.xml-dist« in »config.xml« umbennen und anpassen.', FAIL);
die;
} else {
writeLog('Konfigurationsdatei »config.xml« nicht vorhanden.', FAIL);
die;
}
}
}
示例10: aopclient_request_execute
/**
* 使用SDK执行接口请求
* @param unknown $request
* @param string $token
* @return Ambigous <boolean, mixed>
*/
function aopclient_request_execute($request, $token = NULL)
{
require 'config.php';
$aop = new AopClient();
$aop->gatewayUrl = $config['gatewayUrl'];
$aop->appId = $config['app_id'];
$aop->rsaPrivateKeyFilePath = $config['merchant_private_key_file'];
$aop->apiVersion = "1.0";
$result = $aop->execute($request, $token);
writeLog("response: " . var_export($result, true));
return $result;
}
示例11: execute
public function execute($query_str, $params = [])
{
if ($this->mysql === false) {
return false;
}
$query = $this->getQuerySTR($query_str, $params);
$this->last_query = $query;
if (!$this->mysql->real_query($query)) {
$this->last_error = $this->mysql->error;
writeLog("SQL Error:\n\t" . $this->last_error . "\n\tQuery: " . $this->last_query);
return false;
}
return true;
}
示例12: EmailErrorHandler
function EmailErrorHandler($FXErrorObj)
{
//if error not written to log
if (checkLog() == false) {
//send email to admins
EmailError($FXErrorObj->message);
}
//write it
writeLog($FXErrorObj->message);
if (DISPLAY_ERROR_MESSAGES) {
echo $FXErrorObj->message;
}
return true;
}
示例13: saveData
/**
* 保存数据进数据库
* @param $data
* @author Mr.Cong <i@cong5.net>
*/
public function saveData($data)
{
DB::table('news')->truncate();
foreach ($data['items'] as $key => $item) {
$News = new News();
$News->title = $item->get_title();
$News->tag = $this->tag;
$News->link = $item->get_link();
$News->description = html_entity_decode($item->get_description(), ENT_COMPAT);
$News->category = $item->get_category()->get_term();
$News->author = $item->get_author()->get_name();
$News->pubDate = strtotime($item->get_date());
$News->content = html_entity_decode($item->get_content(), ENT_COMPAT);
$News->save();
}
writeLog('Save data to database.');
}
示例14: readResp
function readResp()
{
//freadで応答が無いと止まってしまうので非同期モードにする
stream_set_blocking($this->pipes[1], 0);
$read_str = fread($this->pipes[1], 8192);
if ($read_str === FALSE) {
$this->close(FALSE);
$info_msg = 'ERROR: SSH fread failed.';
writeLog(0, "59Y", $info_msg);
return FALSE;
}
if ($this->stdout) {
//デバッグ用
echo $read_str, "\n";
}
return $read_str;
}
示例15: processMessage
function processMessage($msg)
{
global $messageCounter;
echo "Processing Message Number = {$messageCounter}. Press CTRL+C to stop processing\n";
$messageCounter++;
if (isset($msg)) {
$dataArray = json_decode($msg->body, true);
if (is_array($dataArray)) {
writeLog($dataArray, LOG_SMS_FOR_NON_PAUSE);
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
} else {
writeLog('Invalid JSON', LOG_PROCESS_INCOMING);
}
} else {
writeLog('Invalid Message Parameter in Callback', LOG_PROCESS_INCOMING);
}
}