Permalink
Browse files

Bumping version numbers

Core framework version -> 0.18
Github -> 0.17
Gitweb -> 0.17
WebSVN -> 0.17
  • Loading branch information...
1 parent 3bedecf commit 39b3ca8514e4d127783114559a3c9ef6de4547f0 @dregad dregad committed Feb 22, 2013
Showing with 28 additions and 28 deletions.
  1. +1 −1 Source/Source.php
  2. +20 −20 SourceGithub/SourceGithub.php
  3. +6 −6 SourceGitweb/SourceGitweb.php
  4. +1 −1 SourceWebSVN/SourceWebSVN.php
View
@@ -10,7 +10,7 @@
* with the Mantis bug tracker software.
*/
class SourcePlugin extends MantisPlugin {
- static $framework_version = '0.17';
+ static $framework_version = '0.18';
static $cache = array();
function register() {
@@ -14,10 +14,10 @@ public function register() {
$this->name = plugin_lang_get( 'title' );
$this->description = plugin_lang_get( 'description' );
- $this->version = '0.16';
+ $this->version = '0.17';
$this->requires = array(
'MantisCore' => '1.2.0',
- 'Source' => '0.16',
+ 'Source' => '0.18',
);
$this->author = 'John Reese';
@@ -169,23 +169,23 @@ public function update_repo( $p_repo ) {
private function api_uri( $p_repo, $p_path ) {
$t_uri = 'https://api.github.com/' . $p_path;
-
+
$t_access_token = $p_repo->info['hub_app_access_token'];
if ( !is_blank( $t_access_token ) ) {
$t_uri .= '?access_token=' . $t_access_token;
}
return $t_uri;
}
-
+
private function api_json_url( $p_repo, $p_url, $p_member = null ) {
static $t_start_time;
if ( $t_start_time === null ) {
$t_start_time = microtime( true );
} else if ( ( microtime( true ) - $t_start_time ) >= 3600.0 ) {
$t_start_time = microtime( true );
}
-
+
$t_uri = $this->api_uri( $p_repo, 'rate_limit' );
$t_json = json_url( $t_uri, 'rate' );
if ( false !== $t_json && !is_null( $t_json ) ) {
@@ -197,7 +197,7 @@ private function api_json_url( $p_repo, $p_url, $p_member = null ) {
usleep( $t_sleep_time );
}
}
-
+
return json_url( $p_url, $p_member );
}
@@ -329,12 +329,12 @@ public function import_commits( $p_repo, $p_commit_ids, $p_branch='' ) {
echo "Retrieving $t_commit_id ... ";
$t_uri = $this->api_uri( $p_repo, "repos/$t_username/$t_reponame/commits/$t_commit_id" );
$t_json = $this->api_json_url( $p_repo, $t_uri );
-
+
if ( false === $t_json || is_null( $t_json ) ) {
echo "failed.\n";
continue;
}
-
+
list( $t_changeset, $t_commit_parents ) = $this->json_commit_changeset( $p_repo, $t_json, $p_branch );
if ( $t_changeset ) {
$t_changesets[] = $t_changeset;
@@ -373,7 +373,7 @@ private function json_commit_changeset( $p_repo, $p_json, $p_branch='' ) {
$t_changeset->author_email = $p_json->commit->author->email;
$t_changeset->committer = $p_json->commit->committer->name;
$t_changeset->committer_email = $p_json->commit->committer->email;
-
+
if ( isset( $p_json->files ) ) {
foreach ( $p_json->files as $t_file ) {
switch ( $t_file->status ) {
@@ -399,35 +399,35 @@ private function json_commit_changeset( $p_repo, $p_json, $p_branch='' ) {
return array( null, array() );
}
}
-
+
private function oauth_authorize_uri( $p_repo ) {
$t_hub_app_client_id = null;
$t_hub_app_secret = null;
$t_hub_app_access_token = null;
-
+
if ( isset( $p_repo->info['hub_app_client_id'] ) ) {
$t_hub_app_client_id = $p_repo->info['hub_app_client_id'];
}
if ( isset( $p_repo->info['hub_app_secret'] ) ) {
$t_hub_app_secret = $p_repo->info['hub_app_secret'];
}
-
+
if ( !empty( $t_hub_app_client_id ) && !empty( $t_hub_app_secret ) ) {
return 'https://github.com/login/oauth/authorize?client_id=' . $t_hub_app_client_id . '&redirect_uri=' . urlencode(config_get('path') . 'plugin.php?page=SourceGithub/oauth_authorize&id=' . $p_repo->id ) . '&scope=repo';
} else {
return '';
}
}
-
+
public static function oauth_get_access_token( $p_repo, $p_code ) {
# build the GitHub URL & POST data
$t_url = 'https://github.com/login/oauth/access_token';
$t_post_data = array( 'client_id' => $p_repo->info['hub_app_client_id'],
'client_secret' => $p_repo->info['hub_app_secret'],
'code' => $p_code );
$t_data = self::url_post( $t_url, $t_post_data );
-
+
$t_access_token = '';
if ( !empty( $t_data ) ) {
$t_response = array();
@@ -436,7 +436,7 @@ public static function oauth_get_access_token( $p_repo, $p_code ) {
$t_access_token = $t_response['access_token'];
}
}
-
+
if ( !empty( $t_access_token ) ) {
if ( $t_access_token != $p_repo->info['hub_app_access_token'] ) {
$p_repo->info['hub_app_access_token'] = $t_access_token;
@@ -447,20 +447,20 @@ public static function oauth_get_access_token( $p_repo, $p_code ) {
return false;
}
}
-
+
public static function url_post( $p_url, $p_post_data ) {
$t_post_data = http_build_query( $p_post_data );
-
+
# Use the PHP cURL extension
if( function_exists( 'curl_init' ) ) {
$t_curl = curl_init( $p_url );
curl_setopt( $t_curl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $t_curl, CURLOPT_POST, true );
curl_setopt( $t_curl, CURLOPT_POSTFIELDS, $t_post_data );
-
+
$t_data = curl_exec( $t_curl );
curl_close( $t_curl );
-
+
return $t_data;
} else {
# Last resort system call
@@ -469,5 +469,5 @@ public static function url_post( $p_url, $p_post_data ) {
return shell_exec( 'curl ' . $t_url . ' -d ' . $t_post_data );
}
}
-
+
}
@@ -14,7 +14,7 @@ public function register() {
$this->name = plugin_lang_get( 'title' );
$this->description = plugin_lang_get( 'description' );
- $this->version = '0.16';
+ $this->version = '0.17';
$this->requires = array(
'MantisCore' => '1.2.0',
'Source' => '0.16',
@@ -144,7 +144,7 @@ public function import_full( $p_repo ) {
if ( is_blank( $t_branch ) ) {
$t_branch = 'master';
}
-
+
if ($t_branch != '*')
{
$t_branches = array_map( 'trim', explode( ',', $t_branch ) );
@@ -153,14 +153,14 @@ public function import_full( $p_repo ) {
{
$t_heads_url = $this->uri_base( $p_repo ) . 'a=heads';
$t_branches_input = url_get( $t_heads_url );
-
+
$t_branches_input = str_replace( array("\r", "\n", '&lt;', '&gt;', '&nbsp;'), array('', '', '<', '>', ' '), $t_branches_input );
-
+
$t_branches_input_p1 = strpos( $t_branches_input, '<table class="heads">' );
$t_branches_input_p2 = strpos( $t_branches_input, '<div class="page_footer">' );
$t_gitweb_heads = substr( $t_branches_input, $t_branches_input_p1, $t_branches_input_p2 - $t_branches_input_p1 );
preg_match_all( '/<a class="list name".*>(.*)<\/a>/iU', $t_gitweb_heads, $t_matches, PREG_SET_ORDER );
-
+
$t_branches = array();
foreach ($t_matches as $match)
{
@@ -173,7 +173,7 @@ public function import_full( $p_repo ) {
}
$t_changesets = array();
-
+
$t_changeset_table = plugin_table( 'changeset', 'Source' );
foreach( $t_branches as $t_branch ) {
@@ -12,7 +12,7 @@ public function register() {
$this->name = lang_get( 'plugin_SourceWebSVN_title' );
$this->description = lang_get( 'plugin_SourceWebSVN_description' );
- $this->version = '0.16';
+ $this->version = '0.17';
$this->requires = array(
'MantisCore' => '1.2.0',
'Source' => '0.16',

0 comments on commit 39b3ca8

Please sign in to comment.