Database queries should use parameter binding 34

  • Critical
  • Security

More information: https://insight.sensiolabs.com/what-we-analyse/doctrine.database_query_contains_string_and_variable_concatenation

  1. // Don't do an unbounded count on large networks
  2. if ( ! wp_is_large_network() )
  3. $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) );
  4. $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page );

    If provided by the user, the value of intval(($pagenum - 1) * $per_page) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by nacin
  5. $this->items = $wpdb->get_results( $query, ARRAY_A );
  6. if ( wp_is_large_network() )
  7. $total = count($this->items);
  1. // Fake being in the loop.
  2. $wp_query->in_the_loop = true;
  3. // Fetch 20 posts at a time rather than loading the entire table into memory.
  4. while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
  5. $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';

    If provided by the user, the value of join(',', $next_posts) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by nacin
  6. $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
  7. // Begin Loop.
  8. foreach ( $posts as $post ) {
  9. setup_postdata( $post );
  1. * cat IDs to link_category terms.
  2. */
  3. $link_cat_id_map = array();
  4. $default_link_cat = 0;
  5. $tt_ids = array();
  6. $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories');

    If provided by the user, the value of $wpdb->prefix may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  7. foreach ( $link_cats as $category) {
  8. $cat_id = (int) $category->cat_id;
  9. $term_id = 0;
  10. $name = wp_slash($category->cat_name);
  11. $slug = sanitize_title($name);
  1. $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query";
  2. $query .= " $exclusions $inclusions $search";
  3. $query .= " ORDER BY $orderby $order";
  4. if ( $r['limit'] != -1 ) {
  5. $query .= ' LIMIT ' . $r['limit'];

    If provided by the user, the value of $r['limit'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Scott Taylor
  6. }
  7. $results = $wpdb->get_results( $query );
  8. $cache[ $key ] = $results;
  1. $number = absint( $this->query_vars['number'] );
  2. $offset = absint( $this->query_vars['offset'] );
  3. if ( ! empty( $number ) ) {
  4. if ( $offset ) {
  5. $limits = 'LIMIT ' . $offset . ',' . $number;

    If provided by the user, the value of $offset may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by scribu
  6. } else {
  7. $limits = 'LIMIT ' . $number;
  8. }
  9. } else {
  10. $limits = '';
  1. if ( ! empty( $number ) ) {
  2. if ( $offset ) {
  3. $limits = 'LIMIT ' . $offset . ',' . $number;
  4. } else {
  5. $limits = 'LIMIT ' . $number;

    If provided by the user, the value of $number may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by scribu
  6. }
  7. } else {
  8. $limits = '';
  9. }
  1. $order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
  2. $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
  3. $groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
  4. if ( $where ) {
  5. $where = 'WHERE ' . $where;

    If provided by the user, the value of $where may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Boone Gorges
  6. }
  7. if ( $groupby ) {
  8. $groupby = 'GROUP BY ' . $groupby;
  9. }
  1. $r['type'] = 'monthly';
  2. }
  3. if ( ! empty( $r['limit'] ) ) {
  4. $r['limit'] = absint( $r['limit'] );
  5. $r['limit'] = ' LIMIT ' . $r['limit'];

    If provided by the user, the value of $r['limit'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Scott Taylor
  6. }
  7. $order = strtoupper( $r['order'] );
  8. if ( $order !== 'ASC' ) {
  9. $order = 'DESC';
  1. global $wpdb;
  2. $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
  3. foreach ( (array) $blogs as $details ) {
  4. $blog_list[ $details['blog_id'] ] = $details;
  5. $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );

    If provided by the user, the value of $wpdb->get_blog_prefix($details['blog_id']) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  6. }
  7. unset( $blogs );
  8. $blogs = $blog_list;
  9. if ( false == is_array( $blogs ) )
  1. if ( strpos( $blogname, '_' ) !== false )
  2. $errors->add( 'blogname', __( 'Sorry, site names may not contain the character “_”!' ) );
  3. // do not allow users to create a blog that conflicts with a page on the main blog.
  4. if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )

    If provided by the user, the value of $wpdb->get_blog_prefix($current_site->blog_id) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  5. $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
  6. // all numeric?
  7. if ( preg_match( '/^[0-9]*$/', $blogname ) )
  8. $errors->add('blogname', __('Sorry, site names must have letters too!'));
in wp-includes/post.php, line 4601
  1. $sort_order = 'ASC';
  2. }
  3. $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
  4. $query .= $author_query;
  5. $query .= " ORDER BY " . $sort_column . " " . $sort_order ;

    If provided by the user, the value of $sort_column may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  6. if ( ! empty( $number ) ) {
  7. $query .= ' LIMIT ' . $offset . ',' . $number;
  8. }
in wp-includes/post.php, line 4604
  1. $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
  2. $query .= $author_query;
  3. $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
  4. if ( ! empty( $number ) ) {
  5. $query .= ' LIMIT ' . $offset . ',' . $number;

    If provided by the user, the value of $offset may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by westi
  6. }
  7. $pages = $wpdb->get_results($query);
  8. if ( empty($pages) ) {
in wp-includes/query.php, line 3072
  1. $pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
  2. } else { // we're ignoring $page and using 'offset'
  3. $q['offset'] = absint($q['offset']);
  4. $pgstrt = $q['offset'] . ', ';
  5. }
  6. $limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];

    If provided by the user, the value of $pgstrt may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. }
  8. // Comments feeds
  9. if ( $this->is_comment_feed && ! $this->is_singular ) {
  10. if ( $this->is_archive || $this->is_search ) {
in wp-includes/query.php, line 3136
  1. * @since 2.8.0
  2. *
  3. * @param string $climits The JOIN clause of the query.
  4. * @param WP_Query &$this The WP_Query instance (passed by reference).
  5. */
  6. $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );

    If provided by the user, the value of get_option('posts_per_rss') may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Drew Jaynes
  7. }
  8. $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
  9. $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
  10. $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
in wp-includes/query.php, line 3139
  1. * @param WP_Query &$this The WP_Query instance (passed by reference).
  2. */
  3. $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
  4. }
  5. $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
  6. $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';

    If provided by the user, the value of $corderby may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  7. $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
  8. $this->comment_count = count($this->comments);
  9. $post_ids = array();
in wp-includes/query.php, line 3387
  1. }
  2. if ( ! empty($groupby) )
  3. $groupby = 'GROUP BY ' . $groupby;
  4. if ( !empty( $orderby ) )
  5. $orderby = 'ORDER BY ' . $orderby;

    If provided by the user, the value of $orderby may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  6. $found_rows = '';
  7. if ( !$q['no_found_rows'] && !empty($limits) )
  8. $found_rows = 'SQL_CALC_FOUND_ROWS';
in wp-includes/query.php, line 3501
  1. $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
  2. $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
  3. /** This filter is documented in wp-includes/query.php */
  4. $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
  5. $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';

    If provided by the user, the value of $corderby may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by ryan
  6. /** This filter is documented in wp-includes/query.php */
  7. $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
  8. $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
