WordPress.org

Making WordPress.org

Changeset 3391


Ignore:
Timestamp:
06/16/2016 04:40:43 PM (5 years ago)
Author:
ocean90
Message:

Plugin Directory: Use the correct table prefix for the GlotPress tables.

See #1691.

File:
1 edited

Legend:

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

    r3326 r3391  
    3434    }
    3535
    36     function __construct( $db, $tracker = null ) {
    37         if ( !empty( $db ) && is_object( $db ) ) {
    38             $this->db = $db;
    39         }
    40 
    41         wp_cache_add_global_groups( $this->i18n_cache_group );
     36    function __construct( $db, $tracker = null ) {
     37        if ( !empty( $db ) && is_object( $db ) ) {
     38            $this->db = $db;
     39        }
     40
     41        wp_cache_add_global_groups( $this->i18n_cache_group );
    4242    }
    4343
     
    116116
    117117        $branch_id = $this->db->get_var( $this->db->prepare(
    118             'SELECT id FROM '.GLOTPRESS_TABLE_PREFIX.'_projects WHERE path = %s',
     118            'SELECT id FROM ' . GLOTPRESS_TABLE_PREFIX . 'projects WHERE path = %s',
    119119            "wp-plugins/{$slug}/{$branch}"
    120120        ) );
     
    162162
    163163        $originals = $this->db->get_results( $this->db->prepare(
    164             'SELECT id, singular, comment FROM '.GLOTPRESS_TABLE_PREFIX.'_originals WHERE project_id = %d AND status = %s ORDER BY CHAR_LENGTH(singular) DESC',
     164            'SELECT id, singular, comment FROM ' . GLOTPRESS_TABLE_PREFIX . 'originals WHERE project_id = %d AND status = %s ORDER BY CHAR_LENGTH(singular) DESC',
    165165            $branch_id, '+active'
    166166        ) );
     
    198198
    199199        $translation_set_id = $this->db->get_var( $this->db->prepare(
    200             'SELECT id FROM '.GLOTPRESS_TABLE_PREFIX.'_translation_sets WHERE project_id = %d AND locale = %s',
     200            'SELECT id FROM ' . GLOTPRESS_TABLE_PREFIX . 'translation_sets WHERE project_id = %d AND locale = %s',
    201201            $branch_id, $locale ) );
    202202
     
    204204            // Don't give up yet. Might be given fr_FR, which actually exists as locale=fr in GP.
    205205            $translation_set_id = $this->db->get_var( $this->db->prepare(
    206                 'SELECT id FROM '.GLOTPRESS_TABLE_PREFIX.'_translation_sets WHERE project_id = %d AND locale = %s',
     206                'SELECT id FROM ' . GLOTPRESS_TABLE_PREFIX . 'translation_sets WHERE project_id = %d AND locale = %s',
    207207                $branch_id, preg_replace( '/^([^-]+)(-.+)?$/', '\1', $locale ) ) );
    208208        }
     
    241241
    242242        $original = $this->db->get_row( $this->db->prepare(
    243             'SELECT id, singular, comment FROM '.GLOTPRESS_TABLE_PREFIX.'_originals WHERE project_id = %d AND status = %s AND singular = %s',
     243            'SELECT id, singular, comment FROM ' . GLOTPRESS_TABLE_PREFIX . 'originals WHERE project_id = %d AND status = %s AND singular = %s',
    244244            $branch_id, '+active', $str
    245245        ) );
     
    350350
    351351            $translation = $this->db->get_var( $this->db->prepare(
    352                 'SELECT translation_0 FROM '.GLOTPRESS_TABLE_PREFIX.'_translations WHERE original_id = %d AND translation_set_id = %d AND status = %s',
     352                'SELECT translation_0 FROM ' . GLOTPRESS_TABLE_PREFIX . 'translations WHERE original_id = %d AND translation_set_id = %d AND status = %s',
    353353                $original->id, $translation_set_id, 'current'
    354354            ) );
     
    385385        return $content;
    386386    }
    387 
    388387}
    389 
Note: See TracChangeset for help on using the changeset viewer.