Activation rule flushes - seems to be reliable. Needs testing on other environments.

This commit is contained in:
Mike Jolley 2012-02-17 21:25:06 +00:00
parent 316ed9901a
commit a533953779
5 changed files with 12 additions and 27 deletions

View File

@ -63,9 +63,6 @@ function woocommerce_admin_installed_notice() {
</div>
<?php
// Flush rules after install
flush_rewrite_rules( false );
// Set installed option
update_option('woocommerce_installed', 0);
}

View File

@ -19,6 +19,11 @@ function do_install_woocommerce() {
woocommerce_default_options();
woocommerce_tables_install();
woocommerce_install_custom_fields();
// Register post types
$woocommerce->init_taxonomy();
// Add default taxonomies
woocommerce_default_taxonomies();
// Install folder for uploading files and prevent hotlinking
@ -45,9 +50,6 @@ function do_install_woocommerce() {
// Update version
update_option( "woocommerce_db_version", $woocommerce->version );
// Flush rewrites
flush_rewrite_rules( false );
}
/**
@ -286,27 +288,6 @@ function woocommerce_tables_install() {
*/
function woocommerce_default_taxonomies() {
if (!post_type_exists('product')) :
register_post_type('product',
array(
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'publicly_queryable' => true,
'exclude_from_search' => false,
'hierarchical' => true,
'query_var' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments' ),
'show_in_nav_menus' => false,
)
);
endif;
if (!taxonomy_exists('product_type')) :
register_taxonomy( 'product_type', array('post', 'product'));
register_taxonomy( 'shop_order_status', array('post', 'product'));
endif;
$product_types = array(
'simple',
'grouped',

View File

@ -1033,6 +1033,8 @@ function woocommerce_settings() {
wp_redirect( add_query_arg( 'subtab', esc_attr(str_replace('#', '', $_POST['subtab'])), add_query_arg( 'saved', 'true', admin_url( 'admin.php?page=woocommerce&tab=' . $current_tab ) )) );
exit;
}
// Settings saved message

View File

@ -90,6 +90,8 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* Fix for reducing/increasing stock notifications
* Don't reset shipping method on cart during every update
* Method availability (country) for local pickup/delivery
* Fixed permalinks in shortcodes
* Install process tweaks (for flushing post type rules)
= 1.4.3 - 16/02/2012 =
* Fix for variation shipping class detection

View File

@ -257,6 +257,7 @@ class Woocommerce {
**/
function install() {
register_activation_hook( __FILE__, 'activate_woocommerce' );
register_activation_hook( __FILE__, 'flush_rewrite_rules' );
if ( get_option('woocommerce_db_version') != $this->version ) : add_action('init', 'install_woocommerce', 0); endif;
}
@ -441,6 +442,8 @@ class Woocommerce {
**/
function init_taxonomy() {
if (post_type_exists('product')) return;
/**
* Slugs
**/