Implemented the bug report Qt app and an example web app that takes the report.
--HG-- branch : hotfixhg/compatibility
parent
8208a473c4
commit
a6ee23ebe4
@ -0,0 +1,33 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_DATA
|
||||
#define RCERROR_DATA
|
||||
|
||||
#include <QString.h>
|
||||
|
||||
|
||||
struct RCErrorData
|
||||
{
|
||||
QString description;
|
||||
QString report;
|
||||
QString email;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class BugReportConfig
|
||||
{
|
||||
static public $dbhost = "localhost";
|
||||
static public $dbport = "3306";
|
||||
static public $dbdb = "bugs";
|
||||
static public $dbuser = "bugs";
|
||||
static public $dbpw = "bugs";
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/// Simple file logger class
|
||||
class Logger
|
||||
{
|
||||
private $lf = NULL;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->lf = fopen( 'log.txt', 'a' );
|
||||
if( $this->lf === FALSE )
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
function __destruct()
|
||||
{
|
||||
fclose( $this->lf );
|
||||
}
|
||||
|
||||
public function log( $msg )
|
||||
{
|
||||
$date = date( "[M d, Y H:i:s] " );
|
||||
fwrite( $this->lf, $date . $msg . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require_once( 'config.inc.php' );
|
||||
require_once( 'log.inc.php' );
|
||||
|
||||
/// Example web application that takes bug reports from the bug reporter Qt app
|
||||
class BugReportGatherApp
|
||||
{
|
||||
private $db = NULL;
|
||||
private $logger = NULL;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->logger = new Logger();
|
||||
}
|
||||
|
||||
private function logPOSTVars()
|
||||
{
|
||||
$report = "";
|
||||
$descr = "";
|
||||
$email = "";
|
||||
|
||||
if( isset( $_POST[ 'report' ] ) )
|
||||
$report = $_POST[ 'report' ];
|
||||
|
||||
if( isset( $_POST[ 'descr' ] ) )
|
||||
$descr = $_POST[ 'descr' ];
|
||||
|
||||
if( isset( $_POST[ 'email' ] ) )
|
||||
$email = $_POST[ 'email' ];
|
||||
|
||||
$this->logger->log( 'report: ' . "\n" . $report );
|
||||
$this->logger->log( 'description: ' . "\n" . $descr );
|
||||
$this->logger->log( 'email: ' . "\n" . $email );
|
||||
}
|
||||
|
||||
private function buildQuery()
|
||||
{
|
||||
$report = "";
|
||||
$descr = "";
|
||||
$email = "";
|
||||
|
||||
if( isset( $_POST[ 'report' ] ) )
|
||||
$report = $_POST[ 'report' ];
|
||||
|
||||
if( isset( $_POST[ 'descr' ] ) )
|
||||
$descr = $_POST[ 'descr' ];
|
||||
|
||||
if( isset( $_POST[ 'email' ] ) )
|
||||
$email = $_POST[ 'email' ];
|
||||
|
||||
$report = $this->db->real_escape_string( $report );
|
||||
$descr = $this->db->real_escape_string( $descr );
|
||||
$email = $this->db->real_escape_string( $email );
|
||||
|
||||
|
||||
$q = "INSERT INTO `bugs` (`report`,`description`,`email`) VALUES (";
|
||||
$q .= "'$report',";
|
||||
$q .= "'$descr',";
|
||||
$q .= "'$email')";
|
||||
|
||||
return $q;
|
||||
}
|
||||
|
||||
public function exec()
|
||||
{
|
||||
//$this->logPOSTVars();
|
||||
|
||||
$this->db = new mysqli( BugReportConfig::$dbhost, BugReportConfig::$dbuser, BugReportConfig::$dbpw, BugReportConfig::$dbdb, BugReportConfig::$dbport );
|
||||
if( mysqli_connect_error() )
|
||||
{
|
||||
$this->logger->log( "Connection error :(" );
|
||||
$this->logger->log( mysqli_connect_error() );
|
||||
return;
|
||||
}
|
||||
|
||||
$q = $this->buildQuery();
|
||||
$result = $this->db->query( $q );
|
||||
if( $result !== TRUE )
|
||||
{
|
||||
$this->logger->log( "Query failed :(" );
|
||||
$this->logger->log( 'Query: ' . $q );
|
||||
$this->logPOSTVars();
|
||||
}
|
||||
|
||||
$this->db->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$app = new BugReportGatherApp();
|
||||
$app->exec();
|
||||
|
||||
?>
|
@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head><title>Ryzom Core Error Report Web application test harness</title></head>
|
||||
<body>
|
||||
<form action="r.php" method="post">
|
||||
<table border="0">
|
||||
<tr><td>Description</td></tr>
|
||||
<tr><td><textarea name="descr">Something something dark side</textarea></td></tr>
|
||||
<tr><td>Report</td></tr>
|
||||
<tr><td><textarea name="report">Mani bad crashes :(</textarea></td></tr>
|
||||
<tr><td>Email</td></tr>
|
||||
<tr><td>
|
||||
<input type="text" name="email" value="e@ma.il"/>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><input type="submit" value="report"/></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue