rm table on uninstall;seed after db prep

This commit is contained in:
Leon 2020-04-17 15:13:21 +09:30
parent 28ab132294
commit 08f8fe701a
4 changed files with 16 additions and 42 deletions

View file

@ -3,7 +3,7 @@ Contributors: leonstafford
Tags: wp2static,netlify,static
Requires at least: 3.2
Tested up to: 5.4
Stable tag: 1.0-alpha-004
Stable tag: 1.0-alpha-005
License: Unlicense
License URI: http://unlicense.org


View file

@ -4,14 +4,6 @@ namespace WP2StaticNetlify;

class Controller {
public function run() : void {
// check for seed data
// if deployment_url option doesn't exist, create:
$options = $this->getOptions();

if ( ! isset( $options['siteID'] ) ) {
$this->seedOptions();
}

add_filter(
'wp2static_add_menu_items',
[ 'WP2StaticNetlify\Controller', 'addSubmenuPage' ]
@ -30,12 +22,6 @@ class Controller {
15,
1
);

// if ( defined( 'WP_CLI' ) ) {
// \WP_CLI::add_command(
// 'wp2static netlify',
// [ 'WP2StaticNetlify\CLI', 'netlify' ]);
// }
}

/**
@ -150,6 +136,13 @@ class Controller {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql );

// check for seed data
// if deployment_url option doesn't exist, create:
$options = self::getOptions();

if ( ! isset( $options['siteID'] ) ) {
self::seedOptions();
}
}

public static function deactivate_for_single_site() : void {

View file

@ -1,31 +1,12 @@
<?php

/**
* Fired when the plugin is uninstalled.
*
* When populating this file, consider the following flow
* of control:
*
* - This method should be static
* - Check if the $_REQUEST content actually is the plugin name
* - Run an admin referrer check to make sure it goes through authentication
* - Verify the output of $_GET makes sense
* - Repeat with other user roles. Best directly by using the links/query string parameters.
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
*
* This file may be updated more in future version of the Boilerplate; however, this is the
* general skeleton and outline for how the file should work.
*
* For more information, see the following discussion:
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
*
* @link https://leonstafford.github.io
* @since 1.0.0
*
* @package Wp2static_Addon_Netlify
*/

// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}

global $wpdb;

$table_name = $wpdb->prefix . 'wp2static_addon_netlify_options';

$wpdb->query( "DROP TABLE IF EXISTS $table_name" );

View file

@ -4,7 +4,7 @@
* Plugin Name: WP2Static Add-on: Netlify Deployment
* Plugin URI: https://wp2static.com
* Description: Netlify deployment add-on for WP2Static.
* Version: 1.0-alpha-004
* Version: 1.0-alpha-005
* Author: Leon Stafford
* Author URI: https://ljs.dev
* License: Unlicense
@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
}

define( 'WP2STATIC_NETLIFY_PATH', plugin_dir_path( __FILE__ ) );
define( 'WP2STATIC_NETLIFY_VERSION', '1.0-alpha-004' );
define( 'WP2STATIC_NETLIFY_VERSION', '1.0-alpha-005' );

require WP2STATIC_NETLIFY_PATH . 'vendor/autoload.php';