Support ⇒ Gamers Modules & Blocks ⇒ Need some help on hot clean up this cpg_inst.php ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum Index Modules & Blocks Gamers Modules & Blocks

Need some help on hot clean up this cpg_inst.php Reply to topic


I have been trying for awhile by looking atvarious other files to try to clean this one up. <?PHP /********************************************* CPG-Dragonflyâ.¢ CMS ******************************************** Copyright © 2004 - 2005 by CPG Dev Team www.dragonflycms.com Dragonfly is released under the terms and conditions of the GNU GPL version 2 or any later version $Source: /cvs/modules/IRCChat/modules/IRCChat/cpg_inst.php,v $ $Revision: 9.2 $ $Author: djmaze $ $Date: 2005/02/10 00:55:52 $ **********************************************/ if (!defined('ADMIN_MOD_INSTALL')) { exit; } //global $prefix; get_lang('application'); class Application { var $radmin; var $version; var $modname; var $description; var $author; var $website; var $dbtables; function Application() { $this->radmin = true; $this->version = '2.3.1.3'; $this->modname = 'Recruitment_Settings'; $this->description = 'EQ2 Recruitment Module'; $this->author = 'Ymryl,Anaxant, Robojerk and Razac for Dragonfly CMS converted from WOW to EQ2 by CrombieCrunch'; $this->website = 'www.dkppklace.com'; //$this->prefix = strtolower(basename(dirname(__FILE__))); $this->dbtables = array('recruitment', 'recruit_data'); } function install() { global $installer; $installer->add_query('CREATE', 'recruitment', " `status` varchar(32) NOT NULL default '', `berserker` varchar(32) NOT NULL default '', `guardian` varchar(32) NOT NULL default '', `shadowknight` varchar(32) NOT NULL default '', `bruiser` varchar(32) NOT NULL default '', `wizard` varchar(32) NOT NULL default '', `coercer` varchar(32) NOT NULL default '', `necromancer` varchar(32) NOT NULL default '', `warlock` varchar(32) NOT NULL default '', `inquisitor` varchar(32) NOT NULL default '', `fury` varchar(32) NOT NULL default '', `warden` varchar(32) NOT NULL default '', `defiler` varchar(32) NOT NULL default '', `assasin` varchar(32) NOT NULL default '', `dirge` varchar(32) NOT NULL default '', `troubador` varchar(32) NOT NULL default '', `brigand` varchar(32) NOT NULL default '', `grpID` tinyint(10) NOT NULL default '0', `showguildinfo` enum('1','0') NOT NULL default '1', `guildrules` varchar(255) NOT NULL default '', `rankstructure` varchar(255) NOT NULL default '', `raidinginfo` varchar(255) NOT NULL default '', `about` varchar(255) NOT NULL default '', `appmessage` varchar(255) NOT NULL default '', `appmessage_display` enum('1','0') NOT NULL default '1', `appcomment` varchar(255) NOT NULL default '', `recipient` varchar(100) NOT NULL default '', `testname` varchar(50) NOT NULL default '', `testrecipient` varchar(100) NOT NULL default '', `altallowed` enum('1','0') NOT NULL default '0', `berserker_forum_id` varchar(32) NOT NULL default '', `guardian_forum_id` varchar(32) NOT NULL default '', `shadowknight_forum_id` varchar(32) NOT NULL default '', `bruiser_forum_id` varchar(32) NOT NULL default '', `wizard_forum_id` varchar(32) NOT NULL default '', `coercer_forum_id` varchar(32) NOT NULL default '', `necromancer_forum_id` varchar(32) NOT NULL default '', `warlock_forum_id` varchar(32) NOT NULL default '', `inquisitor_forum_id` varchar(32) NOT NULL default '', `fury_forum_id` varchar(32) NOT NULL default '', `warden_forum_id` varchar(32) NOT NULL default '', `defiler_forum_id` varchar(32) NOT NULL default '', `assasin_forum_id` varchar(32) NOT NULL default '', `dirge_forum_id` varchar(32) NOT NULL default '', `troubador_forum_id` varchar(32) NOT NULL default '', `brigand_forum_id` varchar(32) NOT NULL default '', `save_db` enum('1','0') NOT NULL default '1', `post_forum` enum('1','0') NOT NULL default '0', `post_id` int(50) NOT NULL default '1', `post_name` varchar(255) NOT NULL default '', `post_sig` tinyint(10) NOT NULL default '0', `send_mail` enum('1','0') NOT NULL default '0', `berserker_reqs` text, `guardian_reqs` text, `shadowknight_reqs` text, `bruiser_reqs` text, `wizard_reqs` text, `coercer_reqs` text, `necromancer_reqs` text, `warlock_reqs` text, `inquisitor_reqs` text, `fury_reqs` text, `warden_reqs` text, `defiler_reqs` text, `assasin_reqs` text, `dirge_reqs` text, `troubador_reqs` text, `brigand_reqs` text, `apply_unless` text, `expect` text, `berserker_reqs1` text, `guardian_reqs1` text, `shadowknight_reqs1` text, `bruiser_reqs1` text, `wizard_reqs1` text, `coercer_reqs1` text, `necromancer_reqs1` text, `warlock_reqs1` text, `inquisitor_reqs1` text, `fury_reqs1` text, `warden_reqs1` text, `defiler_reqs1` text, `assasin_reqs1` text, `dirge_reqs1` text, `troubador_reqs1` text, `brigand_reqs1` text, `apply_unless1` text, `expect1` text, `mon_raid_start` varchar(10) NOT NULL default '', `mon_raid_end` varchar(10) NOT NULL default '', `tues_raid_start` varchar(10) NOT NULL default '', `tues_raid_end` varchar(10) NOT NULL default '', `wed_raid_start` varchar(10) NOT NULL default '', `wed_raid_end` varchar(10) NOT NULL default '', `thurs_raid_start` varchar(10) NOT NULL default '', `thurs_raid_end` varchar(10) NOT NULL default '', `fri_raid_start` varchar(10) NOT NULL default '', `fri_raid_end` varchar(10) NOT NULL default '', `sat_raid_start` varchar(10) NOT NULL default '', `sat_raid_end` varchar(10) NOT NULL default '', `sun_raid_start` varchar(10) NOT NULL default '', `sun_raid_end` varchar(10) NOT NULL default '', `raid_notes` varchar(255) NOT NULL default '', `guild_name` varchar(255) NOT NULL default '', `server` varchar(255) NOT NULL default '', `armory_url` varchar(255) NOT NULL default ''", 'recruitment'); $installer->add_query('INSERT', 'recruitment', '"'._OPEN.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "'._RECRUIT_CLOSE.'", "0", "1", "", "", "", "", "", "1", "", "", "", "", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "1", "0", "1", "", "0", "0", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""'); $installer->add_query('CREATE', 'recruit_data', " `ID` int(100) unsigned NOT NULL auto_increment, `Name` varchar(255) NOT NULL default '', `age` varchar(5) NOT NULL default '', `email` varchar(255) NOT NULL default '', `time_zone` varchar(10) NOT NULL default '', `charname` varchar(255) NOT NULL default '', `class` varchar(50) NOT NULL default '', `lvl` varchar(30) NOT NULL default '', `fa_lvl` varchar(30) NOT NULL default '', `cook_lvl` varchar(30) NOT NULL default '', `fish_lvl` varchar(30) NOT NULL default '', `prof1` varchar(100) NOT NULL default '', `prof2` varchar(100) NOT NULL default '', `prof1_lvl` varchar(30) NOT NULL default '', `prof2_lvl` varchar(30) NOT NULL default '', `talentname` varchar(100) NOT NULL default '', `tpoint1` varchar(10) NOT NULL default '0', `tpoint2` varchar(10) NOT NULL default '0', `tpoint3` varchar(10) NOT NULL default '0', `res_fr` varchar(10) NOT NULL default '0', `res_shad` varchar(10) NOT NULL default '0', `res_arc` varchar(10) NOT NULL default '0', `res_nature` varchar(10) NOT NULL default '0', `res_frost` varchar(10) NOT NULL default '0', `att_ony` enum('Yes','No') NOT NULL default 'No', `att_mc` enum('Yes','No') NOT NULL default 'No', `att_bwl` enum('Yes','No') NOT NULL default 'No', `att_naxx` enum('Yes','No') NOT NULL default 'No', `att_kara` enum('Yes','No') NOT NULL default 'No', `att_serp` enum('Yes','No') NOT NULL default 'No', `att_eye` enum('Yes','No') NOT NULL default 'No', `att_hyjal` enum('Yes','No') NOT NULL default 'No', `gear_url` varchar(255) NOT NULL default '', `alt1` varchar(255) NOT NULL default '', `alt2` varchar(255) NOT NULL default '', `guild1` varchar(100) NOT NULL default '', `guild2` varchar(100) NOT NULL default '', `guild3` varchar(100) NOT NULL default '', `guild_reason` varchar(255) NOT NULL default '', `respec` enum('Yes','No') NOT NULL default 'No', `scale_play` tinyint(10) NOT NULL default '0', `flymount` enum('Yes','No') NOT NULL default 'No', `raid_mon` enum('Yes','No') NOT NULL default 'No', `raid_tues` enum('Yes','No') NOT NULL default 'No', `raid_wed` enum('Yes','No') NOT NULL default 'No', `raid_thurs` enum('Yes','No') NOT NULL default 'No', `raid_fri` enum('Yes','No') NOT NULL default 'No', `raid_sat` enum('Yes','No') NOT NULL default 'No', `raid_sun` enum('Yes','No') NOT NULL default 'No', `bosses_zul` varchar(255) NOT NULL default '', `bosses_mc` varchar(255) NOT NULL default '', `bosses_bwl` varchar(255) NOT NULL default '', `bosses_aq40` varchar(255) NOT NULL default '', `bosses_naxx` varchar(255) NOT NULL default '', `bosses_kara` varchar(255) NOT NULL default '', `bosses_mag` varchar(255) NOT NULL default '', `bosses_gruul` varchar(255) NOT NULL default '', `bosses_serp` varchar(255) NOT NULL default '', `bosses_eye` varchar(255) NOT NULL default '', `bosses_bltemple` varchar(255) NOT NULL default '', `bosses_hyjal` varchar(255) NOT NULL default '', `tbc_key_shatter` enum('Yes','No') NOT NULL default 'No', `tbc_key_shadow` enum('Yes','No') NOT NULL default 'No', `tbc_key_arc` enum('Yes','No') NOT NULL default 'No', `tbc_hfc_rep` enum('Yes','No') NOT NULL default 'No', `tbc_cfr_rep` enum('Yes','No') NOT NULL default 'No', `tbc_auch_rep` enum('Yes','No') NOT NULL default 'No', `tbc_tk_rep` enum('Yes','No') NOT NULL default 'No', `tbc_cot_rep` enum('Yes','No') NOT NULL default 'No', `read_faqs` enum('Yes','No') NOT NULL default 'No', `cdate` date NOT NULL default '0000-00-00', `other_notes` varchar(255) NOT NULL default '', `cook_lvl1` varchar(30), `fish_lvl1` varchar(30), `alt11` varchar(255) NOT NULL default '', `alt21` varchar(255) NOT NULL default '', `respec1` enum('Yes','No') NOT NULL default 'Yes', PRIMARY KEY (`ID`)", 'recruit_data'); return true; } function uninstall() { global $installer; $installer->add_query('DROP', 'recruitment'); $installer->add_query('DROP', 'recruit_data'); return true; } function upgrade($prev_version) { global $installer; $installer->add_query('ADD', 'recruitment', 'armory_url varchar(255) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'tpoint1 tpoint1 varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'tpoint2 tpoint2 varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'tpoint3 tpoint3 varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'res_fr res_fr varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'res_shad res_shad varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'res_arc res_arc varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'res_nature res_nature varchar(10) NOT NULL default 0'); $installer->add_query('CHANGE', 'recruit_data', 'res_frost res_frost varchar(10) NOT NULL default 0'); //$installer->add_query('ALTER TABLE', 'recruitment', //"(CHANGE `tpoint1` `tpoint1` varchar(10) NOT NULL default '0', //CHANGE `tpoint2` `tpoint2` varchar(10) NOT NULL default '0')" , //'_recruitment'); return true; } }

