Making WordPress.org


Ignore:
Timestamp:
06/02/2016 08:25:35 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Execute the ZIP & SVN commands with an appropriate UTF-8 character set.

See #1578

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/tools/class-svn.php

    r3215 r3291  
    3333        $esc_url  = escapeshellarg( $url );
    3434
    35         $output = shell_exec( "svn import $esc_options $esc_path $esc_url 2>&1" );
     35        $output = self::shell_exec( "svn import $esc_options $esc_path $esc_url 2>&1" );
    3636        if ( preg_match( '/Committed revision (?P<revision>\d+)[.]/i', $output, $m ) ) {
    3737            $revision = (int) $m['revision'];
     
    6464        $esc_destination = escapeshellarg( $destination );
    6565
    66         $output = shell_exec( "svn export $esc_options $esc_url $esc_destination 2>&1" );
     66        $output = self::shell_exec( "svn export $esc_options $esc_url $esc_destination 2>&1" );
    6767        if ( preg_match( '/Exported revision (?P<revision>\d+)[.]/i', $output, $m ) ) {
    6868            $revision = (int) $m['revision'];
     
    9494        $esc_url = escapeshellarg( $url );
    9595
    96         $output = shell_exec( "svn ls $esc_options $esc_url 2>&1" );
     96        $output = self::shell_exec( "svn ls $esc_options $esc_url 2>&1" );
    9797
    9898        $errors = self::parse_svn_errors( $output );
     
    163163        return false;
    164164    }
     165
     166    /**
     167     * Executes a command with 'proper' locale/language settings
     168     * so that utf8 strings are handled correctly.
     169     *
     170     * WordPress.org uses the en_US.UTF-8 locale.
     171     */
     172    protected static function shell_exec( $command ) {
     173        return shell_exec( 'export LC_CTYPE="en_US.UTF-8" LANG="en_US.UTF-8"; ' . $command );
     174    }
    165175}
Note: See TracChangeset for help on using the changeset viewer.