本文整理汇总了PHP中tLog函数的典型用法代码示例。如果您正苦于以下问题:PHP tLog函数的具体用法?PHP tLog怎么用?PHP tLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importTestCaseDataFromXML
function importTestCaseDataFromXML(&$db, $fileName, $parentID, $tproject_id, $userID, $options = null)
{
tLog('importTestCaseDataFromXML called for file: ' . $fileName);
$xmlTCs = null;
$resultMap = null;
$my = array();
$my['options'] = array('useRecursion' => false, 'importIntoProject' => 0, 'duplicateLogic' => array('hitCriteria' => 'name', 'actionOnHit' => null));
$my['options'] = array_merge($my['options'], (array) $options);
foreach ($my['options'] as $varname => $value) {
${$varname} = $value;
}
if (file_exists($fileName)) {
$xml = @simplexml_load_file($fileName);
if ($xml !== FALSE) {
$xmlKeywords = $xml->xpath('//keywords');
$kwMap = null;
if ($xmlKeywords) {
$tproject = new testproject($db);
$loop2do = sizeof($xmlKeywords);
for ($idx = 0; $idx < $loop2do; $idx++) {
$tproject->importKeywordsFromSimpleXML($tproject_id, $xmlKeywords[$idx]);
}
$kwMap = $tproject->get_keywords_map($tproject_id);
$kwMap = is_null($kwMap) ? null : array_flip($kwMap);
}
if (!$my['options']['useRecursion'] && $xml->getName() == 'testcases') {
$resultMap = importTestCasesFromSimpleXML($db, $xml, $parentID, $tproject_id, $userID, $kwMap, $my['options']['duplicateLogic']);
}
if ($useRecursion && $xml->getName() == 'testsuite') {
$resultMap = importTestSuitesFromSimpleXML($db, $xml, $parentID, $tproject_id, $userID, $kwMap, $my['options']);
}
}
}
return $resultMap;
}
示例2: executeImportedReqs
/** Process CVS file contents with requirements into TL
* and creates an array with reports
* @return array_of_strings list of particular REQ data with resolution comment
*
*
**/
function executeImportedReqs(&$db, $arrImportSource, $map_cur_reqdoc_id, $conflictSolution, $emptyScope, $idSRS, $tprojectID, $userID)
{
define('SKIP_CONTROLS', 1);
$req_mgr = new requirement_mgr($db);
$import_status = null;
$field_size = config_get('field_size');
foreach ($arrImportSource as $data) {
$docID = trim_and_limit($data['docid'], $field_size->req_docid);
$title = trim_and_limit($data['title'], $field_size->req_title);
$scope = $data['description'];
$type = $data['type'];
$status = $data['status'];
$expected_coverage = $data['expected_coverage'];
$node_order = $data['node_order'];
if ($emptyScope == 'on' && empty($scope)) {
// skip rows with empty scope
$import_status = lang_get('req_import_result_skipped');
} else {
$crash = $map_cur_reqdoc_id && array_search($docID, $map_cur_reqdoc_id);
if ($crash) {
// process conflict according to choosen solution
tLog('Conflict found. solution: ' . $conflictSolution);
$import_status['msg'] = 'Error';
if ($conflictSolution == 'overwrite') {
$item = current($req_mgr->getByDocID($docID, $tprojectID));
$last_version = $req_mgr->get_last_version_info($item['id']);
// BUGID 0003745: CSV Requirements Import Updates Frozen Requirement
if ($last_version['is_open'] == 1) {
$op = $req_mgr->update($item['id'], $last_version['id'], $docID, $title, $scope, $userID, $status, $type, $expected_coverage, $node_order, SKIP_CONTROLS);
if ($op['status_ok']) {
$import_status['msg'] = lang_get('req_import_result_overwritten');
}
} else {
$import_status['msg'] = lang_get('req_import_result_skipped_is_frozen');
}
} elseif ($conflictSolution == 'skip') {
// no work
$import_status['msg'] = lang_get('req_import_result_skipped');
}
} else {
// no conflict - just add requirement
$import_status = $req_mgr->create($idSRS, $docID, $title, $scope, $userID, $status, $type, $expected_coverage, $node_order);
}
$arrImport[] = array('doc_id' => $docID, 'title' => $title, 'import_status' => $import_status['msg']);
}
}
return $arrImport;
}
示例3: setUserSession
/**
* set session data after modification or authorization
*
* @param resource &$db reference to DB identifier
* @param string $user
* @param integer $id
* @param integer $roleID
* @param string $email
* @param string $locale [default = null]
* @param boolean $active [default = null] documentation
*
* @return integer status code
*
* @TODO havlatm: move to tlSession class
* @TODO fix return functionality
**/
function setUserSession(&$db, $user, $id, $roleID, $email, $locale = null, $active = null)
{
tLog('setUserSession: $user=' . $user . ' $id=' . $id . ' $roleID=' . $roleID . ' $email=' . $email . ' $locale=' . $locale);
$_SESSION['userID'] = $id;
$_SESSION['testprojectID'] = null;
$_SESSION['s_lastAttachmentList'] = null;
if (!is_null($locale)) {
$_SESSION['locale'] = $locale;
setDateTimeFormats($locale);
}
$tproject_mgr = new testproject($db);
$gui_cfg = config_get('gui');
$opt = array('output' => 'map_name_with_inactive_mark', 'order_by' => $gui_cfg->tprojects_combo_order_by);
$arrProducts = $tproject_mgr->get_accessible_for_user($id, $opt);
$tproject_cookie = 'TL_lastTestProjectForUserID_' . $id;
if (isset($_COOKIE[$tproject_cookie])) {
if (isset($arrProducts[$_COOKIE[$tproject_cookie]]) && $arrProducts[$_COOKIE[$tproject_cookie]]) {
$_SESSION['testprojectID'] = $_COOKIE[$tproject_cookie];
tLog('Cookie: {$tproject_cookie}=' . $_SESSION['testprojectID']);
}
}
if (!$_SESSION['testprojectID']) {
$tpID = null;
if (sizeof($arrProducts)) {
$tpID = key($arrProducts);
}
$_SESSION['testprojectID'] = $tpID;
}
// Validation is done in navBar.php
$tplan_cookie = 'TL_lastTestPlanForUserID_' . $id;
if (isset($_COOKIE[$tplan_cookie])) {
$_SESSION['testplanID'] = $_COOKIE[$tplan_cookie];
tLog("Cookie: {$tplan_cookie}=" . $_SESSION['testplanID']);
}
return 1;
}
示例4: testlinkInitPage
*
* @internal Revisions:
* 20101010 - franciscom - added testsuite_id as parameter, needed to do checks when creating test case
* 20100225 - eloff - initial commit
*
**/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$data = array('success' => true, 'message' => '');
$iParams = array("name" => array(tlInputParameter::STRING_N, 0, 100), "testcase_id" => array(tlInputParameter::INT), "testsuite_id" => array(tlInputParameter::INT));
$args = G_PARAMS($iParams);
if (has_rights($db, 'mgt_view_tc')) {
$tree_manager = new tree($db);
$node_types_descr_id = $tree_manager->get_available_node_types();
// To allow name check when creating a NEW test case => we do not have test case id
$args['testcase_id'] = $args['testcase_id'] > 0 ? $args['testcase_id'] : null;
$args['testsuite_id'] = $args['testsuite_id'] > 0 ? $args['testsuite_id'] : null;
// for debug -
// $xx = "\$args['testcase_id']:{$args['testcase_id']} - \$args['name']:{$args['name']}" .
// " - \$args['testsuite_id']:{$args['testsuite_id']}";
// file_put_contents('c:\checkTCaseDuplicateName.php.ajax', $xx);
$check = $tree_manager->nodeNameExists($args['name'], $node_types_descr_id['testcase'], $args['testcase_id'], $args['testsuite_id']);
$data['success'] = !$check['status'];
$data['message'] = $check['msg'];
} else {
tLog('User has not right needed to do requested action - checkTCaseDuplicateName.php', 'ERROR');
$data['success'] = false;
$data['message'] = lang_get('user_has_no_right_for_action');
}
echo json_encode($data);
示例5: microtime
require '../../config.inc.php';
require_once 'common.php';
require_once 'displayMgr.php';
$timerOn = microtime(true);
$templateCfg = templateConfiguration();
$args = init_args($db);
$tplan_mgr = new testplan($db);
$gui = initializeGui($db, $args, $tplan_mgr);
$mailCfg = buildMailCfg($gui);
$metricsMgr = new tlTestPlanMetrics($db);
$dummy = $metricsMgr->getStatusTotalsByTopLevelTestSuiteForRender($args->tplan_id);
if (is_null($dummy)) {
// no test cases -> no report
$gui->do_report['status_ok'] = 0;
$gui->do_report['msg'] = lang_get('report_tspec_has_no_tsuites');
tLog('Overall Metrics page: no test cases defined');
} else {
// do report
$gui->statistics->testsuites = $dummy->info;
$gui->do_report['status_ok'] = 1;
$gui->do_report['msg'] = '';
$items2loop = array('testsuites', 'keywords');
$keywordsMetrics = $metricsMgr->getStatusTotalsByKeywordForRender($args->tplan_id);
$gui->statistics->keywords = !is_null($keywordsMetrics) ? $keywordsMetrics->info : null;
if ($gui->showPlatforms) {
$items2loop[] = 'platform';
$platformMetrics = $metricsMgr->getStatusTotalsByPlatformForRender($args->tplan_id);
$gui->statistics->platform = !is_null($platformMetrics) ? $platformMetrics->info : null;
}
if ($gui->testprojectOptions->testPriorityEnabled) {
$items2loop[] = 'priorities';
示例6: checkCfg
/**
*
*
**/
function checkCfg()
{
$status_ok = true;
if (property_exists($this->cfg, 'projectkey')) {
$pk = trim((string) $this->cfg->projectkey);
if ($pk == '') {
$status_ok = false;
$msg = __CLASS__ . ' - Empty configuration: <projectKey>';
}
} else {
// this is oK if user only wants to LINK issues
$this->cfg->projectkey = self::NOPROJECTKEY;
}
if (!$status_ok) {
tLog(__METHOD__ . ' / ' . $msg, 'ERROR');
}
return $status_ok;
}
示例7: connect
/**
* establishes the database connection to the bugtracking system
*
* @return bool returns true if the db connection was established and the
* db could be selected, false else
*
**/
function connect()
{
if (is_null($this->cfg->dbhost) || is_null($this->cfg->dbuser)) {
return false;
}
// cast everything to string in order to avoid issues
// @20140604 someone has been issues trying to connect to JIRA on MSSQL
$this->cfg->dbtype = strtolower((string) $this->cfg->dbtype);
$this->cfg->dbhost = (string) $this->cfg->dbhost;
$this->cfg->dbuser = (string) $this->cfg->dbuser;
$this->cfg->dbpassword = (string) $this->cfg->dbpassword;
$this->cfg->dbname = (string) $this->cfg->dbname;
$this->dbConnection = new database($this->cfg->dbtype);
$result = $this->dbConnection->connect(false, $this->cfg->dbhost, $this->cfg->dbuser, $this->cfg->dbpassword, $this->cfg->dbname);
if (!$result['status']) {
$this->dbConnection = null;
$connection_args = "(interface: - Host:{$this->cfg}->dbhost - " . "DBName: {$this->cfg}->dbname - User: {$this->cfg}->dbuser) ";
$msg = sprintf(lang_get('BTS_connect_to_database_fails'), $connection_args);
tLog($msg . $result['dbms_msg'], 'ERROR');
} elseif ($this->cfg->dbtype == 'mysql') {
if ($this->cfg->dbcharset == 'UTF-8') {
$r = $this->dbConnection->exec_query("SET CHARACTER SET utf8");
$r = $this->dbConnection->exec_query("SET NAMES utf8");
$r = $this->dbConnection->exec_query("SET collation_connection = 'utf8_general_ci'");
} else {
$r = $this->dbConnection->exec_query("SET CHARACTER SET " . $this->cfg->dbcharset);
$r = $this->dbConnection->exec_query("SET NAMES " . $this->cfg->dbcharset);
}
}
$this->connected = $result['status'] ? true : false;
return $this->connected;
}
示例8: logEvent
/**
*
* $event->message
* $event->logLevel
* $event->source
* $event->objectID
* $event->objectType
* $event->code
*
*/
function logEvent($event)
{
return tLog($event->message, $event->logLevel, $event->source, $event->objectID, $event->objectType, $event->code);
}
示例9: flushHttpHeader
/**
* Generate HTML header and send it to browser
* @param string $format identifier of document format; value must be in $tlCfg->reports_formats
* @param integer $doc_kind Magic number of document kind; see consts.inc.php for list
* (for example: DOC_TEST_PLAN_DESIGN)
* @author havlatm
*/
function flushHttpHeader($format, $doc_kind = 0)
{
$file_extensions = config_get('reports_file_extension');
$reports_applications = config_get('reports_applications');
switch ($doc_kind) {
case DOC_TEST_SPEC:
$kind_acronym = '_test_spec';
break;
case DOC_TEST_PLAN_DESIGN:
$kind_acronym = '_test_plan';
break;
case DOC_TEST_PLAN_EXECUTION:
$kind_acronym = '_test_report';
break;
case DOC_REQ_SPEC:
$kind_acronym = '_req_spec';
break;
default:
$kind_acronym = '';
break;
}
if ($format == FORMAT_MAIL_HTML) {
tLog('flushHttpHeader> Invalid format: ' . $format, 'ERROR');
}
$filename = isset($_SESSION['testprojectPrefix']) ? $_SESSION['testprojectPrefix'] : '';
$filename .= $kind_acronym . '-' . date('Y-m-d') . '.' . $file_extensions[$format];
tLog('Flush HTTP header for ' . $format);
$contentType = isset($reports_applications[$format]) ? $reports_applications[$format] : 'text/html';
$contentType .= is_null($format) || $format == '' ? '' : "; name='Testlink_" . $format . "'";
header("Content-type: {$contentType}");
header("Content-Description: TestLink - Generated Document (see " . __FUNCTION__ . ")");
if (!is_null($format) && $format != '' && $format != FORMAT_HTML) {
header("Content-Disposition: attachment; filename={$filename}");
}
flush();
}
示例10: assign
/**
*
* @param $feature_map
* $feature_map['feature_id']['user_id']
* $feature_map['feature_id']['type']
* $feature_map['feature_id']['status']
* $feature_map['feature_id']['assigner_id']
* $feature_map['feature_id']['build_id']
*
*
* Need to manage situation where user_id = 0 is passed
* I will IGNORE IT
*
* @internal revisions
*/
function assign($feature_map)
{
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$ret = array();
$types = $this->get_available_types();
$safe = null;
foreach ($feature_map as $feature_id => $elem) {
$safe['feature_id'] = intval($feature_id);
$safe['build_id'] = intval($elem['build_id']);
$safe['type'] = intval($elem['type']);
$uSet = (array) $elem['user_id'];
foreach ($uSet as $user_id) {
$safe['user_id'] = intval($user_id);
// Check if exists before adding
$check = "/* {$debugMsg} */ ";
$check .= " SELECT id FROM {$this->tables['user_assignments']} " . " WHERE feature_id = " . $safe['feature_id'] . " AND build_id = " . $safe['build_id'] . " AND type = " . $safe['type'] . " AND user_id = " . $safe['user_id'];
$rs = $this->db->get_recordset($check);
if (is_null($rs) || count($rs) == 0) {
if ($safe['user_id'] > 0) {
$sql = "INSERT INTO {$this->tables['user_assignments']} " . "(feature_id,user_id,assigner_id,type,status,creation_ts";
$values = "VALUES({$safe['feature_id']},{$safe['user_id']}," . "{$elem['assigner_id']}," . "{$safe['type']},{$elem['status']},";
$values .= isset($elem['creation_ts']) ? $elem['creation_ts'] : $this->db->db_now();
if (isset($elem['deadline_ts'])) {
$sql .= ",deadline_ts";
$values .= "," . $elem['deadline_ts'];
}
if (isset($elem['build_id'])) {
$sql .= ",build_id";
$values .= "," . $safe['build_id'];
} else {
if ($safe['type'] == $types['testcase_execution']['id']) {
throw new Exception("Error Processing Request - BUILD ID is Mandatory");
}
}
$sql .= ") " . $values . ")";
tLog(__METHOD__ . '::' . $sql, "DEBUG");
$this->db->exec_query($sql);
$ret[] = $sql;
}
}
}
// loop over users
}
return $ret;
}
示例11: exec_query
/**
* execute SQL query,
* requires connection to be opened
*
* @param string $p_query SQL request
* @param integer $p_limit (optional) number of rows
* @param integer $p_offset (optional) begining row number
*
* @return boolean result of request
**/
function exec_query($p_query, $p_limit = -1, $p_offset = -1)
{
$ec = 0;
$emsg = null;
$logLevel = 'DEBUG';
$message = '';
if ($this->logQueries) {
$this->nQuery++;
$t_start = $this->microtime_float();
}
if ($p_limit != -1 || $p_offset != -1) {
$t_result = $this->db->SelectLimit($p_query, $p_limit, $p_offset);
} else {
$t_result = $this->db->Execute($p_query);
}
if ($this->logQueries) {
$t_elapsed = number_format($this->microtime_float() - $t_start, 4);
$this->overallDuration += $t_elapsed;
$message = "SQL [" . $this->nQuery . "] executed [took {$t_elapsed} secs]" . "[all took {$this->overallDuration} secs]:\n\t\t";
}
$message .= $p_query;
if (!$t_result) {
$ec = $this->error_num();
$emsg = $this->error_msg();
$message .= "\nQuery failed: errorcode[" . $ec . "]" . "\n\terrormsg:" . $emsg;
$logLevel = 'ERROR';
tLog("ERROR ON exec_query() - database.class.php <br />" . $this->error(htmlspecialchars($p_query)) . "<br />THE MESSAGE : {$message} ", 'ERROR', "DATABASE");
echo "<pre> ============================================================================== </pre>";
echo "<pre> DB Access Error - debug_print_backtrace() OUTPUT START </pre>";
echo "<pre> ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200) </pre>";
echo "<pre> Having this additional Information could be useful for reporting </pre>";
echo "<pre> issue to development TEAM. </pre>";
echo "<pre> ============================================================================== </pre>";
if (defined('DBUG_ON') && DBUG_ON == 1) {
echo "<pre>";
debug_print_backtrace();
echo "</pre>";
}
//else
//{
// echo "<pre>"; debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); echo "</pre>";
//}
echo "<pre> ============================================================================== </pre>";
$t_result = false;
}
if ($this->logEnabled) {
tLog($message, $logLevel, "DATABASE");
}
if ($this->logQueries) {
array_push($this->queries_array, array($p_query, $t_elapsed, $ec, $emsg));
}
return $t_result;
}
示例12: logWarningEvent
function logWarningEvent($message, $activityCode = null, $objectID = null, $objectType = null)
{
return tLog($message, "WARNING", "GUI", $objectID, $objectType, $activityCode);
}
示例13: validate
/**
* @param integer $value the value which should be validated
* @return bool return true if the value was successfully validated, else throws an Exception
*/
public function validate($value)
{
$msg = 'Input parameter validation failed';
if (!is_numeric($value)) {
$msg = "{$msg} [numeric: " . htmlspecialchars($value) . "]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
$value = intval($value);
$minVal = $this->minVal;
if ($value < $minVal) {
$msg = "{$msg} [minVal: " . htmlspecialchars($value) . " = {$minVal}]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
$maxVal = $this->maxVal;
if ($value > $maxVal) {
$msg = "{$msg} [maxVal: " . htmlspecialchars($value) . " = {$maxVal}]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
$pfnValidation = $this->pfnValidation;
if ($pfnValidation && !$pfnValidation($value)) {
$msg = "{$msg} [external function]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
return true;
}
示例14: parseTestProjectRecordset
/**
* Unserialize project options
*
* @param array $recorset produced by getTestProject()
*/
protected function parseTestProjectRecordset(&$recordset)
{
if (count($recordset) > 0) {
foreach ($recordset as $number => $row) {
$recordset[$number]['opt'] = unserialize($row['options']);
}
} else {
$recordset = null;
tLog('parseTestProjectRecordset: No project on query', 'DEBUG');
}
}
示例15: gendocGetUserName
/**
* get user name from pool (save used names in session to improve performance)
*
* @param integer $db DB connection identifier
* @param integer $userId
*
* @return string readable user name
* @author havlatm
*/
function gendocGetUserName(&$db, $userId)
{
$authorName = null;
if (isset($_SESSION['userNamePool'][$userId])) {
$authorName = $_SESSION['userNamePool'][$userId];
} else {
$user = tlUser::getByID($db, $userId);
if ($user) {
$authorName = $user->getDisplayName();
$authorName = htmlspecialchars($authorName);
$_SESSION['userNamePool'][$userId] = $authorName;
} else {
$authorName = lang_get('undefined');
tLog('tlUser::getByID($db,$userId) failed', 'ERROR');
}
}
return $authorName;
}