diff --git a/SourceSFSVN/SourceSFSVN.php b/SourceSFSVN/SourceSFSVN.php index b5fba9d..15eb4db 100644 --- a/SourceSFSVN/SourceSFSVN.php +++ b/SourceSFSVN/SourceSFSVN.php @@ -19,6 +19,7 @@ function register() { $this->name = lang_get( 'plugin_SourceSFSVN_title' ); $this->description = lang_get( 'plugin_SourceSFSVN_description' ); + $this->page = 'config_page'; $this->version = '0.13'; $this->requires = array( @@ -31,6 +32,12 @@ $this->url = 'http://leetcode.net'; } + function config() { + return array( + 'svnpath' => '', + ); + } + function get_types( $p_event ) { return array( 'sfsvn' => lang_get( 'plugin_SourceSFSVN_svn' ) ); } @@ -207,14 +214,38 @@ } function check_svn() { - if ( is_blank( `svn help` ) ) { + $svn = $this->svn_call(); + + if ( is_blank( `$svn help` ) ) { trigger_error( ERROR_GENERIC, ERROR ); } } - function svn_call( $p_repo ) { - $t_call = 'svn'; + function svn_call( $p_repo=null ) { + static $s_call; + # Generate, validate, and cache the SVN binary path + if ( is_null( $s_call ) ) { + $t_path = plugin_config_get( 'svnpath' ); + if ( !is_blank( $t_path ) && is_dir( $t_path ) ) { + $s_call = $t_path . DIRECTORY_SEPARATOR . 'svn'; + + if ( !is_file( $s_call ) || !is_executable( $s_call ) ) { + $s_call = 'svn'; + } + + } else { + $s_call = 'svn'; + } + } + + # If not given a repo, just return the base SVN binary + if ( is_null( $p_repo ) ) { + return $s_call; + } + + # With a repo, add arguments for repo info + $t_call = $s_call . ' --non-interactive'; $t_username = $p_repo->info['svn_username']; $t_password = $p_repo->info['svn_password']; @@ -225,6 +256,7 @@ $t_call .= ' --password ' . $t_password; } + # Done return $t_call; } diff --git a/SourceSFSVN/lang/strings_english.txt b/SourceSFSVN/lang/strings_english.txt index ae3782e..0ee2e8d 100644 --- a/SourceSFSVN/lang/strings_english.txt +++ b/SourceSFSVN/lang/strings_english.txt @@ -21,3 +21,7 @@ $s_plugin_SourceSFSVN_sf_project = 'SourceForge Project'; $s_plugin_SourceSFSVN_standard_repo = 'Standard Repository
(trunk/branches/tags)'; +$s_plugin_SourceSFSVN_configuration = 'Configuration'; +$s_plugin_SourceSFSVN_update = 'Configuration'; +$s_plugin_SourceSFSVN_svnpath = 'Path to Subversion CLI'; + diff --git a/SourceSFSVN/pages/config_page.php b/SourceSFSVN/pages/config_page.php new file mode 100644 index 0000000..ab27914 --- /dev/null +++ b/SourceSFSVN/pages/config_page.php @@ -0,0 +1,45 @@ + + +
+
+ + + + + + + +> + + + + + + + + +
+
+ +