WordPress.org

Making WordPress.org


Ignore:
Timestamp:
09/17/2016 12:01:39 PM (4 years ago)
Author:
ocean90
Message:

Rosetta Roles: Adjust Rosetta_Roles::get_translate_projects() to only fetch parent projects with their direct sub-projects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php

    r4084 r4090  
    674674
    675675    /**
    676      * Fetches all projects from translate.wordpress.org.
     676     * Fetches all parent projects and their direct sub-projects like 'wp'
     677     * and 'wp/dev' or 'wp-plugins' and 'wp-plugins/wordpress-importer'.
    677678     *
    678679     * @return array List of projects.
     
    690691        );
    691692
    692         $_projects = $wpdb->get_results( "
     693        $_projects = $wpdb->get_results( '
    693694            SELECT id, name, parent_project_id, slug
    694695            FROM translate_projects
    695             WHERE id NOT IN( " . implode( ',', $ignore_project_ids ) . " )
    696             ORDER BY id ASC
    697         " );
     696            WHERE
     697                id NOT IN(' . implode( ',', $ignore_project_ids ) . ') AND
     698                LENGTH(path) - LENGTH(REPLACE(path, "/", "")) BETWEEN 0 AND 1;
     699        ' );
    698700
    699701        $projects = array();
Note: See TracChangeset for help on using the changeset viewer.