in wp-includes/query.php, line 3504
  1. /** This filter is documented in wp-includes/query.php */
  2. $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
  3. $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
  4. /** This filter is documented in wp-includes/query.php */
  5. $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );

    If provided by the user, the value of get_option('posts_per_rss') may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Drew Jaynes
  6. $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
  7. $this->comments = $wpdb->get_results($comments_request);
  8. $this->comment_count = count($this->comments);
  9. }
  1. {
  2. $data = clone $data;
  3. $prepared = self::prepare_simplepie_object_for_cache($data);
  4. $query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  5. $query->bindValue(':feed', $this->id);
  6. if ($query->execute())
  7. {
  8. if ($query->fetchColumn() > 0)
  9. {
  1. if ($query->fetchColumn() > 0)
  2. {
  3. $items = count($prepared[1]);
  4. if ($items)
  5. {
  6. $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed';

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. $query = $this->mysql->prepare($sql);
  8. $query->bindValue(':items', $items);
  9. }
  10. else
  11. {
  1. $query = $this->mysql->prepare($sql);
  2. $query->bindValue(':items', $items);
  3. }
  4. else
  5. {
  6. $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed';

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. $query = $this->mysql->prepare($sql);
  8. }
  9. $query->bindValue(':data', $prepared[0]);
  10. $query->bindValue(':time', time());
  1. foreach ($ids as $id)
  2. {
  3. $database_ids[] = $this->mysql->quote($id);
  4. }
  5. $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query->bindValue(':feed', $this->id);
  7. if ($query->execute())
  8. {
  9. $existing_ids = array();
  1. }
  2. }
  3. }
  4. else
  5. {
  6. $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. $query->bindValue(':feed', $this->id);
  8. if ($query->execute())
  9. {
  10. if ($query->rowCount() > 0)
  11. {
  1. $query->bindValue(':feed', $this->id);
  2. if ($query->execute())
  3. {
  4. if ($query->rowCount() > 0)
  5. {
  6. $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. $query->bindValue(':data', serialize($data));
  8. $query->bindValue(':time', time());
  9. $query->bindValue(':feed', $this->id);
  10. if ($this->execute())
  11. {
  1. if ($this->mysql === null)
  2. {
  3. return false;
  4. }
  5. $query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query->bindValue(':id', $this->id);
  7. if ($query->execute() && ($row = $query->fetch()))
  8. {
  9. $data = unserialize($row[1]);
  1. $feed = null;
  2. }
  3. if ($feed !== null)
  4. {
  5. $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC';

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. if ($items > 0)
  7. {
  8. $sql .= ' LIMIT ' . $items;
  9. }
  1. if ($feed !== null)
  2. {
  3. $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC';
  4. if ($items > 0)
  5. {
  6. $sql .= ' LIMIT ' . $items;

    If provided by the user, the value of $items may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. }
  8. $query = $this->mysql->prepare($sql);
  9. $query->bindValue(':feed', $this->id);
  10. if ($query->execute())
  1. if ($this->mysql === null)
  2. {
  3. return false;
  4. }
  5. $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query->bindValue(':id', $this->id);
  7. if ($query->execute() && ($time = $query->fetchColumn()))
  8. {
  9. return $time;
  10. }
  1. if ($this->mysql === null)
  2. {
  3. return false;
  4. }
  5. $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query->bindValue(':time', time());
  7. $query->bindValue(':id', $this->id);
  8. if ($query->execute() && $query->rowCount() > 0)
  9. {
  10. return true;
  1. if ($this->mysql === null)
  2. {
  3. return false;
  4. }
  5. $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query->bindValue(':id', $this->id);
  7. $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');
  8. $query2->bindValue(':id', $this->id);
  9. if ($query->execute() && $query2->execute())
  10. {
  1. return false;
  2. }
  3. $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
  4. $query->bindValue(':id', $this->id);
  5. $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');

    If provided by the user, the value of $this->options['extras']['prefix'] may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrew Nacin
  6. $query2->bindValue(':id', $this->id);
  7. if ($query->execute() && $query2->execute())
  8. {
  9. return true;
  10. }
in wp-includes/taxonomy.php, line 1858
  1. $offset = $args['offset'];
  2. // don't limit the query results when we have to descend the family tree
  3. if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) {
  4. if ( $offset ) {
  5. $limits = 'LIMIT ' . $offset . ',' . $number;

    If provided by the user, the value of $offset may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by scribu
  6. } else {
  7. $limits = 'LIMIT ' . $number;
  8. }
  9. } else {
  10. $limits = '';
in wp-includes/taxonomy.php, line 1860
  1. // don't limit the query results when we have to descend the family tree
  2. if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) {
  3. if ( $offset ) {
  4. $limits = 'LIMIT ' . $offset . ',' . $number;
  5. } else {
  6. $limits = 'LIMIT ' . $number;

    If provided by the user, the value of $number may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by scribu
  7. }
  8. } else {
  9. $limits = '';
  10. }
in wp-includes/wp-db.php, line 2446
  1. // Change the charset to match the string(s) we're converting
  2. if ( $charset !== $this->charset ) {
  3. $this->set_charset( $this->dbh, $charset );
  4. }
  5. $row = $this->get_row( "SELECT " . implode( ', ', $query ), ARRAY_N );

    If provided by the user, the value of implode(', ', $query) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Gary Pendergast
  6. if ( ! $row ) {
  7. $this->set_charset( $this->dbh, $connection_charset );
  8. return new WP_Error( 'wpdb_strip_invalid_text_failure' );
  9. }

Global variable or function should never be used 902

  • Major
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/php.use_global_variable_or_function

  1. * @param null $deprecated Optional. Not used.
  2. * @param string $user_password Optional. User's chosen password. Will default to a random password.
  3. * @param string $language Optional. Language chosen.
  4. * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  5. */
  6. function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {

    wp_install() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( !empty( $deprecated ) )
  8. _deprecated_argument( __FUNCTION__, '2.6' );
  9. wp_check_mysql_version();
  10. wp_cache_flush();
  1. *
  2. * @since 2.1.0
  3. *
  4. * @param int $user_id User ID.
  5. */
  6. function wp_install_defaults( $user_id ) {

    wp_install_defaults() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. global $wpdb, $wp_rewrite, $table_prefix;
  8. // Default category
  9. $cat_name = __('Uncategorized');
  10. /* translators: Default category slug */
  1. * @since 2.1.0
  2. *
  3. * @param int $user_id User ID.
  4. */
  5. function wp_install_defaults( $user_id ) {
  6. global $wpdb, $wp_rewrite, $table_prefix;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Default category
  8. $cat_name = __('Uncategorized');
  9. /* translators: Default category slug */
  10. $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
  1. * @since 2.1.0
  2. *
  3. * @param int $user_id User ID.
  4. */
  5. function wp_install_defaults( $user_id ) {
  6. global $wpdb, $wp_rewrite, $table_prefix;

    $table_prefix adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Default category
  8. $cat_name = __('Uncategorized');
  9. /* translators: Default category slug */
  10. $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
  1. * @since 2.1.0
  2. *
  3. * @param int $user_id User ID.
  4. */
  5. function wp_install_defaults( $user_id ) {
  6. global $wpdb, $wp_rewrite, $table_prefix;

    $wp_rewrite adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Default category
  8. $cat_name = __('Uncategorized');
  9. /* translators: Default category slug */
  10. $cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
  1. * @param string $blog_title Blog title.
  2. * @param string $blog_url Blog url.
  3. * @param int $user_id User ID.
  4. * @param string $password User's Password.
  5. */
  6. function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {

    wp_new_blog_notification() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $user = new WP_User( $user_id );
  8. $email = $user->user_email;
  9. $name = $user->user_login;
  10. $login_url = wp_login_url();
  11. $message = sprintf( __( "Your new WordPress site has been successfully set up at:
  1. *
  2. * @since 2.1.0
  3. *
  4. * @return null
  5. */
  6. function wp_upgrade() {

    wp_upgrade() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wp_db_version, $wpdb;
  8. $wp_current_db_version = __get_option('db_version');
  9. // We are up-to-date. Nothing to do.
  1. * @since 2.1.0
  2. *
  3. * @return null
  4. */
  5. function wp_upgrade() {
  6. global $wp_current_db_version, $wp_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $wp_current_db_version = __get_option('db_version');
  8. // We are up-to-date. Nothing to do.
  9. if ( $wp_db_version == $wp_current_db_version )
  1. * @since 2.1.0
  2. *
  3. * @return null
  4. */
  5. function wp_upgrade() {
  6. global $wp_current_db_version, $wp_db_version, $wpdb;

    $wp_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $wp_current_db_version = __get_option('db_version');
  8. // We are up-to-date. Nothing to do.
  9. if ( $wp_db_version == $wp_current_db_version )
  1. * @since 2.1.0
  2. *
  3. * @return null
  4. */
  5. function wp_upgrade() {
  6. global $wp_current_db_version, $wp_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $wp_current_db_version = __get_option('db_version');
  8. // We are up-to-date. Nothing to do.
  9. if ( $wp_db_version == $wp_current_db_version )
  1. *
  2. * {@internal Missing Long Description}}
  3. *
  4. * @since 1.0.1
  5. */
  6. function upgrade_all() {

    upgrade_all() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wp_current_db_version, $wp_db_version;
  8. $wp_current_db_version = __get_option('db_version');
  9. // We are up-to-date. Nothing to do.
  10. if ( $wp_db_version == $wp_current_db_version )
  1. * {@internal Missing Long Description}}
  2. *
  3. * @since 1.0.1
  4. */
  5. function upgrade_all() {
  6. global $wp_current_db_version, $wp_db_version;

    $wp_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by duck_
  7. $wp_current_db_version = __get_option('db_version');
  8. // We are up-to-date. Nothing to do.
  9. if ( $wp_db_version == $wp_current_db_version )
  10. return;
  1. * {@internal Missing Long Description}}
  2. *
  3. * @since 1.0.1
  4. */
  5. function upgrade_all() {
  6. global $wp_current_db_version, $wp_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by duck_
  7. $wp_current_db_version = __get_option('db_version');
  8. // We are up-to-date. Nothing to do.
  9. if ( $wp_db_version == $wp_current_db_version )
  10. return;
  1. /**
  2. * Execute changes made in WordPress 1.0.
  3. *
  4. * @since 1.0.0
  5. */
  6. function upgrade_100() {

    upgrade_100() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. // Get the title and ID of every post, post_name to check if it already has a value
  9. $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
  10. if ($posts) {
  1. * Execute changes made in WordPress 1.0.
  2. *
  3. * @since 1.0.0
  4. */
  5. function upgrade_100() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. // Get the title and ID of every post, post_name to check if it already has a value
  8. $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
  9. if ($posts) {
  10. foreach($posts as $post) {
  1. /**
  2. * Execute changes made in WordPress 1.0.1.
  3. *
  4. * @since 1.0.1
  5. */
  6. function upgrade_101() {

    upgrade_101() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. // Clean up indices, add a few
  9. add_clean_index($wpdb->posts, 'post_name');
  10. add_clean_index($wpdb->posts, 'post_status');
  1. * Execute changes made in WordPress 1.0.1.
  2. *
  3. * @since 1.0.1
  4. */
  5. function upgrade_101() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. // Clean up indices, add a few
  8. add_clean_index($wpdb->posts, 'post_name');
  9. add_clean_index($wpdb->posts, 'post_status');
  10. add_clean_index($wpdb->categories, 'category_nicename');
  1. /**
  2. * Execute changes made in WordPress 1.2.
  3. *
  4. * @since 1.2.0
  5. */
  6. function upgrade_110() {

    upgrade_110() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. // Set user_nicename.
  9. $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
  10. foreach ($users as $user) {
  1. * Execute changes made in WordPress 1.2.
  2. *
  3. * @since 1.2.0
  4. */
  5. function upgrade_110() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. // Set user_nicename.
  8. $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
  9. foreach ($users as $user) {
  10. if ('' == $user->user_nicename) {
  1. /**
  2. * Execute changes made in WordPress 1.5.
  3. *
  4. * @since 1.5.0
  5. */
  6. function upgrade_130() {

    upgrade_130() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rboren
  7. global $wpdb;
  8. // Remove extraneous backslashes.
  9. $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
  10. if ($posts) {
  1. * Execute changes made in WordPress 1.5.
  2. *
  3. * @since 1.5.0
  4. */
  5. function upgrade_130() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. // Remove extraneous backslashes.
  8. $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
  9. if ($posts) {
  10. foreach($posts as $post) {
  1. /**
  2. * Execute changes made in WordPress 2.0.
  3. *
  4. * @since 2.0.0
  5. */
  6. function upgrade_160() {

    upgrade_160() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by matt
  7. global $wpdb, $wp_current_db_version;
  8. populate_roles_160();
  9. $users = $wpdb->get_results("SELECT * FROM $wpdb->users");
  1. * Execute changes made in WordPress 2.0.
  2. *
  3. * @since 2.0.0
  4. */
  5. function upgrade_160() {
  6. global $wpdb, $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. populate_roles_160();
  8. $users = $wpdb->get_results("SELECT * FROM $wpdb->users");
  9. foreach ( $users as $user ) :
  1. * Execute changes made in WordPress 2.0.
  2. *
  3. * @since 2.0.0
  4. */
  5. function upgrade_160() {
  6. global $wpdb, $wp_current_db_version;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. populate_roles_160();
  8. $users = $wpdb->get_results("SELECT * FROM $wpdb->users");
  9. foreach ( $users as $user ) :
  1. /**
  2. * Execute changes made in WordPress 2.1.
  3. *
  4. * @since 2.1.0
  5. */
  6. function upgrade_210() {

    upgrade_210() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wpdb, $wp_current_db_version;
  8. if ( $wp_current_db_version < 3506 ) {
  9. // Update status and type.
  10. $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
  1. * Execute changes made in WordPress 2.1.
  2. *
  3. * @since 2.1.0
  4. */
  5. function upgrade_210() {
  6. global $wpdb, $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 3506 ) {
  8. // Update status and type.
  9. $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
  1. * Execute changes made in WordPress 2.1.
  2. *
  3. * @since 2.1.0
  4. */
  5. function upgrade_210() {
  6. global $wpdb, $wp_current_db_version;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 3506 ) {
  8. // Update status and type.
  9. $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
  1. /**
  2. * Execute changes made in WordPress 2.3.
  3. *
  4. * @since 2.3.0
  5. */
  6. function upgrade_230() {

    upgrade_230() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rob1n
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version < 5200 ) {
  9. populate_roles_230();
  10. }
  1. * Execute changes made in WordPress 2.3.
  2. *
  3. * @since 2.3.0
  4. */
  5. function upgrade_230() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 5200 ) {
  8. populate_roles_230();
  9. }
  1. * Execute changes made in WordPress 2.3.
  2. *
  3. * @since 2.3.0
  4. */
  5. function upgrade_230() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 5200 ) {
  8. populate_roles_230();
  9. }
  1. /**
  2. * Remove old options from the database.
  3. *
  4. * @since 2.3.0
  5. */
  6. function upgrade_230_options_table() {

    upgrade_230_options_table() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. global $wpdb;
  8. $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
  9. $wpdb->hide_errors();
  10. foreach ( $old_options_fields as $old )
  11. $wpdb->query("ALTER TABLE $wpdb->options DROP $old");
  1. * Remove old options from the database.
  2. *
  3. * @since 2.3.0
  4. */
  5. function upgrade_230_options_table() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
  8. $wpdb->hide_errors();
  9. foreach ( $old_options_fields as $old )
  10. $wpdb->query("ALTER TABLE $wpdb->options DROP $old");
  11. $wpdb->show_errors();
  1. /**
  2. * Remove old categories, link2cat, and post2cat database tables.
  3. *
  4. * @since 2.3.0
  5. */
  6. function upgrade_230_old_tables() {

    upgrade_230_old_tables() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wpdb;
  8. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
  9. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat');
  10. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
  11. }
  1. * Remove old categories, link2cat, and post2cat database tables.
  2. *
  3. * @since 2.3.0
  4. */
  5. function upgrade_230_old_tables() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
  8. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat');
  9. $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
  10. }
  1. /**
  2. * Upgrade old slugs made in version 2.2.
  3. *
  4. * @since 2.2.0
  5. */
  6. function upgrade_old_slugs() {

    upgrade_old_slugs() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. // Upgrade people who were using the Redirect Old Slugs plugin.
  8. global $wpdb;
  9. $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
  10. }
  1. *
  2. * @since 2.2.0
  3. */
  4. function upgrade_old_slugs() {
  5. // Upgrade people who were using the Redirect Old Slugs plugin.
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
  8. }
  9. /**
  10. * Execute changes made in WordPress 2.5.0.
  1. /**
  2. * Execute changes made in WordPress 2.5.0.
  3. *
  4. * @since 2.5.0
  5. */
  6. function upgrade_250() {

    upgrade_250() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 6689 ) {
  9. populate_roles_250();
  10. }
  1. * Execute changes made in WordPress 2.5.0.
  2. *
  3. * @since 2.5.0
  4. */
  5. function upgrade_250() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 6689 ) {
  8. populate_roles_250();
  9. }
  1. /**
  2. * Execute changes made in WordPress 2.5.2.
  3. *
  4. * @since 2.5.2
  5. */
  6. function upgrade_252() {

    upgrade_252() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wpdb;
  8. $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
  9. }
  1. * Execute changes made in WordPress 2.5.2.
  2. *
  3. * @since 2.5.2
  4. */
  5. function upgrade_252() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
  8. }
  9. /**
  1. /**
  2. * Execute changes made in WordPress 2.6.
  3. *
  4. * @since 2.6.0
  5. */
  6. function upgrade_260() {

    upgrade_260() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 8000 )
  9. populate_roles_260();
  10. }
  1. * Execute changes made in WordPress 2.6.
  2. *
  3. * @since 2.6.0
  4. */
  5. function upgrade_260() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 8000 )
  8. populate_roles_260();
  9. }
  1. /**
  2. * Execute changes made in WordPress 2.7.
  3. *
  4. * @since 2.7.0
  5. */
  6. function upgrade_270() {

    upgrade_270() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by westi
  7. global $wpdb, $wp_current_db_version;
  8. if ( $wp_current_db_version < 8980 )
  9. populate_roles_270();
  1. * Execute changes made in WordPress 2.7.
  2. *
  3. * @since 2.7.0
  4. */
  5. function upgrade_270() {
  6. global $wpdb, $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 8980 )
  8. populate_roles_270();
  9. // Update post_date for unpublished posts with empty timestamp
  1. * Execute changes made in WordPress 2.7.
  2. *
  3. * @since 2.7.0
  4. */
  5. function upgrade_270() {
  6. global $wpdb, $wp_current_db_version;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 8980 )
  8. populate_roles_270();
  9. // Update post_date for unpublished posts with empty timestamp
  1. /**
  2. * Execute changes made in WordPress 2.8.
  3. *
  4. * @since 2.8.0
  5. */
  6. function upgrade_280() {

    upgrade_280() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version < 10360 )
  9. populate_roles_280();
  10. if ( is_multisite() ) {
  1. * Execute changes made in WordPress 2.8.
  2. *
  3. * @since 2.8.0
  4. */
  5. function upgrade_280() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( $wp_current_db_version < 10360 )
  8. populate_roles_280();
  9. if ( is_multisite() ) {
  10. $start = 0;
  1. * Execute changes made in WordPress 2.8.
  2. *
  3. * @since 2.8.0
  4. */
  5. function upgrade_280() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( $wp_current_db_version < 10360 )
  8. populate_roles_280();
  9. if ( is_multisite() ) {
  10. $start = 0;
  1. /**
  2. * Execute changes made in WordPress 2.9.
  3. *
  4. * @since 2.9.0
  5. */
  6. function upgrade_290() {

    upgrade_290() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 11958 ) {
  9. // Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion
  10. if ( get_option( 'thread_comments_depth' ) == '1' ) {
  1. * Execute changes made in WordPress 2.9.
  2. *
  3. * @since 2.9.0
  4. */
  5. function upgrade_290() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. if ( $wp_current_db_version < 11958 ) {
  8. // Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion
  9. if ( get_option( 'thread_comments_depth' ) == '1' ) {
  10. update_option( 'thread_comments_depth', 2 );
  1. /**
  2. * Execute changes made in WordPress 3.0.
  3. *
  4. * @since 3.0.0
  5. */
  6. function upgrade_300() {

    upgrade_300() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version < 15093 )
  9. populate_roles_300();
  1. * Execute changes made in WordPress 3.0.
  2. *
  3. * @since 3.0.0
  4. */
  5. function upgrade_300() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 15093 )
  8. populate_roles_300();
  9. if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
  1. * Execute changes made in WordPress 3.0.
  2. *
  3. * @since 3.0.0
  4. */
  5. function upgrade_300() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 15093 )
  8. populate_roles_300();
  9. if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
  1. /**
  2. * Execute changes made in WordPress 3.3.
  3. *
  4. * @since 3.3.0
  5. */
  6. function upgrade_330() {

    upgrade_330() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;
  8. if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  9. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
  10. }
  1. * Execute changes made in WordPress 3.3.
  2. *
  3. * @since 3.3.0
  4. */
  5. function upgrade_330() {
  6. global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;

    $sidebars_widgets adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  8. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
  9. }
  1. * Execute changes made in WordPress 3.3.
  2. *
  3. * @since 3.3.0
  4. */
  5. function upgrade_330() {
  6. global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;

    $wp_registered_widgets adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  8. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
  9. }
  1. * Execute changes made in WordPress 3.3.
  2. *
  3. * @since 3.3.0
  4. */
  5. function upgrade_330() {
  6. global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  8. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
  9. }
  1. * Execute changes made in WordPress 3.3.
  2. *
  3. * @since 3.3.0
  4. */
  5. function upgrade_330() {
  6. global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  8. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
  9. }
  1. /**
  2. * Execute changes made in WordPress 3.4.
  3. *
  4. * @since 3.4.0
  5. */
  6. function upgrade_340() {

    upgrade_340() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version < 19798 ) {
  9. $wpdb->hide_errors();
  10. $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" );
  1. * Execute changes made in WordPress 3.4.
  2. *
  3. * @since 3.4.0
  4. */
  5. function upgrade_340() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 19798 ) {
  8. $wpdb->hide_errors();
  9. $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" );
  10. $wpdb->show_errors();
  1. * Execute changes made in WordPress 3.4.
  2. *
  3. * @since 3.4.0
  4. */
  5. function upgrade_340() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $wp_current_db_version < 19798 ) {
  8. $wpdb->hide_errors();
  9. $wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" );
  10. $wpdb->show_errors();
  1. /**
  2. * Execute changes made in WordPress 3.5.
  3. *
  4. * @since 3.5.0
  5. */
  6. function upgrade_350() {

    upgrade_350() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  9. update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
  1. * Execute changes made in WordPress 3.5.
  2. *
  3. * @since 3.5.0
  4. */
  5. function upgrade_350() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  8. update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
  9. if ( $wp_current_db_version < 21811 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  1. * Execute changes made in WordPress 3.5.
  2. *
  3. * @since 3.5.0
  4. */
  5. function upgrade_350() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  8. update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
  9. if ( $wp_current_db_version < 21811 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
  1. /**
  2. * Execute changes made in WordPress 3.7.
  3. *
  4. * @since 3.7.0
  5. */
  6. function upgrade_370() {

    upgrade_370() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 25824 )
  9. wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' );
  10. }
  1. * Execute changes made in WordPress 3.7.
  2. *
  3. * @since 3.7.0
  4. */
  5. function upgrade_370() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version < 25824 )
  8. wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' );
  9. }
  10. /**
  1. * Execute changes made in WordPress 3.7.2.
  2. *
  3. * @since 3.7.2
  4. * @since 3.8.0
  5. */
  6. function upgrade_372() {

    upgrade_372() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Dion Hulse
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 26148 )
  9. wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
  10. }
  1. *
  2. * @since 3.7.2
  3. * @since 3.8.0
  4. */
  5. function upgrade_372() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Dion Hulse
  7. if ( $wp_current_db_version < 26148 )
  8. wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
  9. }
  10. /**
  1. /**
  2. * Execute changes made in WordPress 3.8.0.
  3. *
  4. * @since 3.8.0
  5. */
  6. function upgrade_380() {

    upgrade_380() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 26691 ) {
  9. deactivate_plugins( array( 'mp6/mp6.php' ), true );
  10. }
  11. }
  1. * Execute changes made in WordPress 3.8.0.
  2. *
  3. * @since 3.8.0
  4. */
  5. function upgrade_380() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version < 26691 ) {
  8. deactivate_plugins( array( 'mp6/mp6.php' ), true );
  9. }
  10. }
  1. /**
  2. * Execute changes made in WordPress 4.0.0.
  3. *
  4. * @since 4.0.0
  5. */
  6. function upgrade_400() {

    upgrade_400() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Dominik Schilling
  7. global $wp_current_db_version;
  8. if ( $wp_current_db_version < 29630 ) {
  9. if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
  10. if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages() ) ) {
  11. update_option( 'WPLANG', WPLANG );
  1. * Execute changes made in WordPress 4.0.0.
  2. *
  3. * @since 4.0.0
  4. */
  5. function upgrade_400() {
  6. global $wp_current_db_version;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Dominik Schilling
  7. if ( $wp_current_db_version < 29630 ) {
  8. if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
  9. if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages() ) ) {
  10. update_option( 'WPLANG', WPLANG );
  11. } else {
  1. /**
  2. * Execute network level changes
  3. *
  4. * @since 3.0.0
  5. */
  6. function upgrade_network() {

    upgrade_network() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wpdb;
  8. // Always.
  9. if ( is_main_network() ) {
  10. /*
  1. * Execute network level changes
  2. *
  3. * @since 3.0.0
  4. */
  5. function upgrade_network() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. // Always.
  8. if ( is_main_network() ) {
  9. /*
  10. * Deletes all expired transients. The multi-table delete syntax is used
  1. * Execute network level changes
  2. *
  3. * @since 3.0.0
  4. */
  5. function upgrade_network() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. // Always.
  8. if ( is_main_network() ) {
  9. /*
  10. * Deletes all expired transients. The multi-table delete syntax is used
  1. *
  2. * @param string $table_name Database table name to create.
  3. * @param string $create_ddl SQL statement to create table.
  4. * @return bool If table already exists or was created by function.
  5. */
  6. function maybe_create_table($table_name, $create_ddl) {

    maybe_create_table() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) );
  9. if ( $wpdb->get_var( $query ) == $table_name ) {
  1. * @param string $table_name Database table name to create.
  2. * @param string $create_ddl SQL statement to create table.
  3. * @return bool If table already exists or was created by function.
  4. */
  5. function maybe_create_table($table_name, $create_ddl) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) );
  8. if ( $wpdb->get_var( $query ) == $table_name ) {
  9. return true;
  1. *
  2. * @param string $table Database table name.
  3. * @param string $index Index name to drop.
  4. * @return bool True, when finished.
  5. */
  6. function drop_index($table, $index) {

    drop_index() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. $wpdb->hide_errors();
  9. $wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
  10. // Now we need to take out all the extra ones we may have created
  11. for ($i = 0; $i < 25; $i++) {
  1. * @param string $table Database table name.
  2. * @param string $index Index name to drop.
  3. * @return bool True, when finished.
  4. */
  5. function drop_index($table, $index) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. $wpdb->hide_errors();
  8. $wpdb->query("ALTER TABLE `$table` DROP INDEX `$index`");
  9. // Now we need to take out all the extra ones we may have created
  10. for ($i = 0; $i < 25; $i++) {
  11. $wpdb->query("ALTER TABLE `$table` DROP INDEX `{$index}_$i`");
  1. *
  2. * @param string $table Database table name.
  3. * @param string $index Database table index column.
  4. * @return bool True, when done with execution.
  5. */
  6. function add_clean_index($table, $index) {

    add_clean_index() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. drop_index($table, $index);
  9. $wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )");
  10. return true;
  11. }
  1. * @param string $table Database table name.
  2. * @param string $index Database table index column.
  3. * @return bool True, when done with execution.
  4. */
  5. function add_clean_index($table, $index) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. drop_index($table, $index);
  8. $wpdb->query("ALTER TABLE `$table` ADD INDEX ( `$index` )");
  9. return true;
  10. }
  1. ** maybe_add_column()
  2. ** Add column to db table if it doesn't exist.
  3. ** Returns: true if already exists or on successful completion
  4. ** false on error
  5. */
  6. function maybe_add_column($table_name, $column_name, $create_ddl) {

    maybe_add_column() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
  9. if ($column == $column_name) {
  10. return true;
  11. }
  1. ** Add column to db table if it doesn't exist.
  2. ** Returns: true if already exists or on successful completion
  3. ** false on error
  4. */
  5. function maybe_add_column($table_name, $column_name, $create_ddl) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
  8. if ($column == $column_name) {
  9. return true;
  10. }
  11. }
  1. *
  2. * @since 1.2.0
  3. *
  4. * @return array List of options.
  5. */
  6. function get_alloptions_110() {

    get_alloptions_110() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. global $wpdb;
  8. $all_options = new stdClass;
  9. if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
  10. foreach ( $options as $option ) {
  11. if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name )
  1. * @since 1.2.0
  2. *
  3. * @return array List of options.
  4. */
  5. function get_alloptions_110() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. $all_options = new stdClass;
  8. if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
  9. foreach ( $options as $option ) {
  10. if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name )
  11. $option->option_value = untrailingslashit( $option->option_value );
  1. * @access private
  2. *
  3. * @param string $setting Option name.
  4. * @return mixed
  5. */
  6. function __get_option($setting) {

    __get_option() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wpdb;
  8. if ( $setting == 'home' && defined( 'WP_HOME' ) )
  9. return untrailingslashit( WP_HOME );
  1. *
  2. * @param string $setting Option name.
  3. * @return mixed
  4. */
  5. function __get_option($setting) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. if ( $setting == 'home' && defined( 'WP_HOME' ) )
  8. return untrailingslashit( WP_HOME );
  9. if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) )
  1. * @since 1.5.0
  2. *
  3. * @param string $content
  4. * @return string
  5. */
  6. function deslash($content) {

    deslash() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. // Note: \\\ inside a regex denotes a single backslash.
  8. /*
  9. * Replace one or more backslashes followed by a single quote with
  10. * a single quote.
  1. *
  2. * @param string $queries
  3. * @param bool $execute
  4. * @return array
  5. */
  6. function dbDelta( $queries = '', $execute = true ) {

    dbDelta() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wpdb;
  8. if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) )
  9. $queries = wp_get_db_schema( $queries );
  1. * @param string $queries
  2. * @param bool $execute
  3. * @return array
  4. */
  5. function dbDelta( $queries = '', $execute = true ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by saxmatt
  7. if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) )
  8. $queries = wp_get_db_schema( $queries );
  9. // Separate individual queries into an array
  1. *
  2. * {@internal Missing Long Description}}
  3. *
  4. * @since 1.5.0
  5. */
  6. function make_db_current( $tables = 'all' ) {

    make_db_current() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. $alterations = dbDelta( $tables );
  8. echo "<ol>\n";
  9. foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
  10. echo "</ol>\n";
  11. }
  1. *
  2. * {@internal Missing Long Description}}
  3. *
  4. * @since 1.5.0
  5. */
  6. function make_db_current_silent( $tables = 'all' ) {

    make_db_current_silent() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. dbDelta( $tables );
  8. }
  9. /**
  10. * {@internal Missing Short Description}}
  1. *
  2. * @param string $theme_name
  3. * @param string $template
  4. * @return bool
  5. */
  6. function make_site_theme_from_oldschool($theme_name, $template) {

    make_site_theme_from_oldschool() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rboren
  7. $home_path = get_home_path();
  8. $site_dir = WP_CONTENT_DIR . "/themes/$template";
  9. if (! file_exists("$home_path/index.php"))
  10. return false;
  1. *
  2. * @param string $theme_name
  3. * @param string $template
  4. * @return bool|null
  5. */
  6. function make_site_theme_from_default($theme_name, $template) {

    make_site_theme_from_default() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rboren
  7. $site_dir = WP_CONTENT_DIR . "/themes/$template";
  8. $default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;
  9. // Copy files from the default theme to the site theme.
  10. //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
  1. *
  2. * @since 1.5.0
  3. *
  4. * @return string|bool
  5. */
  6. function make_site_theme() {

    make_site_theme() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rboren
  7. // Name the theme after the blog.
  8. $theme_name = __get_option('blogname');
  9. $template = sanitize_title($theme_name);
  10. $site_dir = WP_CONTENT_DIR . "/themes/$template";
  1. * @since 2.0.0
  2. *
  3. * @param int $level User level.
  4. * @return string User role name.
  5. */
  6. function translate_level_to_role($level) {

    translate_level_to_role() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. switch ($level) {
  8. case 10:
  9. case 9:
  10. case 8:
  11. return 'administrator';
  1. *
  2. * {@internal Missing Long Description}}
  3. *
  4. * @since 2.1.0
  5. */
  6. function wp_check_mysql_version() {

    wp_check_mysql_version() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by markjaquith
  7. global $wpdb;
  8. $result = $wpdb->check_database_version();
  9. if ( is_wp_error( $result ) )
  10. die( $result->get_error_message() );
  11. }
  1. * {@internal Missing Long Description}}
  2. *
  3. * @since 2.1.0
  4. */
  5. function wp_check_mysql_version() {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by westi
  7. $result = $wpdb->check_database_version();
  8. if ( is_wp_error( $result ) )
  9. die( $result->get_error_message() );
  10. }
  1. /**
  2. * Disables the Automattic widgets plugin, which was merged into core.
  3. *
  4. * @since 2.2.0
  5. */
  6. function maybe_disable_automattic_widgets() {

    maybe_disable_automattic_widgets() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by rob1n
  7. $plugins = __get_option( 'active_plugins' );
  8. foreach ( (array) $plugins as $plugin ) {
  9. if ( basename( $plugin ) == 'widgets.php' ) {
  10. array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
  1. /**
  2. * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB.
  3. *
  4. * @since 3.5.0
  5. */
  6. function maybe_disable_link_manager() {

    maybe_disable_link_manager() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. global $wp_current_db_version, $wpdb;
  8. if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  9. update_option( 'link_manager_enabled', 0 );
  10. }
  1. * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB.
  2. *
  3. * @since 3.5.0
  4. */
  5. function maybe_disable_link_manager() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  8. update_option( 'link_manager_enabled', 0 );
  9. }
  1. * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB.
  2. *
  3. * @since 3.5.0
  4. */
  5. function maybe_disable_link_manager() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
  8. update_option( 'link_manager_enabled', 0 );
  9. }
  1. /**
  2. * Runs before the schema is upgraded.
  3. *
  4. * @since 2.9.0
  5. */
  6. function pre_schema_upgrade() {

    pre_schema_upgrade() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. global $wp_current_db_version, $wpdb;
  8. // Upgrade versions prior to 2.9
  9. if ( $wp_current_db_version < 11557 ) {
  10. // Delete duplicate options. Keep the option with the highest option_id.
  1. * Runs before the schema is upgraded.
  2. *
  3. * @since 2.9.0
  4. */
  5. function pre_schema_upgrade() {
  6. global $wp_current_db_version, $wpdb;

    $wp_current_db_version adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Upgrade versions prior to 2.9
  8. if ( $wp_current_db_version < 11557 ) {
  9. // Delete duplicate options. Keep the option with the highest option_id.
  10. $wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
  1. * Runs before the schema is upgraded.
  2. *
  3. * @since 2.9.0
  4. */
  5. function pre_schema_upgrade() {
  6. global $wp_current_db_version, $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Upgrade versions prior to 2.9
  8. if ( $wp_current_db_version < 11557 ) {
  9. // Delete duplicate options. Keep the option with the highest option_id.
  10. $wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
  1. *
  2. * @since 3.0.0
  3. *
  4. */
  5. if ( !function_exists( 'install_global_terms' ) ) :
  6. function install_global_terms() {

    install_global_terms() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb, $charset_collate;
  8. $ms_queries = "
  9. CREATE TABLE $wpdb->sitecategories (
  10. cat_ID bigint(20) NOT NULL auto_increment,
  11. cat_name varchar(55) NOT NULL default '',
  1. * @since 3.0.0
  2. *
  3. */
  4. if ( !function_exists( 'install_global_terms' ) ) :
  5. function install_global_terms() {
  6. global $wpdb, $charset_collate;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $ms_queries = "
  8. CREATE TABLE $wpdb->sitecategories (
  9. cat_ID bigint(20) NOT NULL auto_increment,
  10. cat_name varchar(55) NOT NULL default '',
  11. category_nicename varchar(200) NOT NULL default '',
  1. * @since 3.0.0
  2. *
  3. */
  4. if ( !function_exists( 'install_global_terms' ) ) :
  5. function install_global_terms() {
  6. global $wpdb, $charset_collate;

    $charset_collate adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $ms_queries = "
  8. CREATE TABLE $wpdb->sitecategories (
  9. cat_ID bigint(20) NOT NULL auto_increment,
  10. cat_name varchar(55) NOT NULL default '',
  11. category_nicename varchar(200) NOT NULL default '',
  1. * @since MU
  2. * @deprecated 3.1.0
  3. * @see get_blog_details()
  4. * @return int
  5. */
  6. function get_dashboard_blog() {

    get_dashboard_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Ryan Boren
  7. _deprecated_function( __FUNCTION__, '3.1' );
  8. if ( $blog = get_site_option( 'dashboard_blog' ) )
  9. return get_blog_details( $blog );
  10. return get_blog_details( $GLOBALS['current_site']->blog_id );
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use wp_generate_password()
  4. * @see wp_generate_password()
  5. */
  6. function generate_random_password( $len = 8 ) {

    generate_random_password() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
  8. return wp_generate_password( $len );
  9. }
  10. /**
  1. * @deprecated Use is_super_admin()
  2. * @see is_super_admin()
  3. * @see is_multisite()
  4. *
  5. */
  6. function is_site_admin( $user_login = '' ) {

    is_site_admin() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
  8. if ( empty( $user_login ) ) {
  9. $user_id = get_current_user_id();
  10. if ( !$user_id )
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use wp_die()
  4. * @see wp_die()
  5. */
  6. function graceful_fail( $message ) {

    graceful_fail() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
  8. $message = apply_filters( 'graceful_fail', $message );
  9. $message_template = apply_filters( 'graceful_fail_template',
  10. '<!DOCTYPE html>
  11. <html xmlns="http://www.w3.org/1999/xhtml"><head>
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use get_user_by()
  4. * @see get_user_by()
  5. */
  6. function get_user_details( $username ) {

    get_user_details() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
  8. return get_user_by('login', $username);
  9. }
  10. /**
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use clean_post_cache()
  4. * @see clean_post_cache()
  5. */
  6. function clear_global_post_cache( $post_id ) {

    clear_global_post_cache() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
  8. }
  9. /**
  10. * @since MU
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use is_main_site()
  4. * @see is_main_site()
  5. */
  6. function is_main_blog() {

    is_main_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
  8. return is_main_site();
  9. }
  10. /**
  1. * @since MU
  2. * @deprecated 3.0.0
  3. * @deprecated Use is_email()
  4. * @see is_email()
  5. */
  6. function validate_email( $email, $check_domain = true) {

    validate_email() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. _deprecated_function( __FUNCTION__, '3.0', 'is_email()' );
  8. return is_email( $email, $check_domain );
  9. }
  10. /**
  1. /**
  2. * @since MU
  3. * @deprecated 3.0.0
  4. * @deprecated No alternative available. For performance reasons this function is not recommended.
  5. */
  6. function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {

    get_blog_list() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' );
  8. global $wpdb;
  9. $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
  1. * @deprecated No alternative available. For performance reasons this function is not recommended.
  2. */
  3. function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
  4. _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' );
  5. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  6. $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
  7. foreach ( (array) $blogs as $details ) {
  8. $blog_list[ $details['blog_id'] ] = $details;
  9. $blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
  1. /**
  2. * @since MU
  3. * @deprecated 3.0.0
  4. * @deprecated No alternative available. For performance reasons this function is not recommended.
  5. */
  6. function get_most_active_blogs( $num = 10, $display = true ) {

    get_most_active_blogs() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.0' );
  8. $blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
  9. if ( is_array( $blogs ) ) {
  10. reset( $blogs );
  1. * @deprecated 3.3.0
  2. * @deprecated Use wp_redirect()
  3. *
  4. * @param string $url
  5. */
  6. function wpmu_admin_do_redirect( $url = '' ) {

    wpmu_admin_do_redirect() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.3' );
  8. $ref = '';
  9. if ( isset( $_GET['ref'] ) )
  10. $ref = $_GET['ref'];
  1. * @deprecated Use add_query_arg()
  2. *
  3. * @param string $url
  4. * @return string
  5. */
  6. function wpmu_admin_redirect_add_updated_param( $url = '' ) {

    wpmu_admin_redirect_add_updated_param() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. _deprecated_function( __FUNCTION__, '3.3' );
  8. if ( strpos( $url, 'updated=true' ) === false ) {
  9. if ( strpos( $url, '?' ) === false )
  10. return $url . '?updated=true';
  1. * @deprecated Use get_user_by()
  2. *
  3. * @param string $string Either an email address or a login.
  4. * @return int
  5. */
  6. function get_user_id_from_string( $string ) {

    get_user_id_from_string() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Andrew Nacin
  7. _deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
  8. if ( is_email( $string ) )
  9. $user = get_user_by( 'email', $string );
  10. elseif ( is_numeric( $string ) )
  1. *
  2. * @param string $domain
  3. * @param string $path
  4. * @return string
  5. */
  6. function get_blogaddress_by_domain( $domain, $path ) {

    get_blogaddress_by_domain() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. _deprecated_function( __FUNCTION__, '3.7' );
  8. if ( is_subdomain_install() ) {
  9. $url = "http://" . $domain.$path;
  10. } else {
  1. *
  2. * @since MU 1.0
  3. *
  4. * @return array Site and user count for the network.
  5. */
  6. function get_sitestats() {

    get_sitestats() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $stats = array(
  8. 'blogs' => get_blog_count(),
  9. 'users' => get_user_count(),
  10. );
  1. *
  2. * @param string $sitedomain Optional. Site domain.
  3. * @param string $path Optional. Site path.
  4. * @return array The network admins
  5. */
  6. function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {

    get_admin_users_for_domain() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. if ( ! $sitedomain )
  9. $site_id = $wpdb->siteid;
  10. else
  1. * @param string $sitedomain Optional. Site domain.
  2. * @param string $path Optional. Site path.
  3. * @return array The network admins
  4. */
  5. function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( ! $sitedomain )
  8. $site_id = $wpdb->siteid;
  9. else
  10. $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) );
  1. * @since MU 1.0
  2. *
  3. * @param int $user_id The unique ID of the user
  4. * @return object The blog object
  5. */
  6. function get_active_blog_for_user( $user_id ) {

    get_active_blog_for_user() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by nacin
  7. global $wpdb;
  8. $blogs = get_blogs_of_user( $user_id );
  9. if ( empty( $blogs ) )
  10. return null;
  1. *
  2. * @param int $user_id The unique ID of the user
  3. * @return object The blog object
  4. */
  5. function get_active_blog_for_user( $user_id ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $blogs = get_blogs_of_user( $user_id );
  8. if ( empty( $blogs ) )
  9. return null;
  10. if ( !is_multisite() )
  1. *
  2. * @since MU 2.7
  3. *
  4. * @return int
  5. */
  6. function get_user_count() {

    get_user_count() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. return get_site_option( 'user_count' );
  8. }
  9. /**
  10. * The number of active sites on your installation.
  1. * @since MU 1.0
  2. *
  3. * @param int $network_id Deprecated, not supported.
  4. * @return int
  5. */
  6. function get_blog_count( $network_id = 0 ) {

    get_blog_count() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. if ( func_num_args() )
  8. _deprecated_argument( __FUNCTION__, '3.1' );
  9. return get_site_option( 'blog_count' );
  10. }
  1. *
  2. * @param int $blog_id ID of the blog.
  3. * @param int $post_id ID of the post you're looking for.
  4. * @return WP_Post|null WP_Post on success or null on failure
  5. */
  6. function get_blog_post( $blog_id, $post_id ) {

    get_blog_post() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. switch_to_blog( $blog_id );
  8. $post = get_post( $post_id );
  9. restore_current_blog();
  10. return $post;
  1. * @param int $blog_id ID of the blog you're adding the user to.
  2. * @param int $user_id ID of the user you're adding.
  3. * @param string $role The role you want the user to have
  4. * @return bool
  5. */
  6. function add_user_to_blog( $blog_id, $user_id, $role ) {

    add_user_to_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. switch_to_blog($blog_id);
  8. $user = get_userdata( $user_id );
  9. if ( ! $user ) {
  1. * @param int $user_id ID of the user you're removing.
  2. * @param int $blog_id ID of the blog you're removing the user from.
  3. * @param string $reassign Optional. A user to whom to reassign posts.
  4. * @return bool
  5. */
  6. function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {

    remove_user_from_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. switch_to_blog($blog_id);
  9. $user_id = (int) $user_id;
  10. /**
  11. * Fires before a user is removed from a site.
  1. * @param int $blog_id ID of the blog you're removing the user from.
  2. * @param string $reassign Optional. A user to whom to reassign posts.
  3. * @return bool
  4. */
  5. function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. switch_to_blog($blog_id);
  8. $user_id = (int) $user_id;
  9. /**
  10. * Fires before a user is removed from a site.
  11. *
  1. * @param string $path The new blog's path.
  2. * @param string $weblog_title The new blog's title.
  3. * @param int $site_id Optional. Defaults to 1.
  4. * @return int The ID of the newly created blog
  5. */
  6. function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {

    create_empty_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( empty($path) )
  8. $path = '/';
  9. // Check if the domain has been used already. We should return an error message.
  10. if ( domain_exists($domain, $path, $site_id) )
  1. *
  2. * @param int $blog_id ID of the source blog.
  3. * @param int $post_id ID of the desired post.
  4. * @return string The post's permalink
  5. */
  6. function get_blog_permalink( $blog_id, $post_id ) {

    get_blog_permalink() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Ryan Boren
  7. switch_to_blog( $blog_id );
  8. $link = get_permalink( $post_id );
  9. restore_current_blog();
  10. return $link;
  1. *
  2. * @param string $domain
  3. * @param string $path Optional. Not required for subdomain installations.
  4. * @return int 0 if no blog found, otherwise the ID of the matching blog
  5. */
  6. function get_blog_id_from_url( $domain, $path = '/' ) {

    get_blog_id_from_url() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. $domain = strtolower( $domain );
  9. $path = strtolower( $path );
  10. $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
  1. * @param string $domain
  2. * @param string $path Optional. Not required for subdomain installations.
  3. * @return int 0 if no blog found, otherwise the ID of the matching blog
  4. */
  5. function get_blog_id_from_url( $domain, $path = '/' ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $domain = strtolower( $domain );
  8. $path = strtolower( $path );
  9. $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
  1. * @since MU
  2. *
  3. * @param string $user_email The email provided by the user at registration.
  4. * @return bool Returns true when the email address is banned.
  5. */
  6. function is_email_address_unsafe( $user_email ) {

    is_email_address_unsafe() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $banned_names = get_site_option( 'banned_email_domains' );
  8. if ( $banned_names && ! is_array( $banned_names ) )
  9. $banned_names = explode( "\n", $banned_names );
  10. $is_email_address_unsafe = false;
  1. *
  2. * @param string $user_name The login name provided by the user.
  3. * @param string $user_email The email provided by the user.
  4. * @return array Contains username, email, and error messages.
  5. */
  6. function wpmu_validate_user_signup($user_name, $user_email) {

    wpmu_validate_user_signup() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. $errors = new WP_Error();
  9. $orig_username = $user_name;
  1. * @param string $user_name The login name provided by the user.
  2. * @param string $user_email The email provided by the user.
  3. * @return array Contains username, email, and error messages.
  4. */
  5. function wpmu_validate_user_signup($user_name, $user_email) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $errors = new WP_Error();
  8. $orig_username = $user_name;
  9. $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
  1. *
  2. * @param string $blogname The blog name provided by the user. Must be unique.
  3. * @param string $blog_title The blog title provided by the user.
  4. * @return array Contains the new site data and error messages.
  5. */
  6. function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {

    wpmu_validate_blog_signup() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. global $wpdb, $domain;
  8. $current_site = get_current_site();
  9. $base = $current_site->path;
  1. * @param string $blogname The blog name provided by the user. Must be unique.
  2. * @param string $blog_title The blog title provided by the user.
  3. * @return array Contains the new site data and error messages.
  4. */
  5. function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
  6. global $wpdb, $domain;

    $domain adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. $current_site = get_current_site();
  8. $base = $current_site->path;
  9. $blog_title = strip_tags( $blog_title );
  1. * @param string $blogname The blog name provided by the user. Must be unique.
  2. * @param string $blog_title The blog title provided by the user.
  3. * @return array Contains the new site data and error messages.
  4. */
  5. function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
  6. global $wpdb, $domain;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. $current_site = get_current_site();
  8. $base = $current_site->path;
  9. $blog_title = strip_tags( $blog_title );
  1. * @param string $title The requested site title.
  2. * @param string $user The user's requested login name.
  3. * @param string $user_email The user's email address.
  4. * @param array $meta By default, contains the requested privacy setting and lang_id.
  5. */
  6. function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {

    wpmu_signup_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. global $wpdb;
  8. $key = substr( md5( time() . rand() . $domain ), 0, 16 );
  9. $meta = serialize($meta);
  1. * @param string $user The user's requested login name.
  2. * @param string $user_email The user's email address.
  3. * @param array $meta By default, contains the requested privacy setting and lang_id.
  4. */
  5. function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $key = substr( md5( time() . rand() . $domain ), 0, 16 );
  8. $meta = serialize($meta);
  9. $wpdb->insert( $wpdb->signups, array(
  1. *
  2. * @param string $user The user's requested login name.
  3. * @param string $user_email The user's email address.
  4. * @param array $meta By default, this is an empty array.
  5. */
  6. function wpmu_signup_user( $user, $user_email, $meta = array() ) {

    wpmu_signup_user() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. global $wpdb;
  8. // Format data
  9. $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
  10. $user_email = sanitize_email( $user_email );
  1. * @param string $user The user's requested login name.
  2. * @param string $user_email The user's email address.
  3. * @param array $meta By default, this is an empty array.
  4. */
  5. function wpmu_signup_user( $user, $user_email, $meta = array() ) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. // Format data
  8. $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
  9. $user_email = sanitize_email( $user_email );
  10. $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
  1. * @param string $user_email The user's email address.
  2. * @param string $key The activation key created in wpmu_signup_blog()
  3. * @param array $meta By default, contains the requested privacy setting and lang_id.
  4. * @return bool
  5. */
  6. function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {

    wpmu_signup_blog_notification() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. /**
  8. * Filter whether to bypass the new site email notification.
  9. *
  10. * @since MU
  11. *
  1. * @param string $user_email The user's email address.
  2. * @param string $key The activation key created in wpmu_signup_user()
  3. * @param array $meta By default, an empty array.
  4. * @return bool
  5. */
  6. function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array() ) {

    wpmu_signup_user_notification() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. /**
  8. * Filter whether to bypass the email notification for new user sign-up.
  9. *
  10. * @since MU
  11. *
  1. * @since MU
  2. *
  3. * @param string $key The activation key provided to the user.
  4. * @return array An array containing information about the activated user and/or blog
  5. */
  6. function wpmu_activate_signup($key) {

    wpmu_activate_signup() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
  9. if ( empty( $signup ) )
  1. *
  2. * @param string $key The activation key provided to the user.
  3. * @return array An array containing information about the activated user and/or blog
  4. */
  5. function wpmu_activate_signup($key) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Dominik Schilling
  7. $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
  8. if ( empty( $signup ) )
  9. return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
  1. * @param string $user_name The new user's login name.
  2. * @param string $password The new user's password.
  3. * @param string $email The new user's email address.
  4. * @return int|bool Returns false on failure, or int $user_id on success
  5. */
  6. function wpmu_create_user( $user_name, $password, $email ) {

    wpmu_create_user() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Mark Jaquith
  7. $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
  8. $user_id = wp_create_user( $user_name, $password, $email );
  9. if ( is_wp_error( $user_id ) )
  10. return false;
  1. * @param int $user_id The user ID of the new site's admin.
  2. * @param array $meta Optional. Used to set initial site options.
  3. * @param int $site_id Optional. Only relevant on multi-network installs.
  4. * @return mixed Returns WP_Error object on failure, int $blog_id on success
  5. */
  6. function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) {

    wpmu_create_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. $defaults = array( 'public' => 0 );
  8. $meta = wp_parse_args( $meta, $defaults );
  9. $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
  1. * @since MU
  2. *
  3. * @param int $blog_id The new site's ID.
  4. * @return bool
  5. */
  6. function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {

    newblog_notify_siteadmin() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( get_site_option( 'registrationnotification' ) != 'yes' )
  8. return false;
  9. $email = get_site_option( 'admin_email' );
  10. if ( is_email($email) == false )
  1. * @since MU
  2. *
  3. * @param int $user_id The new user's ID.
  4. * @return bool
  5. */
  6. function newuser_notify_siteadmin( $user_id ) {

    newuser_notify_siteadmin() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. if ( get_site_option( 'registrationnotification' ) != 'yes' )
  8. return false;
  9. $email = get_site_option( 'admin_email' );
  1. * @param string $domain The domain to be checked.
  2. * @param string $path The path to be checked.
  3. * @param int $site_id Optional. Relevant only on multi-network installs.
  4. * @return int
  5. */
  6. function domain_exists($domain, $path, $site_id = 1) {

    domain_exists() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. $path = trailingslashit( $path );
  9. $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
  10. /**
  1. * @param string $path The path to be checked.
  2. * @param int $site_id Optional. Relevant only on multi-network installs.
  3. * @return int
  4. */
  5. function domain_exists($domain, $path, $site_id = 1) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $path = trailingslashit( $path );
  8. $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
  9. /**
  10. * Filter whether a blogname is taken.
  1. * @param string $domain The domain of the new site.
  2. * @param string $path The path of the new site.
  3. * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1.
  4. * @return int The ID of the new row
  5. */
  6. function insert_blog($domain, $path, $site_id) {

    insert_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. $path = trailingslashit($path);
  9. $site_id = (int) $site_id;
  1. * @param string $path The path of the new site.
  2. * @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1.
  3. * @return int The ID of the new row
  4. */
  5. function insert_blog($domain, $path, $site_id) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. $path = trailingslashit($path);
  8. $site_id = (int) $site_id;
  9. $result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
  1. * @since MU
  2. *
  3. * @param int $blog_id The value returned by insert_blog().
  4. * @param string $blog_title The title of the new site.
  5. */
  6. function install_blog( $blog_id, $blog_title = '' ) {

    install_blog() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. global $wpdb, $wp_roles;
  8. // Cast for security
  9. $blog_id = (int) $blog_id;
  1. *
  2. * @param int $blog_id The value returned by insert_blog().
  3. * @param string $blog_title The title of the new site.
  4. */
  5. function install_blog( $blog_id, $blog_title = '' ) {
  6. global $wpdb, $wp_roles;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Cast for security
  8. $blog_id = (int) $blog_id;
  9. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  1. *
  2. * @param int $blog_id The value returned by insert_blog().
  3. * @param string $blog_title The title of the new site.
  4. */
  5. function install_blog( $blog_id, $blog_title = '' ) {
  6. global $wpdb, $wp_roles;

    $wp_roles adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. // Cast for security
  8. $blog_id = (int) $blog_id;
  9. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  1. * @deprecated Use wp_install_defaults()
  2. *
  3. * @param int $blog_id Ignored in this function.
  4. * @param int $user_id
  5. */
  6. function install_blog_defaults($blog_id, $user_id) {

    install_blog_defaults() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $wpdb;
  8. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  9. $suppress = $wpdb->suppress_errors();
  1. *
  2. * @param int $blog_id Ignored in this function.
  3. * @param int $user_id
  4. */
  5. function install_blog_defaults($blog_id, $user_id) {
  6. global $wpdb;

    $wpdb adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by ryan
  7. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  8. $suppress = $wpdb->suppress_errors();
  1. * @param string $password
  2. * @param string $title The new blog's title
  3. * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
  4. * @return bool
  5. */
  6. function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {

    wpmu_welcome_notification() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. $current_site = get_current_site();
  8. /**
  9. * Filter whether to bypass the welcome email after site activation.
  10. *
  1. * @param int $user_id
  2. * @param string $password
  3. * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
  4. * @return bool
  5. */
  6. function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {

    wpmu_welcome_user_notification() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Sergey Biryukov
  7. $current_site = get_current_site();
  8. /**
  9. * Filter whether to bypass the welcome email after user activation.
  10. *
  1. *
  2. * @since MU
  3. *
  4. * @return object
  5. */
  6. function get_current_site() {

    get_current_site() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by wpmuguru
  7. global $current_site;
  8. return $current_site;
  9. }
  10. /**