Skip to content
Commits on Source (1)
......@@ -15,9 +15,10 @@ $ai_activity_db_version = '1.0';
define('AI_ACTIVITY_TABLE_NAME', 'ai_global_activity');
define('AI_ACTIVITY_PAGE_ARG_NAME', 'actpage');
define('AI_ACTIVITY_DB_VERSION_OPT', 'ai_activity_db_version');
/* Database schema initialization */
function ai_activity_install() {
function ai_activity_db_setup() {
global $wpdb;
global $ai_activity_db_version;
......@@ -40,15 +41,19 @@ function ai_activity_install() {
require_once(ABSPATH . "wp-admin/includes/upgrade.php");
dbDelta($sql);
}
add_option('ai_activity_db_version', $ai_activity_db_version);
function ai_activity_install() {
ai_activity_db_setup();
add_network_option(null, AI_ACTIVITY_DB_VERSION_OPT, $ai_activity_db_version);
}
/* Database schema upgrade check */
function ai_activity_update_db_check() {
global $ai_activity_db_version;
if (get_site_option('ai_activity_db_version') != $ai_activity_db_version) {
ai_activity_install();
if (get_network_option(null, AI_ACTIVITY_DB_VERSION_OPT) != $ai_activity_db_version) {
ai_activity_db_setup();
update_network_option(null, AI_ACTIVITY_DB_VERSION_OPT, $ai_activity_db_version);
}
}
......