I would like to break the stuff down to sections so more data can be added if needed. For example on the `berserker` varchar(32) NOT NULL default '', `guardian` varchar(32) NOT NULL default '', I would like to be labeled as "classes" and so on having each area of the database labeled and then have the 'insert' section matching. I have tried three or four differant ways from looking at other files but I always get errors when I try to install it. Any ideas or help?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.39/5.0.45/5.2.5/9.1.2.1


Confused I would like to be labeled as "classes" and so on having each area of the database labeled and then have the 'insert' section matching.

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


he sorry I wasnt more clear on it here is a example of how I would like it to look:

function install() { global $installer; // classes $installer->add_query('CREATE', 'recruitment', " `status` varchar(32) NOT NULL default '', `berserker` varchar(32) NOT NULL default '', `guardian` varchar(32) NOT NULL default '', `shadowknight` varchar(32) NOT NULL default '', `bruiser` varchar(32) NOT NULL default '', `wizard` varchar(32) NOT NULL default '', `coercer` varchar(32) NOT NULL default '', `necromancer` varchar(32) NOT NULL default '', `warlock` varchar(32) NOT NULL default '', `inquisitor` varchar(32) NOT NULL default '', `fury` varchar(32) NOT NULL default '', `warden` varchar(32) NOT NULL default '', `defiler` varchar(32) NOT NULL default '', `assasin` varchar(32) NOT NULL default '', `dirge` varchar(32) NOT NULL default '', `troubador` varchar(32) NOT NULL default '', `brigand` varchar(32) NOT NULL default ''", 'recruitment'); // various settings $installer->add_query('ADD', 'recruitment', " `grpID` tinyint(10) NOT NULL default '0', `showguildinfo` enum('1','0') NOT NULL default '1', `guildrules` varchar(255) NOT NULL default '', `rankstructure` varchar(255) NOT NULL default '', `raidinginfo` varchar(255) NOT NULL default '', `about` varchar(255) NOT NULL default '', `appmessage` varchar(255) NOT NULL default '', `appmessage_display` enum('1','0') NOT NULL default '1', `appcomment` varchar(255) NOT NULL default '', `recipient` varchar(100) NOT NULL default '', `testname` varchar(50) NOT NULL default '', `testrecipient` varchar(100) NOT NULL default '', `altallowed` enum('1','0') NOT NULL default '0'", 'recruitment'); // class forums $installer->add_query('ADD', 'recruitment', " `berserker_forum_id` varchar(32) NOT NULL default '', `guardian_forum_id` varchar(32) NOT NULL default '', `shadowknight_forum_id` varchar(32) NOT NULL default '', `bruiser_forum_id` varchar(32) NOT NULL default '', `wizard_forum_id` varchar(32) NOT NULL default '', `coercer_forum_id` varchar(32) NOT NULL default '', `necromancer_forum_id` varchar(32) NOT NULL default '', `warlock_forum_id` varchar(32) NOT NULL default '', `inquisitor_forum_id` varchar(32) NOT NULL default '', `fury_forum_id` varchar(32) NOT NULL default '', `warden_forum_id` varchar(32) NOT NULL default '', `defiler_forum_id` varchar(32) NOT NULL default '', `assasin_forum_id` varchar(32) NOT NULL default '', `dirge_forum_id` varchar(32) NOT NULL default '', `troubador_forum_id` varchar(32) NOT NULL default '', `brigand_forum_id` varchar(32) NOT NULL default '', `save_db` enum('1','0') NOT NULL default '1', `post_forum` enum('1','0') NOT NULL default '0', `post_id` int(50) NOT NULL default '1', `post_name` varchar(255) NOT NULL default '', `post_sig` tinyint(10) NOT NULL default '0', `send_mail` enum('1','0') NOT NULL default '0'", 'recruitment'); // class requirements $installer->add_query('ADD', 'recruitment', " `berserker_reqs` text, `guardian_reqs` text, `shadowknight_reqs` text, `bruiser_reqs` text, `wizard_reqs` text, `coercer_reqs` text, `necromancer_reqs` text, `warlock_reqs` text, `inquisitor_reqs` text, `fury_reqs` text, `warden_reqs` text, `defiler_reqs` text, `assasin_reqs` text, `dirge_reqs` text, `troubador_reqs` text, `brigand_reqs` text, `apply_unless` text, `expect` text, `berserker_reqs1` text, `guardian_reqs1` text, `shadowknight_reqs1` text, `bruiser_reqs1` text, `wizard_reqs1` text, `coercer_reqs1` text, `necromancer_reqs1` text, `warlock_reqs1` text, `inquisitor_reqs1` text, `fury_reqs1` text, `warden_reqs1` text, `defiler_reqs1` text, `assasin_reqs1` text, `dirge_reqs1` text, `troubador_reqs1` text, `brigand_reqs1` text, `apply_unless1` text, `expect1` text,", 'recruitment'); // raid times and server info $installer->add_query('ADD', 'recruitment', " `mon_raid_start` varchar(10) NOT NULL default '', `mon_raid_end` varchar(10) NOT NULL default '', `tues_raid_start` varchar(10) NOT NULL default '', `tues_raid_end` varchar(10) NOT NULL default '', `wed_raid_start` varchar(10) NOT NULL default '', `wed_raid_end` varchar(10) NOT NULL default '', `thurs_raid_start` varchar(10) NOT NULL default '', `thurs_raid_end` varchar(10) NOT NULL default '', `fri_raid_start` varchar(10) NOT NULL default '', `fri_raid_end` varchar(10) NOT NULL default '', `sat_raid_start` varchar(10) NOT NULL default '', `sat_raid_end` varchar(10) NOT NULL default '', `sun_raid_start` varchar(10) NOT NULL default '', `sun_raid_end` varchar(10) NOT NULL default '', `raid_notes` varchar(255) NOT NULL default '', `guild_name` varchar(255) NOT NULL default '', `server` varchar(255) NOT NULL default '', `armory_url` varchar(255) NOT NULL default ''", 'recruitment');

The above is just for the create tables part. Of course on the section to actually insert the data in to the database would be setup the same way.

That way if sony adds a new class you can just add it to bothe sections of the installer with ease.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.39/5.0.45/5.2.5/9.1.2.1


You are asking for lot of troubles, try to use something like our cms_config_custom table structure.

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


hehe tbh i have no idea what i would do with that. This is all new to me and trial by error with mor errors then success Wink

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/1.3.39/5.0.45/5.2.5/9.1.2.1


As far I understand you are trying to have "plugins" for your module and they will add new "columns" to the same table.
This will be very unstable for very many reasons.

You could create a table for every plugin you have, its basic and you can't get wrong.

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS

All times are UTC


Jump to: