Plugin Directory

Changeset 1324223


Ignore:
Timestamp:
01/08/2016 08:18:45 PM (10 years ago)
Author:
bostonu
Message:

bu-section-editing: v0.9.5 - fix slow queries for large sites

Location:
bu-section-editing/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bu-section-editing/trunk/bin/install-wp-tests.sh

    r1048312 r1324223  
    1313
    1414WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
    15 WP_CORE_DIR=/tmp/wordpress/
     15WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
     16
     17download() {
     18    if [ `which curl` ]; then
     19        curl -s "$1" > "$2";
     20    elif [ `which wget` ]; then
     21        wget -nv -O "$2" "$1"
     22    fi
     23}
     24
     25if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
     26    WP_TESTS_TAG="tags/$WP_VERSION"
     27else
     28    # http serves a single offer, whereas https serves multiple. we only want one
     29    download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
     30    grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
     31    LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
     32    if [[ -z "$LATEST_VERSION" ]]; then
     33        echo "Latest WordPress version could not be found"
     34        exit 1
     35    fi
     36    WP_TESTS_TAG="tags/$LATEST_VERSION"
     37fi
    1638
    1739set -ex
    1840
    1941install_wp() {
     42
     43    if [ -d $WP_CORE_DIR ]; then
     44        return;
     45    fi
     46
    2047    mkdir -p $WP_CORE_DIR
    2148
    22     if [ $WP_VERSION == 'latest' ]; then 
     49    if [ $WP_VERSION == 'latest' ]; then
    2350        local ARCHIVE_NAME='latest'
    2451    else
     
    2653    fi
    2754
    28     wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
     55    download https://wordpress.org/${ARCHIVE_NAME}.tar.gz  /tmp/wordpress.tar.gz
    2956    tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
    3057
    31     wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
     58    download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
    3259}
    3360
     
    4067    fi
    4168
    42     # set up testing suite
    43     mkdir -p $WP_TESTS_DIR
     69    # set up testing suite if it doesn't yet exist
     70    if [ ! -d $WP_TESTS_DIR ]; then
     71        # set up testing suite
     72        mkdir -p $WP_TESTS_DIR
     73        svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
     74    fi
     75
    4476    cd $WP_TESTS_DIR
    45     svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
    4677
    47     wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
    48     sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
    49     sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php
    50     sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php
    51     sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php
    52     sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php
     78    if [ ! -f wp-tests-config.php ]; then
     79        download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
     80        sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
     81        sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
     82        sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
     83        sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
     84        sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
     85    fi
     86
    5387}
    5488
     
    6195
    6296    if ! [ -z $DB_HOSTNAME ] ; then
    63         if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then
     97        if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
    6498            EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
    6599        elif ! [ -z $DB_SOCK_OR_PORT ] ; then
  • bu-section-editing/trunk/bu-section-editing.php

    r1146694 r1324223  
    66Author URI: http://sites.bu.edu/web/
    77Description: Enhances WordPress content editing workflow by providing section editing groups and permissions
    8 Version: 0.9.4
     8Version: 0.9.5
    99Text Domain: bu-section-editing
    1010Domain Path: /languages
     
    3333@author Gregory Cornelius <gcorne@gmail.com>
    3434@author Mike Burns <mgburns@bu.edu>
     35@author Andrew Bauer <awbauer@bu.edu>
    3536*/
    3637
     
    5354    public static $upgrader;
    5455
    55     const BUSE_VERSION = '0.9.4';
     56    const BUSE_VERSION = '0.9.5';
    5657    const BUSE_VERSION_OPTION = '_buse_version';
    5758
  • bu-section-editing/trunk/classes.groups.php

    r682137 r1324223  
    295295     * Get allowed post count, optionally filtered by user ID, group or post_type
    296296     *
    297      * @todo implement cacheing with md5 of args
    298      * @todo re-examine and optimize this query
     297     * @todo implement caching with md5 of args
    299298     * @todo possibly move to BU_Group_Permissions
    300299     *
     
    386385        }
    387386
    388         $count_query = sprintf( "SELECT DISTINCT( ID ) FROM %s, %s WHERE ID = post_ID AND ( meta_key = '%s' AND meta_value IN (%s) %s) %s",
     387        $count_query = sprintf( "SELECT ID FROM %s WHERE ( ID IN ( SELECT post_ID from %s WHERE meta_key = '%s' AND meta_value IN (%s) ) %s) %s",
    389388            $wpdb->posts,
    390389            $wpdb->postmeta,
  • bu-section-editing/trunk/languages/bu-section-editing.pot

    r1146694 r1324223  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: BU Section Editing 0.9.4\n"
     5"Project-Id-Version: BU Section Editing 0.9.5\n"
    66"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/bu-section-"
    77"editing\n"
  • bu-section-editing/trunk/package.json

    r1146694 r1324223  
    11{
    22  "name": "bu-section-editing",
    3   "version": "0.9.4",
     3  "version": "0.9.5",
    44  "description": "Enhances WordPress content editing workflow by providing section editing groups and permissions",
    55  "main": "bu-section-editing.php",
  • bu-section-editing/trunk/readme.txt

    r1146694 r1324223  
    33Tags: permissions, section, access, acl, user management, custom roles, content editing, workflow, boston university, bu
    44Requires at least: 3.1
    5 Tested up to: 4.2
    6 Stable tag: 0.9.4
     5Tested up to: 4.4.1
     6Stable tag: 0.9.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6464== Changelog ==
    6565
     66= 0.9.5 =
     67* Fixed slow SQL affecting large sites
     68* Confirmed 4.4.1 compatibility
     69
    6670= 0.9.4 =
    6771* Confirmed 4.2 compatibility
  • bu-section-editing/trunk/tests/phpunit/test-roles-caps.php

    r1048312 r1324223  
    1616        $upgrader->populate_roles();
    1717
    18         $this->groups = array();
     18        $this->groups   = array();
     19        $this->users    = array();
     20        $this->posts    = array();
     21        $this->pages    = array();
     22
    1923        $pages = array(
    2024            'top-level1' => array(
     
    7276        $this->addUser('section_editor1');
    7377        $this->addUser('section_editor2');
     78       
    7479        $section_editor1 = get_user_by('login', 'section_editor1');
    7580        $section_editor2 = get_user_by('login', 'section_editor2');
     81       
    7682        $this->insertPosts($pages, 'page');
    7783        $this->insertPosts($posts, 'post');
Note: See TracChangeset for help on using the changeset viewer.