From e0159c5422c9d6a4701753993ef900fd10e2bc11 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 10 Oct 2016 15:46:09 -0400 Subject: [PATCH] Adding database setup for the plugin Adding tables and initial data for the plugin. --- index.php | 2 +- setup/adminMenus.php | 12 +--- setup/adminTabs.php | 2 +- .../create_database_V0.0.1.sql | 55 +++++++++++++++++++ .../{examples => }/dbVersions.php | 3 +- .../examples/create_database_V0.0.1.sql | 42 -------------- 6 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 setup/databaseScripts/create_database_V0.0.1.sql rename setup/databaseScripts/{examples => }/dbVersions.php (89%) delete mode 100644 setup/databaseScripts/examples/create_database_V0.0.1.sql diff --git a/index.php b/index.php index a2ed674..37ad36b 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,7 @@ * version from this plugin. */ define('GLM_MEMBERS_CONDITIONS_PLUGIN_VERSION', '0.0.7'); -// define('GLM_MEMBERS_CONDITIONS_PLUGIN_DB_VERSION', '0.0.1'); +define('GLM_MEMBERS_CONDITIONS_PLUGIN_DB_VERSION', '0.0.1'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_CONDITIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.57'); diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 56edf35..d0594e4 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -71,6 +71,7 @@ */ // Add a main menu item +/* add_menu_page( 'GLM Conditions', // Page Title 'GLM Conditions', // Menu Title @@ -80,9 +81,10 @@ add_menu_page( false, // Icon URL '4' // Menu Position ); + */ add_submenu_page( - 'glm-members-admin-menu-conditions', // Parent slug + 'glm-members-admin-menu-members', // Parent slug 'Conditions', // Page title 'Conditions', // Menu Title 'glm_members_members', // Capability required @@ -90,11 +92,3 @@ add_submenu_page( function() {$this->controller('conditions');} ); -add_submenu_page( - 'glm-members-admin-menu-conditions', // Parent slug - 'Info', // Page title - 'Info', // Menu Title - 'glm_members_members', // Capability required - 'glm-members-admin-menu-conditions-info', // Menu slug - function() {$this->controller('info');} -); diff --git a/setup/adminTabs.php b/setup/adminTabs.php index 70ae8fb..6be83db 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -44,7 +44,6 @@ * } * ); * - */ add_filter('glm-member-db-add-tab-for-members', function($addOnTabs) { @@ -59,4 +58,5 @@ add_filter('glm-member-db-add-tab-for-members', return $addOnTabs; } ); + */ diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql new file mode 100644 index 0000000..fbbf1cd --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -0,0 +1,55 @@ +-- Gaslight Media Members Database - Conditions +-- File Created: 12/02/15 15:27:15 +-- Database Version: 0.0.1 +-- Database Creation Script +-- +-- This file is called to create a new set of tables for this +-- add-on for the most receint database version for this add-on. +-- +-- There should only be one such file in this directory +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Conditions Table +CREATE TABLE {prefix}conditions ( + id INT NOT NULL AUTO_INCREMENT, + name TEXT NOT NULL, + descr_short TEXT NULL, + descr TEXT NULL, + last_update DATE NULL, + PRIMARY KEY (id) +); + +---- + +-- Current Conditions Table +CREATE TABLE {prefix}current_condition ( + id INT NOT NULL AUTO_INCREMENT, + cond_id INT NOT NULL, + special TEXT NULL, + last_update DATE NULL, + PRIMARY KEY (id) +); + +---- + +-- Conditions default entries in table +INSERT INTO {prefix}conditions ( id, name, last_update ) VALUES +( 1, 'All Clear, Have a Pleasant Trip!', NOW() ), +( 2, 'High Wind Warning', NOW() ), +( 3, 'Wind Escort', NOW() ), +( 4, 'Partial Bridge Closure', NOW() ), +( 5, 'Bridge Closed - High Winds', NOW() ), +( 6, 'Bridge Closed - General', NOW() ), +( 7, 'Bridge Closed - Weather', NOW() ), +( 8, 'Falling Ice Warning', NOW() ), +( 9, 'Bridge Closed - Falling Ice', NOW() ), +( 10, 'Fog Warning', NOW() ), +( 11, 'Blowing Snow Warning', NOW() ), +( 12, 'Special Condition', NOW() ) +; + +---- + +INSERT INTO {prefix}current_condition ( id, cond_id, last_update ) VALUES ( 1, 1, NOW() ); diff --git a/setup/databaseScripts/examples/dbVersions.php b/setup/databaseScripts/dbVersions.php similarity index 89% rename from setup/databaseScripts/examples/dbVersions.php rename to setup/databaseScripts/dbVersions.php index 8e17b5e..0347305 100644 --- a/setup/databaseScripts/examples/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -34,7 +34,6 @@ $glmMembersConditionsDbVersions = array( - '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '1/1/2016'), - '0.0.2' => array('version' => '0.0.2', 'tables' => 2) + '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '10/10/2016'), ); diff --git a/setup/databaseScripts/examples/create_database_V0.0.1.sql b/setup/databaseScripts/examples/create_database_V0.0.1.sql deleted file mode 100644 index 3705c64..0000000 --- a/setup/databaseScripts/examples/create_database_V0.0.1.sql +++ /dev/null @@ -1,42 +0,0 @@ --- Gaslight Media Members Database - Conditions --- File Created: 12/02/15 15:27:15 --- Database Version: 0.0.1 --- Database Creation Script --- --- This file is called to create a new set of tables for this --- add-on for the most receint database version for this add-on. --- --- There should only be one such file in this directory --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes - - --- ********************************************************************** --- NOTE: THIS IS A CONDITIONS FILE - DO NOT USE UNMODIFIED --- --- Please change all references to conditions, Conditions, or CONDITIONS to a name --- appropriate for your new Add-On. --- --- Tables and queries in this file are conditions only. --- --- Remove this message before using this file in production! --- **********************************************************************/ - - --- Conditions Table -CREATE TABLE {prefix}sometablename ( - id INT NOT NULL AUTO_INCREMENT, - somefield TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - --- Conditions default entry in table -INSERT INTO {prefix}sometablename - ( id, somefield ) - VALUES - ( 1, 'conditions data' ) -; - -- 2.17.1