本文整理汇总了PHP中Logging::warn方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::warn方法的具体用法?PHP Logging::warn怎么用?PHP Logging::warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::warn方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findEntries
public static function findEntries($con, $displayColumns, $fromTable, $data, $dataProp = "aaData")
{
$where = array();
/* Holds the parameters for binding after the statement has been
prepared */
$params = array();
if (isset($data['advSearch']) && $data['advSearch'] === 'true') {
$librarySetting = Application_Model_Preference::getCurrentLibraryTableColumnMap();
//$displayColumns[] = 'owner';
// map that maps original column position to db name
$current2dbname = array();
// array of search terms
$orig2searchTerm = array();
foreach ($data as $key => $d) {
if (strstr($key, "mDataProp_")) {
list($dump, $index) = explode("_", $key);
$current2dbname[$index] = $d;
} elseif (strstr($key, "sSearch_")) {
list($dump, $index) = explode("_", $key);
$orig2searchTerm[$index] = $d;
}
}
// map that maps dbname to searchTerm
$dbname2searchTerm = array();
foreach ($current2dbname as $currentPos => $dbname) {
$new_index = $librarySetting($currentPos);
// TODO : Fix this retarded hack later. Just a band aid for
// now at least we print some warnings so that we don't
// forget about this -- cc-4462
if (array_key_exists($new_index, $orig2searchTerm)) {
$dbname2searchTerm[$dbname] = $orig2searchTerm[$new_index];
} else {
Logging::warn("Trying to reorder to unknown index\n printing as much debugging as possible...");
$debug = array('$new_index' => $new_index, '$currentPos' => $currentPos, '$orig2searchTerm' => $orig2searchTerm);
Logging::warn($debug);
}
}
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
if (!empty($advancedWhere['clause'])) {
$where[] = join(" AND ", $advancedWhere['clause']);
$params = $advancedWhere['params'];
}
}
if ($data["sSearch"] !== "") {
$searchTerms = explode(" ", $data["sSearch"]);
}
$selectorCount = "SELECT COUNT(*) ";
$selectorRows = "SELECT " . join(",", $displayColumns) . " ";
$sql = $selectorCount . " FROM " . $fromTable;
$sqlTotalRows = $sql;
if (isset($searchTerms)) {
$searchCols = array();
for ($i = 0; $i < $data["iColumns"]; $i++) {
if ($data["bSearchable_" . $i] == "true") {
$searchCols[] = $data["mDataProp_{$i}"];
}
}
$outerCond = array();
$simpleWhere = array();
foreach ($searchTerms as $term) {
foreach ($searchCols as $col) {
$simpleWhere['clause']["simple_" . $col] = "{$col}::text ILIKE :simple_" . $col;
$simpleWhere['params']["simple_" . $col] = "%" . $term . "%";
}
$outerCond[] = "(" . implode(" OR ", $simpleWhere['clause']) . ")";
}
$where[] = "(" . implode(" AND ", $outerCond) . ")";
$params = array_merge($params, $simpleWhere['params']);
}
// End Where clause
// Order By clause
$orderby = array();
for ($i = 0; $i < $data["iSortingCols"]; $i++) {
$num = $data["iSortCol_" . $i];
$orderby[] = $data["mDataProp_{$num}"] . " " . $data["sSortDir_" . $i];
}
$orderby[] = "id";
$orderby = join(",", $orderby);
// End Order By clause
$displayLength = intval($data["iDisplayLength"]);
$needToBind = false;
if (count($where) > 0) {
$needToBind = true;
$where = join(" OR ", $where);
$sql = $selectorCount . " FROM " . $fromTable . " WHERE " . $where;
$sqlTotalDisplayRows = $sql;
$sql = $selectorRows . " FROM " . $fromTable . " WHERE " . $where . " ORDER BY " . $orderby;
} else {
$sql = $selectorRows . " FROM " . $fromTable . " ORDER BY " . $orderby;
}
//limit the results returned.
if ($displayLength !== -1) {
$sql .= " OFFSET " . $data["iDisplayStart"] . " LIMIT " . $displayLength;
}
try {
//Logging::info($sqlTotalRows);
$r = $con->query($sqlTotalRows);
$totalRows = $r->fetchColumn(0);
if (isset($sqlTotalDisplayRows)) {
//Logging::info("sql is set");
//.........这里部分代码省略.........
示例2: setMetadata
/**
* Set multiple metadata values using defined metadata constants.
*
* @param array $p_md
* example: $p_md['MDATA_KEY_URL'] = 'http://www.fake.com'
*/
public function setMetadata($p_md = null)
{
if (is_null($p_md)) {
$this->setDbColMetadata();
} else {
$dbMd = array();
if (isset($p_md["MDATA_KEY_YEAR"])) {
// We need to make sure to clean this value before
// inserting into database. If value is outside of range
// [-2^31, 2^31-1] then postgresl will throw error when
// trying to retrieve this value. We could make sure
// number is within these bounds, but simplest is to do
// substring to 4 digits (both values are garbage, but
// at least our new garbage value won't cause errors).
// If the value is 2012-01-01, then substring to first 4
// digits is an OK result. CC-3771
$year = $p_md["MDATA_KEY_YEAR"];
if (strlen($year) > 4) {
$year = substr($year, 0, 4);
}
if (!is_numeric($year)) {
$year = 0;
}
$p_md["MDATA_KEY_YEAR"] = $year;
}
# Translate metadata attributes from media monitor (MDATA_KEY_*)
# to their counterparts in constants.php (usually the column names)
foreach ($p_md as $mdConst => $mdValue) {
if (defined($mdConst)) {
$dbMd[constant($mdConst)] = $mdValue;
} else {
Logging::warn("using metadata that is not defined.\n [{$mdConst}] => [{$mdValue}]");
}
}
$this->setDbColMetadata($dbMd);
}
}
示例3: getScheduledStatus
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row)
{
if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) {
$row["scheduled"] = 0;
} elseif ($row["footer"] === true && $this->epoch_now < $p_epochItemEnd) {
$row["scheduled"] = 2;
} elseif ($row["header"] === true && $this->epoch_now >= $p_epochItemStart) {
$row["scheduled"] = 0;
} elseif ($row["header"] === true && $this->epoch_now < $p_epochItemEnd) {
$row["scheduled"] = 2;
} else {
if ($this->epoch_now > $p_epochItemEnd) {
$row["scheduled"] = 0;
} else {
if ($this->epoch_now >= $p_epochItemStart && $this->epoch_now < $p_epochItemEnd) {
$row["scheduled"] = 1;
//how many seconds the view should wait to redraw itself.
$row["refresh"] = $p_epochItemEnd - $this->epoch_now;
} else {
if ($this->epoch_now < $p_epochItemStart) {
$row["scheduled"] = 2;
} else {
Logging::warn("No-op? is this what should happen...printing\n debug just in case");
$d = array('$p_epochItemStart' => $p_epochItemStart, '$p_epochItemEnd' => $p_epochItemEnd, '$row' => $row);
Logging::warn($d);
}
}
}
}
}
示例4: reloadMetadataGroupAction
public function reloadMetadataGroupAction()
{
// extract all file metadata params from the request.
// The value is a json encoded hash that has all the information related to this action
// The key(mdXXX) does not have any meaning as of yet but it could potentially correspond
// to some unique id.
$request = $this->getRequest();
$responses = array();
$params = $request->getParams();
$valid_modes = array('delete_dir', 'delete', 'moved', 'modify', 'create');
foreach ($params as $k => $raw_json) {
// Valid requests must start with mdXXX where XXX represents at
// least 1 digit
if (!preg_match('/^md\\d+$/', $k)) {
continue;
}
$info_json = json_decode($raw_json, $assoc = true);
// Log invalid requests
if (!array_key_exists('mode', $info_json)) {
Logging::info("Received bad request(key={$k}), no 'mode' parameter. Bad request is:");
Logging::info($info_json);
array_push($responses, array('error' => _("Bad request. no 'mode' parameter passed."), 'key' => $k));
continue;
} elseif (!in_array($info_json['mode'], $valid_modes)) {
// A request still has a chance of being invalid even if it
// exists but it's validated by $valid_modes array
$mode = $info_json['mode'];
Logging::info("Received bad request(key={$k}). 'mode' parameter was invalid with value: '{$mode}'. Request:");
Logging::info($info_json);
array_push($responses, array('error' => _("Bad request. 'mode' parameter is invalid"), 'key' => $k, 'mode' => $mode));
continue;
}
// Removing 'mode' key from $info_json might not be necessary...
$mode = $info_json['mode'];
unset($info_json['mode']);
try {
$response = $this->dispatchMetadata($info_json, $mode);
} catch (Exception $e) {
Logging::warn($e->getMessage());
Logging::warn(gettype($e));
}
// We tack on the 'key' back to every request in case the would like to associate
// his requests with particular responses
$response['key'] = $k;
array_push($responses, $response);
}
$this->_helper->json->sendJson($responses);
}
示例5: Logging
* @package HTML_FirstThingsFirst
* @author Jasper de Jong
* @copyright 2007-2012 Jasper de Jong
* @license http://www.opensource.org/licenses/gpl-license.php
*/
require_once "Class.Logging.php";
require_once "../globals.php";
require_once "../localsettings.php";
require_once "Html.Utilities.php";
$logging = new Logging($firstthingsfirst_loglevel, "../logs/" . $firstthingsfirst_logfile);
# the user name has to be given by means of a parameter
if (isset($_GET['user_name'])) {
$file_name = "upload_" . $_GET['user_name'] . strftime("_%d%m%Y_%H%M%S");
} else {
$file_name = "upload_none_" . strftime("%d%m%Y_%H%M%S.csv");
$logging->warn("parameter user_name not given, assuming none");
}
# the language has to be given by means of a parameter
if (isset($_GET['lang'])) {
$lang = $_GET['lang'];
} else {
$lang = LANG_EN;
$logging->warn("parameter lang not given, assuming " . LANG_EN);
}
# the mode has to be given by means of a parameter
if (isset($_GET['mode'])) {
$lang = $_GET['mode'];
} else {
$mode = UPLOAD_MODE_ATTACHMENT;
$logging->warn("parameter mode not given, assuming " . UPLOAD_MODE_ATTACHMENT);
}
示例6: dispatchMetadata
public function dispatchMetadata($md, $mode)
{
$return_hash = array();
Application_Model_Preference::SetImportTimestamp();
//Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
//Logging::info( $md );
// create also modifies the file if it exists
if ($mode == "create") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$filepath = Application_Common_OsPath::normpath($filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
$file = Application_Model_StoredFile::Insert($md);
} else {
// If the file already exists we will update and make sure that
// it's marked as 'exists'.
$file->setFileExistsFlag(true);
$file->setMetadata($md);
}
if ($md['is_record'] != 0) {
$this->uploadRecordedActionParam($md['MDATA_KEY_TRACKNUMBER'], $file->getId());
}
} elseif ($mode == "modify") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
//File is not in database anymore.
if (is_null($file)) {
$return_hash['error'] = "File does not exist in Airtime.";
return $return_hash;
} else {
$file->setMetadata($md);
}
} elseif ($mode == "moved") {
$file = Application_Model_StoredFile::RecallByFilepath($md['MDATA_KEY_ORIGINAL_PATH']);
if (is_null($file)) {
$return_hash['error'] = 'File does not exist in Airtime';
} else {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file->setFilePath($filepath);
}
} elseif ($mode == "delete") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
$return_hash['error'] = "File doesn't exist in Airtime.";
Logging::warn("Attempt to delete file that doesn't exist.\n Path: '{$filepath}'");
return $return_hash;
} else {
$file->deleteByMediaMonitor();
}
} elseif ($mode == "delete_dir") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
foreach ($files as $file) {
$file->deleteByMediaMonitor();
}
$return_hash['success'] = 1;
return $return_hash;
}
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
return $return_hash;
}
示例7: getFirstAdmin
public static function getFirstAdmin()
{
$admins = Application_Model_User::getUsersOfType('A');
if (count($admins) > 0) {
// found admin => pick first one
return $admins[0];
} else {
Logging::warn("Warning. no admins found in database");
return null;
}
}
示例8: getOrderingMap
public static function getOrderingMap($pref_param)
{
$v = self::getValue($pref_param, true);
$id = function ($x) {
return $x;
};
if ($v === '') {
return $id;
}
$ds = unserialize($v);
if (!array_key_exists('ColReorder', $ds)) {
return $id;
}
return function ($x) use($ds) {
if (array_key_exists($x, $ds['ColReorder'])) {
return $ds['ColReorder'][$x];
} else {
/*For now we just have this hack for debugging. We should not
rely on this crappy behaviour in case of failure*/
Logging::info("Pref: {$pref_param}");
Logging::warn("Index {$x} does not exist preferences");
Logging::warn("Defaulting to identity and printing preferences");
Logging::warn($ds);
return $x;
}
};
}
示例9: activate
/**
* activate an archived existing record in database
* @param $encoded_key_string string unique identifier of record
* @param $user_name string name of current user
* @return bool indicates if record has been archived
*/
function activate($encoded_key_string, $user_name)
{
# decode key string
$key_string = $this->_decode_key_string($encoded_key_string);
$this->_log->trace("activating record from DatabaseTable (key_string=" . $key_string . ", user_name=" . $user_name . ")");
if ($this->metadata_str[DATABASETABLE_METADATA_ENABLE_ARCHIVE] == DATABASETABLE_METADATA_FALSE) {
$this->_log->warn("archiving not enabled for this DatabaseTable");
return FALSE;
}
# select row from database to see if it really exists
$row = self::select_record($key_string);
if (count($row) == 0) {
return FALSE;
}
# check if row is actually archived
if ($row[DB_TS_ARCHIVED_FIELD_NAME] == DB_NULL_DATETIME) {
$this->_handle_error("can not activate an active record from DatabaseTable (key_string=" . $key_string . ")", "ERROR_DATABASE_PROBLEM");
return FALSE;
}
$query = "UPDATE " . $this->table_name . " SET ";
$query .= DB_ARCHIVER_FIELD_NAME . "=\"\", ";
$query .= DB_TS_ARCHIVED_FIELD_NAME . "=\"" . DB_NULL_DATETIME . "\" WHERE " . $key_string;
$result = $this->_database->query($query);
if ($result == FALSE) {
$this->_handle_error("could not activate record from DatabaseTable (key_string=" . $key_string . ")", "ERROR_DATABASE_PROBLEM");
return FALSE;
}
$this->_log->trace("activated record from DatabaseTable");
return TRUE;
}
示例10: Logging
*
* @package HTML_FirstThingsFirst
* @author Jasper de Jong
* @copyright 2007-2012 Jasper de Jong
* @license http://www.opensource.org/licenses/gpl-license.php
*/
require_once "Class.Logging.php";
require_once "../globals.php";
require_once "../localsettings.php";
$logging = new Logging($firstthingsfirst_loglevel, "../logs/" . $firstthingsfirst_logfile);
# the tmp file name has to be given by means of a parameter
if (isset($_GET['tmp_file'])) {
$tmp_file = $_GET['tmp_file'];
} else {
$tmp_file = 'tmp.txt';
$logging->warn("parameter tmp_file not given, assuming tmp.txt");
}
# the original file name has to be given by means of a parameter
if (isset($_GET['file_name'])) {
$file_name = $_GET['file_name'];
} else {
$file_name = 'list_export.csv';
$logging->warn("parameter file_name not given, assuming list_export.csv");
}
$logging->debug("exporting file (tmp_file={$tmp_file}, file_name={$file_name})");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private, false");
#header("Content-Type: text/plain" );
header("Content-Disposition: attachment; filename=\"{$file_name}\";");
示例11: getUploadToSoundcloudStatusAction
public function getUploadToSoundcloudStatusAction()
{
$id = $this->_getParam('id');
$type = $this->_getParam('type');
if ($type == "show") {
$show_instance = new Application_Model_ShowInstance($id);
$this->view->sc_id = $show_instance->getSoundCloudFileId();
$file = $show_instance->getRecordedFile();
$this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg();
} elseif ($type == "file") {
$file = Application_Model_StoredFile::Recall($id);
$this->view->sc_id = $file->getSoundCloudId();
$this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg();
} else {
Logging::warn("Trying to upload unknown type: {$type} with id: {$id}");
}
}