Make WordPress Core

Ticket #29107: 29107.diff

File 29107.diff, 1.7 KB (added by voldemortensen, 11 years ago)
  • src/wp-admin/includes/schema.php

     
    398398        'comment_moderation' => 0,
    399399        'moderation_notify' => 1,
    400400        'permalink_structure' => '',
     401        'rewrite_rules' => '',
    401402        'gzipcompression' => 0,
    402403        'hack_file' => 0,
    403404        'blog_charset' => 'UTF-8',
  • src/wp-includes/rewrite.php

     
    20432043         * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
    20442044         */
    20452045        public function flush_rules($hard = true) {
    2046                 delete_option('rewrite_rules');
     2046                update_option( 'rewrite_rules', '' );
    20472047                $this->wp_rewrite_rules();
    20482048                /**
    20492049                 * Filter whether a "hard" rewrite rule flush should be performed when requested.
  • tests/phpunit/tests/rewrite.php

     
    120120
    121121                restore_current_blog();
    122122        }
    123 }
    124  No newline at end of file
     123
     124        /*
     125         * @ticket 29107
     126         */
     127        function test_function_rules_option_noempty() {
     128                global $wp_rewrite;
     129
     130                $wp_rewrite->set_permalink_structure( '' );
     131                $wp_rewrite->flush_rules();
     132                $wp_rewrite->set_permalink_structure( '/%postname%/' );
     133                $wp_rewrite->flush_rules();
     134
     135                $rewrite_rules = get_option( 'rewrite_rules' );
     136
     137                $this->assertTrue( is_array( $rewrite_rules ) );
     138                $this->assertNotEmpty( $rewrite_rules );
     139        }
     140}