Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug and update MariaDB versions #28

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions inc/App/PluginActivation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static function index()
{

self::create_versions_table();
self::insert_versions_data();
self::create_execution_table();
self::create_config_table();

Expand Down Expand Up @@ -68,11 +69,8 @@ private static function create_versions_table()
$sql = str_replace(array_keys($vars), array_values($vars), $sql);

require_once(ABSPATH . 'wp-admin/includes/upgrade.php');

dbDelta($sql);

self::insert_versions_data();

}

private static function insert_versions_data()
Expand All @@ -87,10 +85,10 @@ private static function insert_versions_data()
$table_name = $wpdb->prefix . 'mariadb_versions';

$record = $wpdb->get_var("SELECT COUNT(*) from $table_name where id = 1");

// print_r($record);exit;

if ($record) return;
if ($record) {
$sql = "TRUNCATE TABLE " . $wpdb->prefix . "mariadb_versions;";
$wpdb->query($sql);
}

$charset_collate = $wpdb->get_charset_collate();

Expand Down Expand Up @@ -144,7 +142,7 @@ private static function insert_config_data()

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

$record = $wpdb->get_var("SELECT COUNT(*) from $table_name where id = 1");
$record = $wpdb->get_var("SELECT COUNT(*) from $table_name");

// print_r($record);exit;

Expand Down
2 changes: 2 additions & 0 deletions mariadb-health-checks.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require_once 'inc/bootstrap.php';

register_activation_hook( __FILE__, 'mdbhc_activation' );
add_action( 'upgrader_process_complete', 'mdbhc_activation' );


function wpauto_plugin_init() {
load_plugin_textdomain( 'mariadb-health-checks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
Expand Down
3 changes: 2 additions & 1 deletion static/table-mariadb_versions-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ INSERT INTO `%%VAR_PREFIX%%mariadb_versions` VALUES
(10,'10.8','2023-05-20'),
(11,'10.9','2023-08-22'),
(12,'10.10','2023-11-17'),
(13,'10.11','2028-02-16');
(13,'10.11','2028-02-16'),
(14,'11.0','2024-06-06');
Loading