本文整理汇总了PHP中DateTimeValue::getSecond方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeValue::getSecond方法的具体用法?PHP DateTimeValue::getSecond怎么用?PHP DateTimeValue::getSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeValue
的用法示例。
在下文中一共展示了DateTimeValue::getSecond方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogs
/**
* Get log data
*
* @param integer $revision_to
* @param mixed $revision_from
* @return array
*/
function getLogs($revision_to, $revision_from = 'HEAD', $logs_per_query = 100)
{
// get multiple logs or a single one
if (!is_null($revision_from)) {
$r = $revision_from . ':' . $revision_to;
} else {
$r = $revision_to;
$this->triggerred_by_handler = true;
}
// if
$string = 'log -r ' . $r . ' --xml --verbose ' . $this->active_repository->getUrl();
$this->execute($string);
$log_data = xml2array(implode("\n", $this->output), 1, array('path', 'logentry'));
$insert_data = array();
$i = 1;
// this is because we get commits from SVN sorted from newest to oldest
$logs = is_array($log_data['log']['logentry']) ? array_reverse($log_data['log']['logentry']) : array();
// loop through array of log entries
foreach ($logs as $key => $log_entry) {
// prevent duplicate entries in case when there are two separate update processes
// (like, both scheduled task and aC user triggered the update
if (Commits::count("parent_id = '" . $this->active_repository->getId() . "' AND integer_field_1 = '" . $log_entry['attr']['revision'] . "'") > 0) {
continue;
}
// if
$paths = array();
$k = 0;
foreach ($log_entry['paths']['path'] as $path) {
$paths[$k]['path'] = mysql_real_escape_string($path['value']);
// paths can contain file names with characters that can break the query
$paths[$k]['action'] = $path['attr']['action'];
$k++;
}
// foreach
$date = new DateTimeValue($log_entry['date']['value']);
$log_date = $date->getYear() . "-" . $date->getMonth() . '-' . $date->getDay() . ' ' . $date->getHour() . ':' . $date->getMinute() . ':' . $date->getSecond();
$commit_message = Commit::analyze_message($log_entry['msg']['value'], $log_entry['author']['value'], $log_entry['attr']['revision'], $this->active_repository, $this->active_project);
$insert_data[$i][$key] = "('Commit','Source','" . $this->active_project->getId() . "','" . $this->active_repository->getId() . "','Repository','" . mysql_real_escape_string($commit_message) . "','" . $log_entry['attr']['revision'] . "','" . serialize($paths) . "','" . mysql_real_escape_string($log_entry['author']['value']) . "','{$log_date}', '" . STATE_VISIBLE . "', '" . $this->active_repository->getVisibility() . "')";
$i = count($insert_data[$i]) < $logs_per_query ? $i : $i + 1;
}
// foreach
return array('data' => $insert_data, 'total' => count($logs));
}