![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: setup.php 102 2008-03-18 19:52:59Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/history/setup.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 /* 7 * Name: History 8 * Directory: history 9 * Version: 0.32 10 * Class: user 11 * UI Name: History 12 * UI Icon: 13 */ 14 15 // MODULE CONFIGURATION DEFINITION 16 $config = array(); 17 $config['mod_name'] = 'History'; 18 $config['mod_version'] = '0.32'; 19 $config['mod_directory'] = 'history'; 20 $config['mod_setup_class'] = 'CSetupHistory'; 21 $config['mod_type'] = 'user'; 22 $config['mod_ui_name'] = 'History'; 23 $config['mod_ui_icon'] = ''; 24 $config['mod_description'] = 'A module for tracking changes'; 25 26 if ($a == 'setup') { 27 echo w2PshowModuleConfig($config); 28 } 29 30 class CSetupHistory { 31 32 function install() { 33 $sql = ' ( 34 history_id int(10) unsigned NOT NULL auto_increment, 35 history_date datetime NOT NULL default \'0000-00-00 00:00:00\', 36 history_user int(10) NOT NULL default \'0\', 37 history_action varchar(20) NOT NULL default \'modify\', 38 history_item int(10) NOT NULL, 39 history_table varchar(20) NOT NULL default \'\', 40 history_project int(10) NOT NULL default \'0\', 41 history_name varchar(255), 42 history_changes text, 43 history_description text, 44 PRIMARY KEY (history_id), 45 INDEX index_history_module (history_table, history_item), 46 INDEX index_history_item (history_item) 47 ) TYPE=MyISAM'; 48 $q = new DBQuery; 49 $q->createTable('history', $sql); 50 $q->exec(); 51 $q->clear(); 52 return (db_error() ? false : true); 53 } 54 55 function remove() { 56 $q = new DBQuery; 57 $q->dropTable('history'); 58 $q->exec(); 59 $q->clear(); 60 return (db_error() ? false : true); 61 } 62 63 function upgrade($old_version) { 64 $q = new DBQuery; 65 switch ($old_version) { 66 case '0.3': 67 $q->alterTable('history'); 68 $q->addIndex('index_history_item', '(history_item)'); 69 $q->exec(); 70 $q->clear(); 71 $q->alterTable('history'); 72 $q->addIndex('index_history_module', '(history_table, history_item)'); 73 $q->exec(); 74 $q->clear(); 75 case '0.31': 76 $q->alterTable('history'); 77 $q->alterField('history_table', 'varchar(20) NOT NULL default ""'); 78 $q->alterField('history_action', 'varchar(20) NOT NULL default "modify"'); 79 $q->exec(); 80 $q->clear(); 81 case '0.32': 82 break; 83 } 84 return (db_error() ? false : true); 85 } 86 } 87 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |