Skip to content

Commit 18a7a97

Browse files
committed
Gitlab: update to use Git base class
1 parent 63e7e43 commit 18a7a97

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

SourceGitlab/SourceGitlab.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44
# Copyright (c) 2014 Bob Clough
55
# Licensed under the MIT license
66

7-
if ( false === include_once( config_get( 'plugin_path' ) . 'Source/MantisSourcePlugin.class.php' ) ) {
7+
if ( false === include_once( config_get( 'plugin_path' ) . 'Source/MantisSourceGitBasePlugin.class.php' ) ) {
88
return;
99
}
1010

1111
require_once( config_get( 'core_path' ) . 'url_api.php' );
1212
require_once( config_get( 'core_path' ) . 'json_api.php' );
1313

14-
class SourceGitlabPlugin extends MantisSourcePlugin {
14+
class SourceGitlabPlugin extends MantisSourceGitBasePlugin {
1515

16-
const PLUGIN_VERSION = '1.0.5';
17-
const FRAMEWORK_VERSION_REQUIRED = '1.3.2';
18-
19-
const ERROR_INVALID_PRIMARY_BRANCH = 'invalid_branch';
16+
const PLUGIN_VERSION = '1.1.0';
17+
const FRAMEWORK_VERSION_REQUIRED = '1.5.0';
2018

2119
public function register() {
2220
$this->name = plugin_lang_get( 'title' );
@@ -33,16 +31,6 @@ public function register() {
3331
$this->url = 'https://github.com/mantisbt-plugins/source-integration/';
3432
}
3533

36-
public function errors() {
37-
$t_errors_list = array(
38-
self::ERROR_INVALID_PRIMARY_BRANCH,
39-
);
40-
foreach( $t_errors_list as $t_error ) {
41-
$t_errors[$t_error] = plugin_lang_get( 'error_' . $t_error );
42-
}
43-
return $t_errors;
44-
}
45-
4634
public $type = 'gitlab';
4735

4836
public function show_type() {
@@ -193,11 +181,9 @@ public function update_repo( $p_repo ) {
193181
}
194182
}
195183
}
196-
$f_master_branch = gpc_get_string( 'master_branch' );
197184

198-
if ( !preg_match( '/^(\*|[a-zA-Z0-9_\., -]*)$/', $f_master_branch ) ) {
199-
plugin_error( self::ERROR_INVALID_PRIMARY_BRANCH );
200-
}
185+
$f_master_branch = gpc_get_string( 'master_branch' );
186+
$this->validate_branch_list( $f_master_branch );
201187

202188
# Update other fields
203189
$p_repo->info['hub_repoid'] = $f_hub_repoid;

SourceGitlab/lang/strings_english.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ $s_plugin_SourceGitlab_hub_app_secret = 'GitLab API Key<br /><span class="small"
1616
$s_plugin_SourceGitlab_master_branch = 'Primary Branches<br/><span class="small">(comma-separated list or *)</span>';
1717

1818
$s_plugin_SourceGitlab_back_repo = 'Back to Repository';
19-
20-
$s_plugin_SourceGitlab_error_invalid_branch = 'Invalid character in Primary Branch';

SourceGitlab/lang/strings_german.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ $s_plugin_SourceGitlab_hub_app_secret = 'GitLab API Key<br /><span class="small"
1515
$s_plugin_SourceGitlab_master_branch = 'Hauptzweige<br/><span class="small">(Komma-separierte Liste oder *)</span>';
1616

1717
$s_plugin_SourceGitlab_back_repo = 'Zurück zum Repository';
18-
19-
$s_plugin_SourceGitlab_error_invalid_branch = 'Ungültige Zeichen in der Hauptzweige';

0 commit comments

Comments
 (0)