本文整理汇总了PHP中log_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP log_debug函数的具体用法?PHP log_debug怎么用?PHP log_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess_file
/**
* Gets file information out of $_FILES and stores it locally in $files.
* Checks file against max upload file size.
* Scans file for viruses.
* @return false for no errors, or a string describing the error
*/
function preprocess_file()
{
$name = $this->inputname;
if (!isset($_FILES[$name])) {
return get_string('noinputnamesupplied');
}
$file = $_FILES[$name];
$maxsize = get_config('maxuploadsize');
if ($maxsize && $file['size'] > $maxsize) {
return get_string('uploadedfiletoobig');
}
if ($file['error'] != UPLOAD_ERR_OK) {
$errormsg = get_string('phpuploaderror', 'mahara', get_string('phpuploaderror_' . $file['error']), $file['error']);
log_debug($errormsg);
if ($file['error'] == UPLOAD_ERR_NO_TMP_DIR || $file['error'] == UPLOAD_ERR_CANT_WRITE) {
// The admin probably needs to fix this; notify them
// @TODO: Create a new activity type for general admin messages.
$message = (object) array('users' => get_column('usr', 'id', 'admin', 1), 'subject' => get_string('adminphpuploaderror'), 'message' => $errormsg);
require_once 'activity.php';
activity_occurred('maharamessage', $message);
} else {
if ($file['error'] == UPLOAD_ERR_INI_SIZE || $file['error'] == UPLOAD_ERR_FORM_SIZE) {
return get_string('uploadedfiletoobig');
}
}
}
if (!is_uploaded_file($file['tmp_name'])) {
return get_string('notphpuploadedfile');
}
if (get_config('viruschecking') && ($errormsg = mahara_clam_scan_file($file))) {
return $errormsg;
}
$this->file = $file;
return false;
}
示例2: configure
/**
* Initialize instance
*
* @param Charcoal_Config $config configuration data
*/
public function configure($config)
{
parent::configure($config);
$session_name = $config->getString('session_name', '');
$save_path = $config->getString('save_path', '', TRUE);
$lifetime = $config->getInteger('lifetime', 0);
$valid_path = $config->getString('valid_path', '');
$valid_domain = $config->getString('valid_domain', '');
$ssl_only = $config->getBoolean('ssl_only', FALSE);
$save_path = us($save_path);
$lifetime = ui($lifetime);
$ssl_only = ub($ssl_only);
$session_name = us($session_name);
// デフォルトのセッション保存先
if (!$save_path || !is_dir($save_path)) {
$save_path = Charcoal_ResourceLocator::getApplicationPath('sessions');
}
// セッション初期化処理
// session_set_cookie_params( $lifetime, "$valid_path", "$valid_domain", $ssl_only );
session_save_path($save_path);
// $session_name = session_name( $session_name ? $session_name : APPLICATION );
session_name("PHPSESSID");
//session_regenerate_id( TRUE );
if ($this->getSandbox()->isDebug()) {
log_debug("session", "session_name:{$session_name}", self::TAG);
log_debug("session", "save_path:{$save_path}", self::TAG);
log_debug("session", "lifetime:{$lifetime}", self::TAG);
log_debug("session", "valid_path:{$valid_path}", self::TAG);
log_debug("session", "valid_domain:{$valid_domain}", self::TAG);
log_debug("session", "ssl_only:{$ssl_only}", self::TAG);
}
// メンバーに保存
$this->save_path = $save_path;
}
示例3: onPageRequest
public function onPageRequest(PageRequestEvent $event)
{
global $config, $page;
// hax.
if ($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
$h_pagename = html_escape(implode('/', $event->args));
$f_pagename = preg_replace("/[^a-z_\\-\\.]+/", "_", $h_pagename);
$theme_name = $config->get_string("theme", "default");
if (file_exists("themes/{$theme_name}/{$f_pagename}") || file_exists("lib/static/{$f_pagename}")) {
$filename = file_exists("themes/{$theme_name}/{$f_pagename}") ? "themes/{$theme_name}/{$f_pagename}" : "lib/static/{$f_pagename}";
$page->add_http_header("Cache-control: public, max-age=600");
$page->add_http_header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT');
$page->set_mode("data");
$page->set_data(file_get_contents($filename));
if (endsWith($filename, ".ico")) {
$page->set_type("image/x-icon");
}
if (endsWith($filename, ".png")) {
$page->set_type("image/png");
}
if (endsWith($filename, ".txt")) {
$page->set_type("text/plain");
}
} else {
log_debug("handle_404", "Hit 404: {$h_pagename}");
$page->set_code(404);
$page->set_title("404");
$page->set_heading("404 - No Handler Found");
$page->add_block(new NavBlock());
$page->add_block(new Block("Explanation", "No handler could be found for the page '{$h_pagename}'"));
}
}
}
示例4: configure
/**
* Initialize instance
*
* @param Charcoal_Config $config configuration data
*/
public function configure($config)
{
parent::configure($config);
$this->_unit = $config->getString('unit', 'mm')->getValue();
$this->_creator = $config->getString('creator', 'CharcoalPHP')->getValue();
$this->_authhor = $config->getString('authhor', 'CharcoalPHP')->getValue();
$this->_zoom = $config->getString('zoom', 'real')->getValue();
$this->_layout = $config->getString('layout', 'continuous')->getValue();
$this->_auto_break = $config->getBoolean('auto_break', TRUE)->getValue();
$this->_auto_break_margin = $config->getInteger('auto_break_margin', 5)->getValue();
$this->_fill_color = $config->getArray('fill_color', array(255, 255, 255))->getValue();
$this->_margin_left = $config->getInteger('margin_left', 10.0)->getValue();
$this->_margin_top = $config->getInteger('margin_left', 10.0)->getValue();
$this->_margin_right = $config->getInteger('margin_left', 10.0)->getValue();
log_debug("debug,pdf", "unit:" . $this->_unit);
log_debug("debug,pdf", "creator:" . $this->_creator);
log_debug("debug,pdf", "authhor:" . $this->_authhor);
log_debug("debug,pdf", "zoom:" . $this->_zoom);
log_debug("debug,pdf", "layout:" . $this->_layout);
log_debug("debug,pdf", "auto_break:" . $this->_auto_break);
log_debug("debug,pdf", "auto_break_margin:" . $this->_auto_break_margin);
log_debug("debug,pdf", "fill_color:" . implode(",", $this->_fill_color));
log_debug("debug,pdf", "margin_left:" . $this->_margin_left);
log_debug("debug,pdf", "margin_top:" . $this->_margin_top);
log_debug("debug,pdf", "margin_right:" . $this->_margin_right);
}
示例5: create_thumb
/**
* Generate the Thumbnail image for particular file.
*
* @param string $hash
* @return bool Returns true on successful thumbnail creation.
*/
protected function create_thumb($hash)
{
global $config;
$ok = false;
switch ($config->get_string("video_thumb_engine")) {
default:
case 'static':
$outname = warehouse_path("thumbs", $hash);
copy("ext/handle_video/thumb.jpg", $outname);
$ok = true;
break;
case 'ffmpeg':
$ffmpeg = escapeshellcmd($config->get_string("thumb_ffmpeg_path"));
$w = (int) $config->get_int("thumb_width");
$h = (int) $config->get_int("thumb_height");
$inname = escapeshellarg(warehouse_path("images", $hash));
$outname = escapeshellarg(warehouse_path("thumbs", $hash));
if ($config->get_bool("video_thumb_ignore_aspect_ratio") == true) {
$cmd = escapeshellcmd("{$ffmpeg} -i {$inname} -ss 00:00:00.0 -f image2 -vframes 1 {$outname}");
} else {
$scale = 'scale="' . escapeshellarg("if(gt(a,{$w}/{$h}),{$w},-1)") . ':' . escapeshellarg("if(gt(a,{$w}/{$h}),-1,{$h})") . '"';
$cmd = "{$ffmpeg} -i {$inname} -vf {$scale} -ss 00:00:00.0 -f image2 -vframes 1 {$outname}";
}
exec($cmd, $output, $returnValue);
if ((int) $returnValue == (int) 1) {
$ok = true;
}
log_debug('handle_video', "Generating thumbnail with command `{$cmd}`, returns {$returnValue}");
break;
}
return $ok;
}
示例6: AddPost
/**
* @attribute[RequestParam('title','string')]
* @attribute[RequestParam('body','string')]
*/
function AddPost($title, $body)
{
log_debug("Add Post");
$ds = model_datasource('system');
$ds->ExecuteSql("INSERT INTO blog(title,body)VALUES(?,?)", array($title, $body));
redirect('blog', 'index');
}
示例7: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
require_once get_config('docroot') . 'artefact/lib.php';
$smarty = smarty_core();
$configdata = $instance->get('configdata');
$data = array();
// add in the selected email address
if (!empty($configdata['email'])) {
$configdata['artefactids'][] = $configdata['email'];
}
// Get data about the profile fields in this blockinstance
if (!empty($configdata['artefactids'])) {
$viewowner = get_field('view', 'owner', 'id', $instance->get('view'));
foreach ($configdata['artefactids'] as $id) {
try {
$artefact = artefact_instance_from_id($id);
if (is_a($artefact, 'ArtefactTypeProfile') && $artefact->get('owner') == $viewowner) {
$rendered = $artefact->render_self(array('link' => true));
$data[$artefact->get('artefacttype')] = $rendered['html'];
}
} catch (ArtefactNotFoundException $e) {
log_debug('Artefact not found when rendering contactinfo block instance. ' . 'There might be a bug with deleting artefacts of this type? ' . 'Original error follows:');
log_debug($e->getMessage());
}
}
}
$smarty->assign('profileinfo', $data);
return $smarty->fetch('blocktype:contactinfo:content.tpl');
}
示例8: process
function process($info)
{
$commit_info = $info['commit_info'];
$module = $info['module'];
$git_path = $info['git_path'];
$svn_path = $info['svn_path'];
if (empty($module) || empty($git_path) || empty($svn_path)) {
log_warning(sprintf("some parameter is invalid. " . "module[%s] git_path[%s] svn_path[%s]", $module, $git_path, $svn_path));
return false;
}
$svn_path_name = basename($svn_path);
if ($svn_path_name != $module) {
log_warning("svn module does not match git module", $svn_path_name, $module);
return false;
}
if ($commit_info['ref'] != 'refs/heads/master') {
log_debug("omit non master commit");
return true;
}
$pwd = dirname(__FILE__);
$cmd = "(source ~/.bashrc && cd {$pwd} && nohup ./git2svn.sh {$module} {$git_path} {$svn_path}) >./log/job.\$\$.log 2>&1 & echo \$!";
exec($cmd, $output, $ret);
log_debug(sprintf("start background sync script. cmd[%s] ret[%s] job-pid[%s]", $cmd, $ret, $output[0]));
if ($ret == 0) {
return true;
} else {
return false;
}
}
示例9: log
public function log($level, &$message) {
switch ($level) {
case LogHelper::LEVEL_DEBUG:
log_debug($message);
break;
case LogHelper::LEVEL_INFO:
log_info($message);
break;
case LogHelper::LEVEL_NOTICE:
log_notice($message);
break;
case LogHelper::LEVEL_WARNING:
log_warn($message);
break;
case LogHelper::LEVEL_ERROR:
log_error($message);
break;
case LogHelper::LEVEL_CRITICAL:
log_critical($message);
break;
case LogHelper::LEVEL_ALERT:
log_alert($message);
break;
case LogHelper::LEVEL_EMERGENCY:
log_emergency($message);
break;
}
}
示例10: log_post
function log_post($log_type, $log_contents, $timestamp = NULL)
{
log_debug("changelog", "Executing log_post({$log_type}, {$log_contents}, {$timestamp})");
// check audit logging
if (!$GLOBALS["config"]["FEATURE_LOGS_AUDIT"] && $log_type == "audit") {
// audit logging is disabled
return 0;
}
// do retention clean check
if ($GLOBALS["config"]["LOG_RETENTION_PERIOD"]) {
// check when we last ran a retention clean
if ($GLOBALS["config"]["LOG_RETENTION_CHECKTIME"] < time() - 86400) {
$this->log_retention_clean();
}
}
if (empty($timestamp)) {
$timestamp = time();
}
// write log
$sql_obj = new sql_query();
$sql_obj->string = "INSERT INTO logs (id_server, id_domain, username, timestamp, log_type, log_contents) VALUES ('" . $this->id_server . "', '" . $this->id_domain . "', '" . $this->username . "', '{$timestamp}', '{$log_type}', '{$log_contents}')";
$sql_obj->execute();
// update last sync on name server
if ($this->id_server) {
$obj_server = new name_server();
$obj_server->id = $this->id_server;
$obj_server->action_update_log_version($timestamp);
}
return 1;
}
示例11: __construct
/**
* Constructor
*
* @access public
*/
function __construct($props = array())
{
if (count($props) > 0) {
$this->initialize($props);
}
log_debug("Upload Class Initialized");
}
示例12: symbolicate
public function symbolicate()
{
$addresses = null;
$targets = null;
$matches = null;
$symbolicated_report = $this->report;
if ($this->appVersion === null) {
preg_match('/^App Version: ([^\\s]+)/m', $symbolicated_report, $matches);
if (!isset($matches[1]) || count($matches[1]) == 0) {
preg_match('/Version:\\s+([\\S]+)\\s+/m', $symbolicated_report, $matches);
}
if (!isset($matches[1]) || count($matches[1]) == 0) {
$msg = "Unknown format of crash or exception report.";
throw new UnknownReportFormatSymbolicatorException($msg);
}
$this->appVersion = $matches[1];
}
$full_path = sprintf("%s/tower1/%s/Tower.app/Contents/MacOS/Tower", RELEASES_DIR, $this->appVersion);
# FIXME
if (!file_exists($full_path)) {
$msg = "Could not find dsym files for product `{$this->appIdentifier}`, version `{$this->appVersion}`. Please copy dsym files to `releases/PRODUCT/VERSION/`.\n\nFull path: `{$full_path}`";
throw new ReleaseNotFoundSymbolicatorException($msg);
}
#
# Find lines like this:
#
# 1 com.fournova.Tower 0x00091c91 0x1000 + 593041
#
# Resolve address and replace starting address (0x1000) with symbolicated name.
#
preg_match_all('/[0-9]+\\s.+\\s(0x[0-9a-f]+)\\s(\\w+\\s\\+\\s[0-9]+)/m', $this->report, $matches);
if (!isset($matches[1]) || count($matches[1]) == 0) {
preg_match_all('/^(0x[0-9a-f]+)$/m', $this->report, $matches);
}
$addresses = $matches[1];
if (isset($matches[2])) {
$targets = $matches[2];
}
$cmd = sprintf("/usr/bin/atos -arch %s -o %s %s", $this->arch, $full_path, implode(' ', $addresses));
log_debug($cmd);
$output = null;
exec($cmd, $output);
foreach ($output as $i => $line) {
if (substr($line, 0, 2) !== '0x') {
$replacement = null;
if ($targets !== null) {
$target = $targets[$i];
// e.g. "0x1000 + 593041"
$tokens = explode(' + ', $target);
$replacement = "{$line} + {$tokens[1]}";
} else {
$target = $addresses[$i];
$replacement = $line;
}
$symbolicated_report = str_replace($target, $replacement, $symbolicated_report);
}
}
return $symbolicated_report;
}
示例13: print_debug
function print_debug($message, $var = 'messageonly', $part = 'app', $level = 3)
{
if ($var == 'messageonly') {
log_debug($message);
} else {
log_debug($message, $var);
}
}
示例14: xmldb_search_elasticsearch_upgrade
function xmldb_search_elasticsearch_upgrade($oldversion = 0)
{
if ($oldversion < 2015012800) {
// Adding indices on the table search_elasticsearch_queue
$table = new XMLDBTable('search_elasticsearch_queue');
$index = new XMLDBIndex('itemidix');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('itemid'));
add_index($table, $index);
}
if ($oldversion < 2015060900) {
log_debug('Add "status" and "lastprocessed" columns to search_elasticsearch_queue table');
$table = new XMLDBTable('search_elasticsearch_queue');
$field = new XMLDBField('status');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
$table = new XMLDBTable('search_elasticsearch_queue');
$field = new XMLDBField('lastprocessed');
$field->setAttributes(XMLDB_TYPE_DATETIME);
add_field($table, $field);
$table = new XMLDBTable('search_elasticsearch_queue');
$index = new XMLDBIndex('statusix');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status'));
add_index($table, $index);
}
if ($oldversion < 2015072700) {
log_debug('Adding ability to search by "Text" blocks in elasticsearch');
// Need to add the 'block_instance' to the default types to index for elasticsearch
// Note: the $cfg->plugin_search_elasticsearch_types can be overriding this
// We don't want to run the re-indexing now as that will take ages for large sites
// It should be run from the Extensions -> Elasticsearch -> Configuration page
if ($types = get_field('search_config', 'value', 'plugin', 'elasticsearch', 'field', 'types')) {
$types = explode(',', $types);
if (!in_array('block_instance', $types)) {
$types[] = 'block_instance';
}
$types = implode(',', $types);
update_record('search_config', array('value' => $types), array('plugin' => 'elasticsearch', 'field' => 'types'));
log_warn(get_string('newindextype', 'search.elasticsearch', 'block_instance'), true, false);
}
}
if ($oldversion < 2015100800) {
log_debug('Adding ability to search by collection in elasticsearch');
// The code for this existed since the beginning but 'collection' was not
// added to the $cfg->plugin_search_elasticsearch_types
// We don't want to run the re-indexing now as that will take ages for large sites
// It should be run from the Extensions -> Elasticsearch -> Configuration page
if ($types = get_field('search_config', 'value', 'plugin', 'elasticsearch', 'field', 'types')) {
$types = explode(',', $types);
if (!in_array('collection', $types)) {
$types[] = 'collection';
}
$types = implode(',', $types);
update_record('search_config', array('value' => $types), array('plugin' => 'elasticsearch', 'field' => 'types'));
log_warn(get_string('newindextype', 'search.elasticsearch', 'collection'), true, false);
}
}
return true;
}
示例15: quotes_render_summarybox
function quotes_render_summarybox($id)
{
log_debug("inc_quotes", "quotes_render_summarybox({$id})");
// fetch quote information
$sql_obj = new sql_query();
$sql_obj->string = "SELECT code_quote, amount_total, date_validtill, date_sent, sentmethod FROM account_quotes WHERE id='{$id}' LIMIT 1";
$sql_obj->execute();
if ($sql_obj->num_rows()) {
$sql_obj->fetch_array();
if ($sql_obj->data[0]["amount_total"] == 0) {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " has no items on it</b>";
print "<p>This quote needs to have some items added to it using the links in the nav menu above.</p>";
print "</td>";
print "</tr>";
print "</table>";
} else {
if (time_date_to_timestamp($sql_obj->data[0]["date_validtill"]) <= time()) {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<p><b>Quote " . $sql_obj->data[0]["code_quote"] . " has now expired and is no longer valid.</b></p>";
print "</td>";
print "</tr>";
print "</table>";
} else {
print "<table width=\"100%\" class=\"table_highlight_important\">";
print "<tr>";
print "<td>";
print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " is currently valid.</b>";
print "<table cellpadding=\"4\">";
print "<tr>";
print "<td>Quote Total:</td>";
print "<td>" . format_money($sql_obj->data[0]["amount_total"]) . "</td>";
print "</tr>";
print "<tr>";
print "<td>Valid Until:</td>";
print "<td>" . $sql_obj->data[0]["date_validtill"] . "</td>";
print "</tr>";
print "<tr>";
print "<td>Date Sent:</td>";
if ($sql_obj->data[0]["sentmethod"] == "") {
print "<td><i>Has not been sent to customer</i></td>";
} else {
print "<td>" . $sql_obj->data[0]["date_sent"] . " (" . $sql_obj->data[0]["sentmethod"] . ")</td>";
}
print "</tr>";
print "</tr></table>";
print "</td>";
print "</tr>";
print "</table>";
}
}
print "<br>";
}
}