woocommerce/admin/woocommerce-admin-update.php

46 lines
1.2 KiB
PHP
Raw Normal View History

2012-10-18 13:47:21 +00:00
<?php
/**
* WooCommerce Updates
*
* Plugin updates script which updates the database.
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Updates
2012-12-03 19:19:58 +00:00
* @version 2.0.0
2012-10-18 13:47:21 +00:00
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Runs the installer.
*
* @access public
* @return void
*/
function do_update_woocommerce() {
global $woocommerce;
2012-11-27 16:22:47 +00:00
// Include installer so we have page creation functions
include_once( 'woocommerce-admin-install.php' );
2012-10-18 13:47:21 +00:00
// Do updates
$current_db_version = get_option( 'woocommerce_db_version' );
2012-11-27 16:22:47 +00:00
2012-10-18 13:47:21 +00:00
if ( version_compare( $current_db_version, '1.4', '<' ) ) {
include( 'includes/updates/woocommerce-update-1.4.php' );
update_option( 'woocommerce_db_version', '1.4' );
}
2012-11-27 16:22:47 +00:00
2012-10-18 13:47:21 +00:00
if ( version_compare( $current_db_version, '1.5', '<' ) ) {
include( 'includes/updates/woocommerce-update-1.5.php' );
update_option( 'woocommerce_db_version', '1.5' );
}
2012-11-27 16:22:47 +00:00
2012-12-03 19:19:58 +00:00
if ( version_compare( $current_db_version, '2.0', '<' ) ) {
include( 'includes/updates/woocommerce-update-2.0.php' );
update_option( 'woocommerce_db_version', '2.0' );
2012-10-18 13:47:21 +00:00
}
2012-11-27 16:22:47 +00:00
2012-10-18 13:47:21 +00:00
update_option( 'woocommerce_db_version', $woocommerce->version );
}