Make WordPress Core


Ignore:
Timestamp:
08/25/2015 08:27:56 PM (10 years ago)
Author:
wonderboymusic
Message:

foreach is a statement, not a function.

See #33491.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r33727 r33734  
    560560    $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
    561561    if ($posts) {
    562         foreach($posts as $post) {
     562        foreach ($posts as $post) {
    563563            if ('' == $post->post_name) {
    564564                $newtitle = sanitize_title($post->post_title);
     
    700700    $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
    701701    if ($posts) {
    702         foreach($posts as $post) {
     702        foreach ($posts as $post) {
    703703            $post_content = addslashes(deslash($post->post_content));
    704704            $post_title = addslashes(deslash($post->post_title));
     
    717717    $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
    718718    if ($comments) {
    719         foreach($comments as $comment) {
     719        foreach ($comments as $comment) {
    720720            $comment_content = deslash($comment->comment_content);
    721721            $comment_author = deslash($comment->comment_author);
     
    728728    $links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
    729729    if ($links) {
    730         foreach($links as $link) {
     730        foreach ($links as $link) {
    731731            $link_name = deslash($link->link_name);
    732732            $link_description = deslash($link->link_description);
     
    12061206        $start = 0;
    12071207        while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) {
    1208             foreach( $rows as $row ) {
     1208            foreach ( $rows as $row ) {
    12091209                $value = $row->option_value;
    12101210                if ( !@unserialize( $value ) )
     
    16401640        $start = 0;
    16411641        while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
    1642             foreach( $rows as $row ) {
     1642            foreach ( $rows as $row ) {
    16431643                $value = $row->meta_value;
    16441644                if ( !@unserialize( $value ) )
     
    17221722            $upgrade = false;
    17231723            $indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
    1724             foreach( $indexes as $index ) {
     1724            foreach ( $indexes as $index ) {
    17251725                if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
    17261726                    $upgrade = true;
     
    20262026
    20272027    // Create a tablename index for an array ($cqueries) of queries
    2028     foreach($queries as $qry) {
     2028    foreach ($queries as $qry) {
    20292029        if ( preg_match( "|CREATE TABLE ([^ ]*)|", $qry, $matches ) ) {
    20302030            $cqueries[ trim( $matches[1], '`' ) ] = $qry;
     
    22152215                );
    22162216
    2217                 foreach( $index_strings as $index_string ) {
     2217                foreach ( $index_strings as $index_string ) {
    22182218                    if ( ! ( ( $aindex = array_search( $index_string, $indices ) ) === false ) ) {
    22192219                        unset( $indices[ $aindex ] );
     
    22662266    $alterations = dbDelta( $tables );
    22672267    echo "<ol>\n";
    2268     foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
     2268    foreach ($alterations as $alteration) echo "<li>$alteration</li>\n";
    22692269    echo "</ol>\n";
    22702270}
Note: See TracChangeset for help on using the changeset viewer.