mirror of
https://ghproxy.net/https://github.com/elementor/wp2static-addon-netlify.git
synced 2025-10-04 05:57:58 +08:00
rm table on uninstall;seed after db prep
This commit is contained in:
parent
28ab132294
commit
08f8fe701a
4 changed files with 16 additions and 42 deletions
|
@ -3,7 +3,7 @@ Contributors: leonstafford
|
||||||
Tags: wp2static,netlify,static
|
Tags: wp2static,netlify,static
|
||||||
Requires at least: 3.2
|
Requires at least: 3.2
|
||||||
Tested up to: 5.4
|
Tested up to: 5.4
|
||||||
Stable tag: 1.0-alpha-004
|
Stable tag: 1.0-alpha-005
|
||||||
License: Unlicense
|
License: Unlicense
|
||||||
License URI: http://unlicense.org
|
License URI: http://unlicense.org
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,6 @@ namespace WP2StaticNetlify;
|
||||||
|
|
||||||
class Controller {
|
class Controller {
|
||||||
public function run() : void {
|
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(
|
add_filter(
|
||||||
'wp2static_add_menu_items',
|
'wp2static_add_menu_items',
|
||||||
[ 'WP2StaticNetlify\Controller', 'addSubmenuPage' ]
|
[ 'WP2StaticNetlify\Controller', 'addSubmenuPage' ]
|
||||||
|
@ -30,12 +22,6 @@ class Controller {
|
||||||
15,
|
15,
|
||||||
1
|
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';
|
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||||
dbDelta( $sql );
|
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 {
|
public static function deactivate_for_single_site() : void {
|
||||||
|
|
|
@ -1,31 +1,12 @@
|
||||||
<?php
|
<?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 uninstall not called from WordPress, then exit.
|
||||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$table_name = $wpdb->prefix . 'wp2static_addon_netlify_options';
|
||||||
|
|
||||||
|
$wpdb->query( "DROP TABLE IF EXISTS $table_name" );
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Plugin Name: WP2Static Add-on: Netlify Deployment
|
* Plugin Name: WP2Static Add-on: Netlify Deployment
|
||||||
* Plugin URI: https://wp2static.com
|
* Plugin URI: https://wp2static.com
|
||||||
* Description: Netlify deployment add-on for WP2Static.
|
* Description: Netlify deployment add-on for WP2Static.
|
||||||
* Version: 1.0-alpha-004
|
* Version: 1.0-alpha-005
|
||||||
* Author: Leon Stafford
|
* Author: Leon Stafford
|
||||||
* Author URI: https://ljs.dev
|
* Author URI: https://ljs.dev
|
||||||
* License: Unlicense
|
* License: Unlicense
|
||||||
|
@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'WP2STATIC_NETLIFY_PATH', plugin_dir_path( __FILE__ ) );
|
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';
|
require WP2STATIC_NETLIFY_PATH . 'vendor/autoload.php';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue