for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Upgrade related functions.
*
* @since 1.0.0
*/
* Perform automatic upgrades when necessary.
function wpinv_automatic_upgrade() {
$wpi_version = get_option( 'wpinv_version' );
if ( $wpi_version == WPINV_VERSION ) {
return;
}
if ( version_compare( $wpi_version, '0.0.5', '<' ) ) {
wpinv_v005_upgrades();
update_option( 'wpinv_version', WPINV_VERSION );
add_action( 'admin_init', 'wpinv_automatic_upgrade' );
function wpinv_v005_upgrades() {
global $wpdb;
$wpdb->query( "UPDATE " . $wpdb->posts . " SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );