Website: enhance SQL error reporting;

This commit is contained in:
Benjamin Bouvier 2017-06-23 15:34:40 +02:00
Родитель cd1ec84c33
Коммит 50118c7fca
30 изменённых файлов: 394 добавлений и 395 удалений

Просмотреть файл

@ -82,10 +82,9 @@ if (GET_string("run") == 'addEngine') {
// to send.
if (GET_string('awake') == 'yes') {
$MACHINE = GET_int('MACHINE');
mysql_query("UPDATE awfy_machine
awfy_query("UPDATE awfy_machine
SET last_checked = UNIX_TIMESTAMP()
WHERE id = $MACHINE")
or die("ERROR: " . mysql_error());
WHERE id = $MACHINE");
die();
}
@ -105,17 +104,15 @@ if (isset($_GET['version']))
$suite_version_id = find_or_add_suite_version(GET_string('suite'), $version);
if (GET_string('name') == '__total__') {
$extra_info = htmlspecialchars(GET_string('extra_info'), ENT_QUOTES);
mysql_query("INSERT INTO awfy_score
(build_id, suite_version_id, score, extra_info)
VALUES
($build, $suite_version_id, $time, '$extra_info')")
or die("ERROR: " . mysql_error());
awfy_query("INSERT INTO awfy_score
(build_id, suite_version_id, score, extra_info)
VALUES
($build, $suite_version_id, $time, '$extra_info')");
print("id=" . mysql_insert_id());
} else {
$test_id = find_or_add_test($suite_version_id, GET_string('name'));
mysql_query("INSERT INTO awfy_breakdown
(score_id, suite_test_id, score)
VALUES
($score, $test_id, $time)")
or die("ERROR: " . mysql_error());
awfy_query("INSERT INTO awfy_breakdown
(score_id, suite_test_id, score)
VALUES
($score, $test_id, $time)");
}

Просмотреть файл

@ -116,11 +116,11 @@ echo "<th>Status";
echo "<th>Queue";
echo "<th>Last finished task";
echo "</thead>";
$qUnits = mysql_query("SELECT * FROM control_unit");
$qUnits = awfy_query("SELECT * FROM control_unit");
while($unit = mysql_fetch_object($qUnits)) {
echo "<tr><td>".$unit->id;
$qTasks = mysql_query("SELECT * FROM control_tasks WHERE control_unit_id =".$unit->id) or die(mysql_error());
$qTasks = awfy_query("SELECT * FROM control_tasks WHERE control_unit_id =".$unit->id);
if (mysql_num_rows($qTasks) == 0) {
echo "<td>/";
} else {

Просмотреть файл

@ -16,23 +16,23 @@ if ($subtest) {
$prev_breakdown_id = imm_prev_suite_test($id);
$prev_score_id = get("breakdown", $prev_breakdown_id, "score_id");
$prev_build_id = get("score", $prev_score_id, "build_id");
$query = mysql_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_breakdown`
LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_breakdown.regression_id
WHERE breakdown_id = ".$id." AND
prev_build_id = ".$prev_build_id);
$query = awfy_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_breakdown`
LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_breakdown.regression_id
WHERE breakdown_id = ".$id." AND
prev_build_id = ".$prev_build_id);
} else {
$score_id = $id;
$prev_score_id = imm_prev_($id);
$prev_build_id = get("score", $prev_score_id, "build_id");
$query = mysql_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_score`
LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_score.regression_id
WHERE score_id = ".$id." AND
prev_build_id = ".$prev_build_id);
$query = awfy_query("SELECT awfy_regression.id, noise, status
FROM `awfy_regression_score`
LEFT JOIN awfy_regression
ON awfy_regression.id = awfy_regression_score.regression_id
WHERE score_id = ".$id." AND
prev_build_id = ".$prev_build_id);
}
$data = Array("regression" => Array());

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
require_once("Build.php");
@ -32,19 +33,19 @@ class Breakdown extends DB {
$build = $score->build();
$run = $build->run();
$qPrev = mysql_query("SELECT awfy_breakdown.id
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = awfy_breakdown.score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order < ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$score->suite_version_id()." AND
awfy_breakdown.suite_test_id = ".$this->suite_test_id()."
ORDER BY sort_order DESC
LIMIT 1") or throw_exception(mysql_error());
$qPrev = awfy_query("SELECT awfy_breakdown.id
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = awfy_breakdown.score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order < ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$score->suite_version_id()." AND
awfy_breakdown.suite_test_id = ".$this->suite_test_id()."
ORDER BY sort_order DESC
LIMIT 1");
if (mysql_num_rows($qPrev) == 0)
return null;
$prev = mysql_fetch_object($qPrev);
@ -56,19 +57,19 @@ class Breakdown extends DB {
$build = $score->build();
$run = $build->run();
$qNext = mysql_query("SELECT awfy_breakdown.id
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = awfy_breakdown.score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order > ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$score->suite_version_id()." AND
awfy_breakdown.suite_test_id = ".$this->suite_test_id()."
ORDER BY sort_order ASC
LIMIT 1") or throw_exception(mysql_error());
$qNext = awfy_query("SELECT awfy_breakdown.id
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = awfy_breakdown.score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order > ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$score->suite_version_id()." AND
awfy_breakdown.suite_test_id = ".$this->suite_test_id()."
ORDER BY sort_order ASC
LIMIT 1");
if (mysql_num_rows($qNext) == 0)
return null;
$next = mysql_fetch_object($qNext);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
require_once("Run.php");
require_once("Score.php");
@ -13,10 +14,10 @@ class Build extends DB {
}
public static function withRunAndMode($run_id, $mode_id) {
$qBuild = mysql_query("SELECT id FROM awfy_build
WHERE run_id = $run_id AND
mode_id = $mode_id
LIMIT 1") or die(mysql_error());
$qBuild = awfy_query("SELECT id FROM awfy_build
WHERE run_id = $run_id AND
mode_id = $mode_id
LIMIT 1");
if (mysql_num_rows($qBuild) == 0)
return null;
$build = mysql_fetch_object($qBuild);
@ -27,17 +28,16 @@ class Build extends DB {
if ($run->isFinished())
throw new Exception("Cannot info to a run that is finished.");
mysql_query("INSERT INTO awfy_build
(run_id, mode_id, cset)
VALUES
({$run->id}, $mode_id, '".mysql_real_escape_string($revision)."')")
or die("ERROR: " . mysql_error());
awfy_query("INSERT INTO awfy_build
(run_id, mode_id, cset)
VALUES
({$run->id}, $mode_id, '".mysql_real_escape_string($revision)."')");
return new Build(mysql_insert_id());
}
public function scores() {
$qScore = mysql_query("SELECT id FROM awfy_score
WHERE build_id = {$this->id}") or die(mysql_error());
$qScore = awfy_query("SELECT id FROM awfy_score
WHERE build_id = {$this->id}");
$scores = Array();
while ($score = mysql_fetch_object($qScore)) {
$scores[] = new Score($score->id);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
require_once("Mode.php");
require_once("Machine.php");
@ -32,7 +33,7 @@ class ControlTasks extends DB {
}
public static function all() {
$qTasks = mysql_query("SELECT id FROM control_tasks") or die(mysql_error());
$qTasks = awfy_query("SELECT id FROM control_tasks");
$tasks = Array();
while ($task = mysql_fetch_object($qTasks)) {
$tasks[] = new ControlTasks($task->id);
@ -42,8 +43,8 @@ class ControlTasks extends DB {
public function updateLastScheduled($available_at = 0) {
if ($available_at == 0)
$available_at = time();
mysql_query("UPDATE control_tasks
SET last_scheduled = ".$available_at."
WHERE id = ".$this->id) or die(mysql_error());
awfy_query("UPDATE control_tasks
SET last_scheduled = ".$available_at."
WHERE id = ".$this->id);
}
}

Просмотреть файл

@ -1,11 +1,12 @@
<?php
require_once("../internals.php");
class DB {
public static function FromId($id) {
$id = (int) $id;
$qField = mysql_query("SELECT id from ".static::$db."
WHERE id = {$id}") or throw_exception(mysql_error());
$qField = awfy_query("SELECT id from ".static::$db." WHERE id = {$id}");
if (mysql_num_rows($qField) == 0)
return null;
$field = mysql_fetch_object($qField);
@ -14,8 +15,7 @@ class DB {
}
public function select($field) {
$qField = mysql_query("SELECT $field as field from {$this::$db}
WHERE id = {$this->id}") or throw_exception(mysql_error());
$qField = awfy_query("SELECT $field as field from {$this::$db} WHERE id = {$this->id}");
$field = mysql_fetch_object($qField);
if (!isset($field->field))
throw new Exception("Unknown field or non existed id.");
@ -33,9 +33,9 @@ class DB {
}
public function updateRaw($field, $value) {
mysql_query("UPDATE {$this::$db}
SET $field = $value
WHERE id = {$this->id}") or throw_exception(mysql_error());
awfy_query("UPDATE {$this::$db}
SET $field = $value
WHERE id = {$this->id}");
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("Vendor.php");
require_once("DB.php");
@ -14,7 +15,7 @@ class Mode extends DB {
public static function FromMode($mode) {
$query = "SELECT id FROM awfy_mode
WHERE mode = '" . mysql_real_escape_string($mode) . "'";
$results = mysql_query($query) or die(mysql_error());
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
return null;
$row = mysql_fetch_array($results);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
class QueuedTask extends DB {
@ -80,10 +81,10 @@ class QueuedTask extends DB {
$task = mysql_real_escape_string($task);
$email = mysql_real_escape_string($email);
mysql_query("INSERT INTO control_task_queue
(control_unit_id, task, email, output, error)
VALUES
($control_unit_id, '$task', '$email', '', '')");
awfy_query("INSERT INTO control_task_queue
(control_unit_id, task, email, output, error)
VALUES
($control_unit_id, '$task', '$email', '', '')");
return mysql_insert_id();
}
}

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
class Run extends DB {
@ -11,10 +12,10 @@ class Run extends DB {
}
public static function withMachineAndSortOrder($machine_id, $sort_order) {
$qRun = mysql_query("SELECT id FROM awfy_run
WHERE machine = $machine_id AND
sort_order = $sort_order
LIMIT 1") or die(mysql_error());
$qRun = awfy_query("SELECT id FROM awfy_run
WHERE machine = $machine_id AND
sort_order = $sort_order
LIMIT 1");
if (mysql_num_rows($qRun) == 0)
return null;
$run = mysql_fetch_object($qRun);
@ -26,11 +27,10 @@ class Run extends DB {
if ($approx_stamp == 0)
$approx_stamp = "UNIX_TIMESTAMP()";
mysql_query("INSERT INTO awfy_run
(machine, sort_order, approx_stamp)
VALUES
($machine_id, $sort_order, $approx_stamp)")
or die("ERROR: " . mysql_error());
awfy_query("INSERT INTO awfy_run
(machine, sort_order, approx_stamp)
VALUES
($machine_id, $sort_order, $approx_stamp)");
return new Run(mysql_insert_id());
}
@ -45,15 +45,15 @@ class Run extends DB {
$revs .= "'".$revisions[$i]->revision()."'";
}
$qRun = mysql_query("SELECT awfy_run.id FROM awfy_run
LEFT JOIN awfy_build ON run_id = awfy_run.id
WHERE cset IN (".$revs.") AND
machine = $machine_id AND
mode_id = $mode_id AND
status = 1 AND
error = ''
$qRun = awfy_query("SELECT awfy_run.id FROM awfy_run
LEFT JOIN awfy_build ON run_id = awfy_run.id
WHERE cset IN (".$revs.") AND
machine = $machine_id AND
mode_id = $mode_id AND
status = 1 AND
error = ''
ORDER BY sort_order DESC
LIMIT 1") or die(mysql_error());
LIMIT 1");
if (mysql_num_rows($qRun) == 0)
return null;
$run = mysql_fetch_object($qRun);
@ -66,12 +66,11 @@ class Run extends DB {
else
$error = "'" . mysql_real_escape_string($error) . "'";
mysql_query("UPDATE awfy_run
SET status = $status,
error = $error,
finish_stamp = UNIX_TIMESTAMP()
WHERE id = {$this->id}")
or die("ERROR: " . mysql_error());
awfy_query("UPDATE awfy_run
SET status = $status,
error = $error,
finish_stamp = UNIX_TIMESTAMP()
WHERE id = {$this->id}");
}
public function isFinished() {
@ -116,11 +115,11 @@ class Run extends DB {
public function next() {
$sort_order = $this->sort_order();
$machine = $this->machine_id();
$qRun = mysql_query("SELECT id from awfy_run
WHERE sort_order > {$sort_order} AND
machine = {$machine}
ORDER BY sort_order ASC
LIMIT 1") or throw_exception(mysql_error());
$qRun = awfy_query("SELECT id from awfy_run
WHERE sort_order > {$sort_order} AND
machine = {$machine}
ORDER BY sort_order ASC
LIMIT 1");
if (mysql_num_rows($qRun) == 0)
return null;
$run = mysql_fetch_object($qRun);
@ -130,11 +129,11 @@ class Run extends DB {
public function prev() {
$sort_order = $this->sort_order();
$machine = $this->machine_id();
$qRun = mysql_query("SELECT id from awfy_run
WHERE sort_order < {$sort_order} AND
machine = {$machine}
ORDER BY sort_order DESC
LIMIT 1") or throw_exception(mysql_error());
$qRun = awfy_query("SELECT id from awfy_run
WHERE sort_order < {$sort_order} AND
machine = {$machine}
ORDER BY sort_order DESC
LIMIT 1");
$run = mysql_fetch_object($qRun);
return new Run($run->id);
}

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
require_once("Build.php");
@ -12,10 +13,10 @@ class Score extends DB {
}
public static function withBuildAndSuiteVersion($build_id, $suite_version_id) {
$qScore = mysql_query("SELECT id FROM awfy_score
WHERE build_id = $build_id AND
suite_version_id = $suite_version_id
LIMIT 1") or die(mysql_error());
$qScore = awfy_query("SELECT id FROM awfy_score
WHERE build_id = $build_id AND
suite_version_id = $suite_version_id
LIMIT 1");
if (mysql_num_rows($qScore) == 0)
return null;
$score = mysql_fetch_object($qScore);
@ -43,17 +44,17 @@ class Score extends DB {
$build = $this->build();
$run = $build->run();
$qPrev = mysql_query("SELECT awfy_score.id
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order < ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$this->suite_version_id()."
ORDER BY sort_order DESC
LIMIT 1") or throw_exception(mysql_error());
$qPrev = awfy_query("SELECT awfy_score.id
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order < ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$this->suite_version_id()."
ORDER BY sort_order DESC
LIMIT 1");
if (mysql_num_rows($qPrev) == 0)
return null;
$prev = mysql_fetch_object($qPrev);
@ -64,17 +65,17 @@ class Score extends DB {
$build = $this->build();
$run = $build->run();
$qNext = mysql_query("SELECT awfy_score.id
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order > ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$this->suite_version_id()."
ORDER BY sort_order ASC
LIMIT 1") or throw_exception(mysql_error());
$qNext = awfy_query("SELECT awfy_score.id
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_run.sort_order > ".$run->sort_order()." AND
awfy_run.machine = ".$run->machine_id()." AND
awfy_run.status = 1 AND
awfy_build.mode_id = ".$build->mode_id()." AND
awfy_score.suite_version_id = ".$this->suite_version_id()."
ORDER BY sort_order ASC
LIMIT 1");
if (mysql_num_rows($qNext) == 0)
return null;
$next = mysql_fetch_object($qNext);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("QueuedTask.php");
class TaskQueue {
@ -11,41 +12,41 @@ class TaskQueue {
// Returns if there is a task still running.
function has_active_task() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start > 0 AND
finish = 0
ORDER BY id LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start > 0 AND
finish = 0
ORDER BY id LIMIT 1");
return mysql_num_rows($qTask) != 0;
}
function get_active_task() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start > 0 AND
finish = 0
ORDER BY id LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start > 0 AND
finish = 0
ORDER BY id LIMIT 1");
$task = mysql_fetch_object($qTask);
return new QueuedTask($task->id);
}
function has_queued_tasks() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0
ORDER BY id LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0
ORDER BY id LIMIT 1");
return mysql_num_rows($qTask) != 0;
}
function get_queued_tasks() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0
ORDER BY id") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0
ORDER BY id");
$tasks = Array();
while ($task = mysql_fetch_object($qTask)) {
$tasks[] = QueuedTask::FromId($task->id);
@ -54,10 +55,10 @@ class TaskQueue {
}
function last_tasks($limit = 10) {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id}
ORDER BY id DESC LIMIT $limit") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id}
ORDER BY id DESC LIMIT $limit");
$tasks = Array();
while ($task = mysql_fetch_object($qTask)) {
$tasks[] = QueuedTask::FromId($task->id);
@ -66,23 +67,23 @@ class TaskQueue {
}
function last_finished_task() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
finish > 0
ORDER BY finish DESC LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
finish > 0
ORDER BY finish DESC LIMIT 1");
$task = mysql_fetch_object($qTask);
if (!$task) return null;
return new QueuedTask($task->id);
}
function get_oldest_available_queued_task() {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0 AND
available_at <= UNIX_TIMESTAMP()
ORDER BY id LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_unit_id = {$this->unit_id} AND
start = 0 AND
available_at <= UNIX_TIMESTAMP()
ORDER BY id LIMIT 1");
if (mysql_num_rows($qTask) == 0)
return null;
$task = mysql_fetch_object($qTask);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("../internals.php");
require_once("DB.php");
require_once("Mode.php");
require_once("Machine.php");
@ -118,7 +119,7 @@ class TaskRecipe extends DB {
}
public static function all() {
$qTasks = mysql_query("SELECT id FROM control_task_recipe") or die(mysql_error());
$qTasks = awfy_query("SELECT id FROM control_task_recipe");
$tasks = Array();
while ($task = mysql_fetch_object($qTasks)) {
$tasks[] = new TaskRecipe($task->id);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("internals.php");
require_once("ManipulateTask.php");
require_once("VersionControl.php");
require_once("DB/Mode.php");
@ -18,7 +19,7 @@ class RetriggerController {
$retrigger = new RetriggerController();
$retrigger->unit_id = $unit_id;
$qTask = mysql_query("SELECT * FROM control_tasks WHERE control_unit_id = $unit_id");
$qTask = awfy_query("SELECT * FROM control_tasks WHERE control_unit_id = $unit_id");
while ($task = mysql_fetch_object($qTask)) {
$available_at = 0;
if ($task->delay)
@ -33,7 +34,7 @@ class RetriggerController {
$retrigger = new RetriggerController();
$mode = new Mode($mode_id);
$qTask = mysql_query("SELECT * FROM control_tasks WHERE machine_id = $machine_id") or die(mysql_error());
$qTask = awfy_query("SELECT * FROM control_tasks WHERE machine_id = $machine_id");
while ($task = mysql_fetch_object($qTask)) {
if (!($mode_id == 0 || $task->mode_id == 0 || $task->mode_id == $mode_id))
continue;
@ -65,7 +66,7 @@ class RetriggerController {
return false;
try {
VersionControl::forMode($mode_id);
VersionControl::forMode($mode_id);
} catch(Exception $e) {
return false;
}
@ -80,11 +81,11 @@ class RetriggerController {
$tasks = $retrigger->tasks;
$retrigger->tasks = Array();
foreach ($tasks as $task) {
$qTask = mysql_query("SELECT id
FROM control_task_queue
WHERE control_tasks_id = {$task->control_tasks_id} AND
finish = 0
ORDER BY id LIMIT 1") or die(mysql_error());
$qTask = awfy_query("SELECT id
FROM control_task_queue
WHERE control_tasks_id = {$task->control_tasks_id} AND
finish = 0
ORDER BY id LIMIT 1");
if (mysql_num_rows($qTask) == 0)
$retrigger->tasks[] = $task;
}
@ -178,17 +179,17 @@ class RetriggerController {
throw new Exception("No control_unit specified.");
foreach ($this->tasks as $task) {
mysql_query("INSERT INTO control_task_queue
(control_unit_id, control_tasks_id, task, output, error, email)
VALUES ({$this->unit_id}, ".$tasks->control_tasks_id().",
'".mysql_escape_string($task->task())."', '', '', '')") or throw_exception(mysql_error());
awfy_query("INSERT INTO control_task_queue
(control_unit_id, control_tasks_id, task, output, error, email)
VALUES ({$this->unit_id}, ".$tasks->control_tasks_id().",
'".mysql_escape_string($task->task())."', '', '', '')");
if ($this->control_tasks_id != 0) {
$available_at = $task->available_at();
if ($available_at < time())
if ($available_at < time())
$available_at = "UNIX_TIMESTAMP()";
mysql_query("UPDATE control_tasks
SET last_scheduled = ".$available_at."
WHERE id = $task->control_tasks_id()") or die(mysql_error());
awfy_query("UPDATE control_tasks
SET last_scheduled = ".$available_at."
WHERE id = $task->control_tasks_id()");
}
}
}
@ -199,13 +200,13 @@ class RetriggerController {
foreach ($this->tasks as $task) {
$available_at = $task->available_at();
if ($available_at < time())
if ($available_at < time())
$available_at = "UNIX_TIMESTAMP()";
mysql_query("INSERT INTO control_task_queue
(control_unit_id, control_tasks_id, task, available_at, output, error, email)
VALUES ({$this->unit_id}, ".$task->control_tasks_id().",
'".mysql_escape_string($task->task())."',".
$available_at.", '', '', '')") or throw_exception(mysql_error());
awfy_query("INSERT INTO control_task_queue
(control_unit_id, control_tasks_id, task, available_at, output, error, email)
VALUES ({$this->unit_id}, ".$task->control_tasks_id().",
'".mysql_escape_string($task->task())."',".
$available_at.", '', '', '')");
if ($task->control_tasks_id != 0) {
$control_tasks = new ControlTasks($task->control_tasks_id());
$control_tasks->updateLastScheduled($available_at);

Просмотреть файл

@ -1,5 +1,6 @@
<?php
require_once("internals.php");
require_once("DB/Run.php");
require_once("DB/Mode.php");
require_once("DB/Build.php");
@ -8,9 +9,9 @@ require_once("VersionControl.php");
class RunReporter {
public static function createForMachine($machine_id) {
$query = mysql_query("SELECT max(sort_order) as maximum
FROM awfy_run
WHERE machine = $machine_id") or die(mysql_error());
$query = awfy_query("SELECT max(sort_order) as maximum
FROM awfy_run
WHERE machine = $machine_id");
$run = mysql_fetch_object($query);
return Run::insert($machine_id, $run->maximum+1);
@ -67,7 +68,7 @@ class RunReporter {
if (!$run->isBuildInfoComplete())
throw new Exception("Encountered an incomplete run.");
$build = Build::withRunAndMode($run->id, $mode_id);
// We can safely ignore runs that have no results with the requested mode_id
@ -94,9 +95,9 @@ class RunReporter {
}
private static function increaseNextSortOrder($machine_id, $sort_order) {
mysql_query("UPDATE awfy_run
SET sort_order = sort_order + 1
WHERE machine = $machine_id AND
sort_order >= $sort_order") or die(mysql_error());
awfy_query("UPDATE awfy_run
SET sort_order = sort_order + 1
WHERE machine = $machine_id AND
sort_order >= $sort_order");
}
}

Просмотреть файл

@ -104,11 +104,17 @@ function GET_string($name)
return "";
}
function awfy_query($query)
{
$result = mysql_query($query) or throw_exception("SQL Error: " . mysql_error());
return $result;
}
function find_vendor_of_mode_id($mode_id)
{
$query = "SELECT vendor_id FROM awfy_mode
WHERE id = $mode_id";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
return 0;
$row = mysql_fetch_array($results);
@ -119,7 +125,7 @@ function find_mode($mode)
{
$query = "SELECT id FROM awfy_mode
WHERE mode = '" . mysql_real_escape_string($mode) . "'";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
return -1;
$row = mysql_fetch_array($results);
@ -130,7 +136,7 @@ function find_build($run_id, $mode_id)
{
$query = "SELECT id FROM awfy_build
WHERE run_id = $run_id and mode_id = $mode_id";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
return 0;
$row = mysql_fetch_array($results);
@ -141,7 +147,7 @@ function find_suite($suite)
{
$query = "SELECT id FROM awfy_suite
WHERE name = '" . mysql_real_escape_string($suite) . "'";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
return -1;
$row = mysql_fetch_array($results);
@ -168,10 +174,10 @@ function find_or_add_suite_version($suite, $version)
if ($suite == "kraken" && $version == "kraken")
$version = "kraken 1.1";
$query = "select id from awfy_suite_version where suite_id = $suite_id and name = '$version'";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1) {
$query = "insert into awfy_suite_version (suite_id, name) values($suite_id, '$version')";
mysql_query($query);
awfy_query($query);
return mysql_insert_id();
}
$row = mysql_fetch_array($results);
@ -184,22 +190,16 @@ function find_or_add_test($suite_version_id, $name)
$name = mysql_real_escape_string($name);
$query = "select id from awfy_suite_test where suite_version_id = $suite_version_id and name = '$name'";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1) {
$query = "insert into awfy_suite_test (suite_version_id, name) values($suite_version_id, '$name')";
mysql_query($query);
awfy_query($query);
return mysql_insert_id();
}
$row = mysql_fetch_array($results);
return intval($row[0]);
}
function awfy_query($query)
{
$result = mysql_query($query) or die(mysql_error());
return $result;
}
if (!function_exists("mysql_connect")) {
/* warning: fatal error "cannot redeclare" if a function was disabled in php.ini with disable_functions:
disable_functions =mysql_connect,mysql_pconnect,mysql_select_db,mysql_ping,mysql_query,mysql_fetch_assoc,mysql_num_rows,mysql_fetch_array,mysql_error,mysql_insert_id,mysql_close,mysql_real_escape_string,mysql_data_seek,mysql_result

Просмотреть файл

@ -16,7 +16,7 @@ $query = "SELECT id, finish_stamp, sort_order FROM `awfy_run`
status = 1
ORDER BY sort_order DESC
LIMIT 1";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) != 1)
die();
$row = mysql_fetch_array($results);
@ -31,7 +31,7 @@ if (!has_permissions()) {
WHERE awfy_suite_version.id = $suiteVersion AND
visible = 1
LIMIT 1";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) != 1)
die();
}
@ -42,7 +42,7 @@ $query = "SELECT mode_id
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE machine = $machine
GROUP BY mode_id";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
die();
$buildIds = Array();
@ -61,7 +61,7 @@ while($row = mysql_fetch_array($results)) {
status = 1
ORDER BY sort_order DESC
LIMIT 1";
$buildInfo = mysql_query($query) or die(mysql_error());
$buildInfo = awfy_query($query);
if (!$buildInfo || mysql_num_rows($buildInfo) != 1)
continue;
$buildRow = mysql_fetch_array($buildInfo);
@ -75,7 +75,7 @@ $data = Array();
$query = "SELECT id, name FROM `awfy_suite_test`
WHERE suite_version_id = $suiteVersion AND
visible = 1";
$tests = mysql_query($query);
$tests = awfy_query($query);
if (!$results || mysql_num_rows($tests) < 1)
die();
while($row = mysql_fetch_array($tests)) {
@ -88,7 +88,7 @@ while($row = mysql_fetch_array($tests)) {
WHERE suite_test_id = ".$suiteTestId." AND
awfy_score.build_id = ".$buildIds[$j]."
LIMIT 1";
$results = mysql_query($query) or die(mysql_error());
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) != 1)
continue;
$row = mysql_fetch_array($results);

Просмотреть файл

@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
error_reporting(-1);
include "../lib/internals.php";
init_database();
@ -19,7 +17,7 @@ $query = "SELECT finish_stamp, sort_order FROM `awfy_run`
status = 1
ORDER BY sort_order DESC
LIMIT 1";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) != 1)
die();
$row = mysql_fetch_array($results);
@ -33,7 +31,7 @@ $query = "SELECT mode_id
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE machine = $machine
GROUP BY mode_id";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
die();
$buildIds = Array();
@ -52,7 +50,7 @@ while($row = mysql_fetch_array($results)) {
status = 1
ORDER BY sort_order DESC
LIMIT 1";
$buildInfo = mysql_query($query) or die(mysql_error());
$buildInfo = awfy_query($query) or die(mysql_error());
if (!$buildInfo || mysql_num_rows($buildInfo) != 1)
continue;
$buildRow = mysql_fetch_array($buildInfo);
@ -64,7 +62,7 @@ while($row = mysql_fetch_array($results)) {
$query = "SELECT suite_version_id FROM `awfy_score`
WHERE build_id IN (".implode(",", $buildIds).")
GROUP BY suite_version_id";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) < 1)
die();
$suiteIds = Array();
@ -75,7 +73,7 @@ while($row = mysql_fetch_array($results)) {
WHERE awfy_suite_version.id = ".$row[0]." AND
awfy_suite.visible = 1
LIMIT 1";
$perm = mysql_query($query);
$perm = awfy_query($query);
if (!$perm || mysql_num_rows($perm) != 1)
continue;
}
@ -90,7 +88,7 @@ for ($i=0; $i < count($suiteIds); $i++) {
WHERE suite_version_id = ".$suiteIds[$i]." AND
build_id = ".$buildIds[$j]."
LIMIT 1";
$results = mysql_query($query);
$results = awfy_query($query);
if (!$results || mysql_num_rows($results) != 1)
continue;
$row = mysql_fetch_array($results);

Просмотреть файл

@ -15,8 +15,8 @@ $regression_id = mysql_real_escape_string($request->regression_id);
$name = mysql_real_escape_string($_SESSION['persona']);
$extra = mysql_real_escape_string($request->extra);
$query = mysql_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())
") or die(mysql_error());
$query = awfy_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())
");

Просмотреть файл

@ -15,16 +15,14 @@ $regression_id = (int)$request->regression_id;
$name = mysql_real_escape_string($_SESSION['persona']);
$bug = (int)$request->bug;
$query = mysql_query("UPDATE awfy_regression SET bug = $bug WHERE id = $regression_id
") or die(mysql_error());
$query = awfy_query("UPDATE awfy_regression SET bug = $bug WHERE id = $regression_id");
if ($bug == 0)
$extra = "Removed the linked bug.";
else
$extra = "Linked regression to #".$bug;
$query = mysql_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())
") or die(mysql_error());
$query = awfy_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())");

Просмотреть файл

@ -16,17 +16,15 @@ $regression_id = (int)$request->regression_id;
foreach($request->noise->score as $score_id => $noise) {
$noise = (int)$noise;
$score_id = (int)$score_id;
$query = mysql_query("UPDATE awfy_regression_score SET noise = $noise
WHERE regression_id = $regression_id AND
score_id = $score_id
") or die(mysql_error());
$query = awfy_query("UPDATE awfy_regression_score SET noise = $noise
WHERE regression_id = $regression_id
AND score_id = $score_id");
}
foreach($request->noise->breakdown as $score_id => $noise) {
$noise = (int)$noise;
$score_id = (int)$score_id;
$query = mysql_query("UPDATE awfy_regression_breakdown SET noise = $noise
WHERE regression_id = $regression_id AND
breakdown_id = $score_id
") or die(mysql_error());
$query = awfy_query("UPDATE awfy_regression_breakdown SET noise = $noise
WHERE regression_id = $regression_id
AND breakdown_id = $score_id ");
}

Просмотреть файл

@ -14,12 +14,10 @@ $request = json_decode($postdata);
$regression_id = (int)$request->regression_id;
$status = mysql_real_escape_string($request->status);
$name = mysql_real_escape_string($request->name);
$query = mysql_query("UPDATE awfy_regression SET status = '$status' WHERE id = $regression_id
") or die(mysql_error());
$query = awfy_query("UPDATE awfy_regression SET status = '$status' WHERE id = $regression_id");
$extra = "Changed status to ".$status;
$query = mysql_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())
") or die(mysql_error());
$query = awfy_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp)
VALUES
('$regression_id', '$name', '$extra', UNIX_TIMESTAMP())");

Просмотреть файл

@ -26,7 +26,7 @@ function prev_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
$query_n = str_replace("$1", $sort_order_id, $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -39,7 +39,7 @@ function prev_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
$query_n = str_replace("$1", $sort_order_id, $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit - count($output) , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -52,7 +52,7 @@ function prev_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
$query_n = str_replace("$1", $sort_order_id, $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit - count($output) , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -81,7 +81,7 @@ function prev_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit =
$query_n = str_replace("$1", $sort_order_id , $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -94,7 +94,7 @@ function prev_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit =
$query_n = str_replace("$1", $sort_order_id , $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit - count($output) , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -107,7 +107,7 @@ function prev_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit =
$query_n = str_replace("$1", $sort_order_id , $query);
$query_n = str_replace("$2", $sort_order_n , $query_n);
$query_n = str_replace("$3", $limit - count($output) , $query_n);
$q = mysql_query($query_n) or die(mysql_error());
$q = awfy_query($query_n);
while ($prevs = mysql_fetch_assoc($q)) {
$output[] = $prevs;
}
@ -116,17 +116,17 @@ function prev_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit =
}
function next_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
$query = mysql_query("SELECT awfy_score.id, score, cset
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE sort_order > ".(int)$sort_order_id." AND
machine = ".(int)$machine." AND
mode_id = ".(int)$mode." AND
suite_version_id = ".(int)$suite." AND
status = 1
ORDER BY sort_order ASC
LIMIT ".(int)$limit) or die(mysql_error());
$query = awfy_query("SELECT awfy_score.id, score, cset
FROM awfy_score
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE sort_order > ".(int)$sort_order_id." AND
machine = ".(int)$machine." AND
mode_id = ".(int)$mode." AND
suite_version_id = ".(int)$suite." AND
status = 1
ORDER BY sort_order ASC
LIMIT ".(int)$limit);
$output = array();
while ($nexts = mysql_fetch_assoc($query)) {
$output[] = $nexts;
@ -135,18 +135,18 @@ function next_($sort_order_id, $machine, $mode, $suite, $limit = 1) {
}
function next_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit = 1) {
$query = mysql_query("SELECT awfy_breakdown.id, awfy_breakdown.score, cset
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE sort_order > ".(int)$sort_order_id." AND
machine = ".(int)$machine." AND
mode_id = ".(int)$mode." AND
suite_test_id = ".(int)$suite_test." AND
status = 1
ORDER BY sort_order ASC
LIMIT ".(int)$limit) or die(mysql_error());
$query = awfy_query("SELECT awfy_breakdown.id, awfy_breakdown.score, cset
FROM awfy_breakdown
INNER JOIN awfy_score ON awfy_score.id = score_id
INNER JOIN awfy_build ON awfy_build.id = awfy_score.build_id
INNER JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE sort_order > ".(int)$sort_order_id." AND
machine = ".(int)$machine." AND
mode_id = ".(int)$mode." AND
suite_test_id = ".(int)$suite_test." AND
status = 1
ORDER BY sort_order ASC
LIMIT ".(int)$limit);
$output = array();
while ($nexts = mysql_fetch_assoc($query)) {
$output[] = $nexts;
@ -155,20 +155,20 @@ function next_suite_test($sort_order_id, $machine, $mode, $suite_test, $limit =
}
function get($db, $id, $field) {
$query = mysql_query("SELECT $field FROM awfy_$db
WHERE id = $id
LIMIT 1");
$query = awfy_query("SELECT $field FROM awfy_$db
WHERE id = $id
LIMIT 1");
$output = mysql_fetch_assoc($query) or die(mysql_error());
return $output[$field];
}
function imm_prev_suite_test($breakdown_id) {
$query = mysql_query("SELECT mode_id, machine, sort_order, suite_test_id
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$breakdown_id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, sort_order, suite_test_id
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$breakdown_id);
$data = mysql_fetch_assoc($query);
$prev = prev_suite_test($data["sort_order"], $data["machine"],
@ -180,11 +180,11 @@ function imm_prev_suite_test($breakdown_id) {
}
function imm_prev_($score_id) {
$query = mysql_query("SELECT mode_id, machine, sort_order, suite_version_id
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$score_id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, sort_order, suite_version_id
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$score_id);
$data = mysql_fetch_assoc($query);
$prev = prev_($data["sort_order"], $data["machine"],

Просмотреть файл

@ -11,7 +11,7 @@ init_database();
$amount = Array();
$query = mysql_query("SELECT awfy_regression.id, build_id FROM awfy_regression
$query = awfy_query("SELECT awfy_regression.id, build_id FROM awfy_regression
INNER JOIN awfy_build ON awfy_build.id = build_id
WHERE (mode_id = 14 OR
mode_id = 28 or
@ -22,13 +22,13 @@ $query = mysql_query("SELECT awfy_regression.id, build_id FROM awfy_regression
status != 'fixed' AND status != 'improvement'");
while ($regs = mysql_fetch_object($query)) {
$qScore = mysql_query("SELECT count(*) as count FROM awfy_regression_score
$qScore = awfy_query("SELECT count(*) as count FROM awfy_regression_score
WHERE regression_id = ".$regs->id);
$score = mysql_fetch_object($qScore);
$qBreakdown = mysql_query("SELECT count(*) as count FROM awfy_regression_breakdown
$qBreakdown = awfy_query("SELECT count(*) as count FROM awfy_regression_breakdown
WHERE regression_id = ".$regs->id);
$breakdown = mysql_fetch_object($qBreakdown);
$qDate = mysql_query("SELECT finish_stamp FROM awfy_build
$qDate = awfy_query("SELECT finish_stamp FROM awfy_build
LEFT JOIN awfy_run ON awfy_run.id = awfy_build.run_id
WHERE awfy_build.id = ".$regs->build_id);
$date = mysql_fetch_object($qDate);

Просмотреть файл

@ -12,10 +12,10 @@ $postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$query = mysql_query("SELECT *
FROM awfy_regression_status
WHERE regression_id = '".(int)$request->id."'
ORDER BY stamp DESC") or die(mysql_error());
$query = awfy_query("SELECT *
FROM awfy_regression_status
WHERE regression_id = '".(int)$request->id."'
ORDER BY stamp DESC");
$data = array();
while ($output = mysql_fetch_assoc($query)) {

Просмотреть файл

@ -57,8 +57,8 @@ for ($i=0; $i < count($ids); $i++) {
$db_build->mode_id())
);
$qScores = mysql_query("SELECT * FROM awfy_regression_score
WHERE regression_id = '".$regression["id"]."'") or die(mysql_error());
$qScores = awfy_query("SELECT * FROM awfy_regression_score
WHERE regression_id = '".$regression["id"]."'");
while ($scores = mysql_fetch_assoc($qScores)) {
$suite_version_id = get("score", $scores["score_id"], "suite_version_id");
$score = array(
@ -68,11 +68,11 @@ for ($i=0; $i < count($ids); $i++) {
"noise" => $scores["noise"]
);
$qPrevScore = mysql_query("SELECT score
FROM awfy_score
WHERE build_id = ".$db_prev_build->id." AND
suite_version_id = ".$suite_version_id."
LIMIT 1") or die(mysql_error());
$qPrevScore = awfy_query("SELECT score
FROM awfy_score
WHERE build_id = ".$db_prev_build->id." AND
suite_version_id = ".$suite_version_id."
LIMIT 1");
if (mysql_num_rows($qPrevScore) == 1) {
$prevScore = mysql_fetch_assoc($qPrevScore);
$score["prev_score"] = $prevScore["score"];
@ -81,8 +81,8 @@ for ($i=0; $i < count($ids); $i++) {
$regression["scores"][] = $score;
}
$qScores = mysql_query("SELECT * FROM awfy_regression_breakdown
WHERE regression_id = '".$db_regression->id."'") or die(mysql_error());
$qScores = awfy_query("SELECT * FROM awfy_regression_breakdown
WHERE regression_id = '".$db_regression->id."'");
while ($scores = mysql_fetch_assoc($qScores)) {
$suite_test_id = get("breakdown", $scores["breakdown_id"], "suite_test_id");
$suite_version_id = get("suite_test", $suite_test_id, "suite_version_id");
@ -94,12 +94,12 @@ for ($i=0; $i < count($ids); $i++) {
"noise" => $scores["noise"]
);
$qPrevScore = mysql_query("SELECT awfy_breakdown.score
FROM awfy_breakdown
LEFT JOIN awfy_score ON score_id = awfy_score.id
WHERE awfy_score.build_id = ".$db_prev_build->id." AND
suite_test_id = ".$suite_test_id."
LIMIT 1") or die(mysql_error());
$qPrevScore = awfy_query("SELECT awfy_breakdown.score
FROM awfy_breakdown
LEFT JOIN awfy_score ON score_id = awfy_score.id
WHERE awfy_score.build_id = ".$db_prev_build->id." AND
suite_test_id = ".$suite_test_id."
LIMIT 1");
if (mysql_num_rows($qPrevScore) == 1) {
$prevScore = mysql_fetch_assoc($qPrevScore);
$score["prev_score"] = $prevScore["score"];
@ -109,10 +109,10 @@ for ($i=0; $i < count($ids); $i++) {
$regression["scores"][] = $score;
}
if (!$minimal) {
$qStatus = mysql_query("SELECT * FROM awfy_regression_status
WHERE regression_id = '".$db_prev_build->id."'
ORDER BY stamp DESC
LIMIT 1") or die(mysql_error());
$qStatus = awfy_query("SELECT * FROM awfy_regression_status
WHERE regression_id = '".$db_prev_build->id."'
ORDER BY stamp DESC
LIMIT 1");
$status = mysql_fetch_assoc($qStatus);
$regression["status_extra"] = $status["extra"];
}

Просмотреть файл

@ -17,31 +17,30 @@ $request->mode = (int) $request->mode;
if (isset($request->rev)) {
$request->rev = preg_replace("/[^A-Za-z0-9]/", "", $request->rev);
$query = mysql_query("SELECT awfy_build.id
FROM `awfy_build`
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE machine = ".$request->machine." AND
mode_id = ".$request->mode." AND
rev = ".$request->rev."
LIMIT 1
") or die(mysql_error());
$query = awfy_query("SELECT awfy_build.id
FROM `awfy_build`
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE machine = ".$request->machine." AND
mode_id = ".$request->mode." AND
rev = ".$request->rev."
LIMIT 1 ");
$data = mysql_fetch_assoc($query);
} else {
$query = mysql_query("SELECT awfy_build.id
$query = awfy_query("SELECT awfy_build.id
FROM `awfy_build`
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE machine = ".$request->machine." AND
mode_id = ".$request->mode." AND
status = 1
ORDER BY sort_order DESC
LIMIT 1") or die(mysql_error());
LIMIT 1");
$data = mysql_fetch_assoc($query);
}
$all_scores = Array();
$qScores = mysql_query("SELECT *
FROM awfy_score
WHERE build_id = ".$data["id"]) or die(mysql_error());
$qScores = awfy_query("SELECT *
FROM awfy_score
WHERE build_id = ".$data["id"]);
while ($scores = mysql_fetch_assoc($qScores)) {
$score = array(
"suite_version" => $scores["suite_version_id"],
@ -51,10 +50,11 @@ while ($scores = mysql_fetch_assoc($qScores)) {
$all_scores[] = $score;
}
$qScores = mysql_query("SELECT awfy_breakdown.*
FROM awfy_breakdown
LEFT JOIN awfy_score ON awfy_score.id = score_id
WHERE build_id = ".$data["id"]) or die(mysql_error());
$qScores = awfy_query("SELECT awfy_breakdown.*
FROM awfy_breakdown
LEFT JOIN awfy_score ON awfy_score.id = score_id
WHERE build_id = ".$data["id"]);
while ($scores = mysql_fetch_assoc($qScores)) {
$suite_version_id = get("suite_test", $scores["suite_test_id"], "suite_version_id");
$score = array(

Просмотреть файл

@ -17,12 +17,12 @@ if (!isset($request->subtest))
$request->subtest = false;
if ($request->subtest == 1 || $request->subtest == 'true') {
$query = mysql_query("SELECT mode_id, machine, finish_stamp as stamp, awfy_breakdown.score, suite_test_id, sort_order
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$request->id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, finish_stamp as stamp, awfy_breakdown.score, suite_test_id, sort_order
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$request->id);
$data = mysql_fetch_assoc($query);
$prev = prev_suite_test($data["sort_order"], $data["machine"],
@ -35,11 +35,11 @@ if ($request->subtest == 1 || $request->subtest == 'true') {
die(json_encode($data));
} else {
$query = mysql_query("SELECT mode_id, machine, finish_stamp as stamp, score, suite_version_id, sort_order
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$request->id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, finish_stamp as stamp, score, suite_version_id, sort_order
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$request->id);
$data = mysql_fetch_assoc($query);
$prev = prev_($data["sort_order"], $data["machine"],

Просмотреть файл

@ -42,12 +42,12 @@ if ($bug === 0)
if (count($where) == 0)
die();
$query = mysql_query("SELECT awfy_regression.id
FROM awfy_regression
INNER JOIN awfy_build ON build_id = awfy_build.id
INNER JOIN awfy_run ON run_id = awfy_run.id
WHERE ".(join(" AND ", $where))."
ORDER BY awfy_run.sort_order DESC") or die(mysql_error());
$query = awfy_query("SELECT awfy_regression.id
FROM awfy_regression
INNER JOIN awfy_build ON build_id = awfy_build.id
INNER JOIN awfy_run ON run_id = awfy_run.id
WHERE ".(join(" AND ", $where))."
ORDER BY awfy_run.sort_order DESC");
$data = Array();
while ($output = mysql_fetch_assoc($query)) {
$data[] = $output["id"];

Просмотреть файл

@ -18,12 +18,12 @@ if (!isset($request->subtest))
$prev_build_id = 0;
if ($request->subtest == 1 || $request->subtest == 'true') {
$query = mysql_query("SELECT mode_id, machine, sort_order, awfy_breakdown.score, suite_test_id, build_id
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$request->id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, sort_order, awfy_breakdown.score, suite_test_id, build_id
FROM `awfy_breakdown`
LEFT JOIN awfy_score ON awfy_score.id = score_id
LEFT JOIN awfy_build ON awfy_build.id = awfy_score.build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_breakdown.id = ".$request->id);
$data = mysql_fetch_assoc($query);
$prev = prev_suite_test($data["sort_order"], $data["machine"],
@ -35,11 +35,11 @@ if ($request->subtest == 1 || $request->subtest == 'true') {
}
$build_id = $data["build_id"];
} else {
$query = mysql_query("SELECT mode_id, machine, sort_order, score, suite_version_id, build_id
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$request->id) or die(mysql_error());
$query = awfy_query("SELECT mode_id, machine, sort_order, score, suite_version_id, build_id
FROM `awfy_score`
LEFT JOIN awfy_build ON awfy_build.id = build_id
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE awfy_score.id = ".$request->id);
$data = mysql_fetch_assoc($query);
$prev = prev_($data["sort_order"], $data["machine"],
@ -51,12 +51,14 @@ if ($request->subtest == 1 || $request->subtest == 'true') {
$build_id = $data["build_id"];
}
$query = mysql_query("SELECT id FROM awfy_regression
WHERE build_id = ".$build_id." AND
prev_build_id = ".$prev_build_id);
$query = awfy_query("SELECT id FROM awfy_regression
WHERE build_id = ".$build_id." AND
prev_build_id = ".$prev_build_id);
if (mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO awfy_regression
(build_id, prev_build_id, status) VALUES (".$build_id.",".$prev_build_id.",'unconfirmed')") or die(mysql_error());
awfy_query("INSERT INTO awfy_regression
(build_id, prev_build_id, status)
VALUES
(".$build_id.",".$prev_build_id.",'unconfirmed')");
$regression_id = mysql_insert_id();
} else {
$data = mysql_fetch_assoc($query);
@ -67,28 +69,28 @@ if ($request->subtest == 1 || $request->subtest == 'true') {
$suite_test_id = get("breakdown", $request->id, "suite_test_id");
$suite = get("suite_test", $suite_test_id, "name");
$query = mysql_query("SELECT id FROM awfy_regression_breakdown
WHERE breakdown_id = ".$request->id." AND
regression_id = ".$regression_id);
$query = awfy_query("SELECT id FROM awfy_regression_breakdown
WHERE breakdown_id = ".$request->id." AND
regression_id = ".$regression_id);
if (mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO awfy_regression_breakdown
(regression_id, breakdown_id) VALUES (".$regression_id.",".$request->id.")");
awfy_query("INSERT INTO awfy_regression_breakdown
(regression_id, breakdown_id) VALUES (".$regression_id.",".$request->id.")");
}
} else {
$suite_version_id = get("score", $request->id, "suite_version_id");
$suite = get("suite_version", $suite_version_id, "name");
$query = mysql_query("SELECT id FROM awfy_regression_score
WHERE score_id = ".$request->id." AND
regression_id = ".$regression_id);
$query = awfy_query("SELECT id FROM awfy_regression_score
WHERE score_id = ".$request->id." AND
regression_id = ".$regression_id);
if (mysql_num_rows($query) == 0) {
mysql_query("INSERT INTO awfy_regression_score
(regression_id, score_id) VALUES (".$regression_id.",".$request->id.")");
awfy_query("INSERT INTO awfy_regression_score
(regression_id, score_id) VALUES (".$regression_id.",".$request->id.")");
}
}
mysql_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp) VALUES
(".$regression_id.",'".username()."','Reported ".$suite." regression', UNIX_TIMESTAMP())");
awfy_query("INSERT INTO awfy_regression_status
(regression_id, name, extra, stamp) VALUES
(".$regression_id.",'".username()."','Reported ".$suite." regression', UNIX_TIMESTAMP())");
echo $regression_id;