Changeset 3026 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-svn.php
- Timestamp:
- 04/27/2016 06:01:49 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-svn.php
r2999 r3026 9 9 class SVN { 10 10 11 public static function add( $dirs, $args = array() ) { 12 return true; 11 /** 12 * Create an SVN Export of a local directory to a URL. 13 * 14 * Note: An exception will be thrown upon SVN error. 15 * 16 * @param string $path The local folder to import into SVN. 17 * @param string $url The URL to import to. 18 * @param array $options A list of options to pass to SVN. Optional. 19 * 20 * @return array { 21 * @type bool $result The result of the operation. 22 * @type int $revision The revision imported. 23 * } 24 */ 25 public static function import( $path, $url, $options = array() ) { 26 $esc_options = self::parse_esc_parameters( $options ); 27 28 $esc_path = escapeshellarg( $path ); 29 $esc_url = escapeshellarg( $url ); 30 31 $output = shell_exec( "svn import $esc_options $esc_path $esc_url 2>&1" ); 32 if ( preg_match( '/Committed revision (?P<revision>\d+)[.]/i', $output, $m ) ) { 33 $revision = (int) $m['revision']; 34 $result = true; 35 } else { 36 $result = false; 37 $errors = self::parse_svn_errors( $output ); 38 } 39 40 return compact( 'result', 'revision', 'errors' ); 13 41 } 14 42 … … 40 68 $result = false; 41 69 $errors = self::parse_svn_errors( $output ); 42 43 70 } 44 71 … … 84 111 } 85 112 86 public static function mkdir( $dirs, $args = array() ) {87 return true;88 }89 90 113 /** 91 114 * Parse and escape the provided SVN arguements for usage on the CLI. … … 109 132 $key = '-' . ( strlen( $key ) > 2 ? '-' : '' ) . $key; 110 133 } 111 134 112 135 $result[] = escapeshellarg( $key ) . ( $no_parameters ? '' : '=' . escapeshellarg( $value ) ); 113 136 }
Note: See TracChangeset
for help on using the changeset viewer.