Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Trac and Github interface and the sample config file

  • Loading branch information...
commit fb3fa807070414294c54904ee93fc844b07c1719 1 parent be65add
@danielbeardsley danielbeardsley authored
Showing with 23 additions and 13 deletions.
  1. +9 −5 config.php.sample
  2. +2 −1  github.php
  3. +1 −1  ticket.php
  4. +11 −6 trac.php
View
14 config.php.sample
@@ -4,10 +4,14 @@
* Sample configuration file, copy this to config.php and edit
*/
-$repo = 'user/repo';
+$github = new Github(
+ $username = 'username',
+ $password = 'password',
+ $repo = 'user/reponame');
-Trac::$host = 'Trac MySQL host';
-Trac::$user = 'Trac MySQL user';
-Trac::$password = 'Trac MySQL password';
-Trac::$db = 'Trac MySQL database name';
+Trac::init(
+ $host = 'localhost',
+ $user = 'Trac MySQL user',
+ $password = 'Trac MySQL password',
+ $db = 'trac');
View
3  github.php
@@ -5,9 +5,10 @@ class Github {
private $username;
private $password;
- public function __construct($username, $password) {
+ public function __construct($username, $password, $repo) {
$this->username = $username;
$this->password = $password;
+ $this->repo = $repo;
}
public function post($url, $json, $patch = false) {
View
2  ticket.php
@@ -8,7 +8,7 @@ class Ticket {
public static function loadFromTrac($id) {
$q_select = "SELECT * FROM `ticket` WHERE `id` = $id";
- $result = Trac::execute($q_select);
+ $result = Trac::query($q_select);
return $result ? new self($result) : null;
}
View
17 trac.php
@@ -1,18 +1,23 @@
<?php
class Trac {
-
public static $host;
public static $user;
public static $db;
private static $db;
- public static function init() {
+ public static function init($host, $dbname, $user, $password) {
self::$db = new PDO(
- 'mysqlhost='.self::$host.
- ';dbname='.self::$db,i
- self::$user,
- self::$password);
+ 'mysqlhost='.$host.
+ ';dbname='.$dbname,
+ $user,
+ $password);
+ }
+
+ public static function query($statement) {
+ $resultSet = self::$db->query($statement);
+
+ return $resultSet->fetchAll();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.