即使调试日志显示来自Trac [查询]的结果,TRAC XMLRPC插件也无法检索票证

时间:2016-07-07 12:14:43

标签: trac

我有一个正常运行的python脚本,它将从TRAC XMLRPC中提取各种信息,但ticket.query除外。从调试日志中我可以看到查询进来并被处理并找到四(4)张票;但是回报是空的。

我已使用http://trac-hacks.org/rpc替换了ServerProxy网站,并且可以正常运行。

配置:

<?php
$link = mysqli_connect(here i put the data);

if(!$link) {
  echo "Error: " . mysqli_connect_errno() . PHP_EOL;
  exit;
}
else if(!isset($_POST['user'])) {
  echo "User not set!"; exit;
} 

echo "User set! ";

if(!isset($_POST['pass']) || empty($_POST['pass'])) {
  echo "Password not set!"; exit;
}

echo "Password set! ";

$query = "SELECT COUNT(username)
  FROM users
  WHERE username = ?";

if (!($stmt = $mysqli->prepare($query))) {
  echo "Prepare failed: (" . mysqli_errno($link) . ") " . mysqli_error($link);
  mysqli_close($link);
  exit;
}

$user = $_POST ['user'];
$pass = $_POST ['pass'];

if(!mysqli_stmt_bind_param($stmt, 's',  $user)) {
  echo "Execute failed: (" . mysqli_stmt_errno($stmt) . ") " . mysqli_stmt_error($stmt);
  mysqli_stmt_close($stmt);
  mysqli_close($link);
  exit;
}

if (!mysqli_execute($stmt)) {
    echo "Execute failed: (" . mysqli_stmt_errno($stmt) . ") " . mysqli_stmt_error($stmt);
  mysqli_stmt_close($stmt);
  mysqli_close($link);
  exit;
}

$result = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
  $num = $row[0];
  if($num > 0) {
    echo "Cannot add duplicate user!";
  }
}

mysqli_stmt_close($stmt);
mysqli_close($link);

代码:

    Trac 1.0.1
    Apache 2.2
    XMLPRC plugin 1.1.5
    Python 2.7.6
    Active Directory 

返回:

    from xmlrpclib import *
    p = ServerProxy('http://user:password@host/trac/project/login/xmlrpc')
    print p.system.getAPIVersion()
    print p.ticket.query("max=0&status!=closed")

调试日志:

    [1, 1, 5]
    []

0 个答案:

没有答案