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
1111require_once ( config_get ( 'core_path ' ) . 'url_api.php ' );
1212require_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 ;
0 commit comments