WordPress.org

Making WordPress.org

Changeset 3212


Ignore:
Timestamp:
05/23/2016 02:37:35 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: ZIPs: Handle stable_tag's which are set to things like .12.3 rather than the expected 0.12.3.

See #1578

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
3 edited

Legend:

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

    r3182 r3212  
    385385        $stable_tag = preg_replace( '![^a-z0-9_.-]!i', '', $stable_tag );
    386386
     387        // If the stable_tag begins with a ., we treat it as 0.blah
     388        if ( '.' == substr( $stable_tag, 0, 1 ) ) {
     389            $stable_tag = "0{$stable_tag}";
     390        }
     391
    387392        return $stable_tag;
    388393    }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r3164 r3212  
    231231                )
    232232            );
     233            // Handle tags which we store as 0.blah but are in /tags/.blah
     234            if ( ! $svn_export['result'] && '0.' == substr( $stable_tag, 0, 2 ) ) {
     235                $_stable_tag = substr( $stable_tag, 1 );
     236                $svn_export = SVN::export(
     237                    self::PLUGIN_SVN_BASE . "/{$plugin_slug}/tags/{$_stable_tag}",
     238                    $tmp_dir . '/export',
     239                    array(
     240                        'ignore-externals',
     241                        'depth' => 'files'
     242                    )
     243                );
     244            }
    233245            if ( $svn_export['result'] && false !== $this->find_readme_file( $tmp_dir . '/export' ) ) {
    234246                $exported = true;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php

    r3210 r3212  
    9898
    9999        $res = SVN::export( $svn_url, $build_dir, $svn_params );
     100        // Handle tags which we store as 0.blah but are in /tags/.blah
     101        if ( ! $res['result'] && '0.' == substr( $this->version, 0, 2 ) ) {
     102            $_version = substr( $this->version, 1 );
     103            $svn_url = self::SVN_URL . "/{$this->slug}/tags/{$_version}/";
     104            $res = SVN::export( $svn_url, $build_dir, $svn_params );
     105        }
    100106        if ( ! $res['result'] ) {
    101107            throw new Exception( __METHOD__ . ': ' . $res['errors'][0]['error_message'], 404 );
Note: See TracChangeset for help on using the changeset viewer.