Changeset 91 for trunk/Modules/User/UModuleUser.pas
- Timestamp:
- Sep 7, 2012, 8:36:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/UModuleUser.pas
r90 r91 16 16 constructor Create(Owner: TComponent); override; 17 17 destructor Destroy; override; 18 procedure Start; override; 19 procedure Stop; override; 18 20 procedure Install; override; 19 21 procedure Uninstall; override; 20 procedure Up date; override;22 procedure Upgrade; override; 21 23 end; 22 24 25 23 26 implementation 27 28 uses 29 UCore, UUserControlPage, USqlDatabase; 24 30 25 31 { TModuleUser } … … 28 34 begin 29 35 inherited; 36 Identification := 'User'; 37 Title := 'User management'; 38 Version := '0.1'; 39 License := 'GNU/LGPL v3'; 40 Author := 'Chronosoft'; 30 41 end; 31 42 … … 35 46 end; 36 47 37 procedure TModuleUser. Install;48 procedure TModuleUser.Start; 38 49 begin 50 Core.Pages.RegisterPage(TUserControlPage, UserControlPage, 'uzivatel'); 51 //RegisterPage(TUserControlPage, UserControlPage, ''); 39 52 inherited; 40 53 end; 41 54 42 procedure TModuleUser. Uninstall;55 procedure TModuleUser.Stop; 43 56 begin 44 57 inherited; 58 Core.Pages.UnregisterPage('uzivatel'); 45 59 end; 46 60 47 procedure TModuleUser.Update; 61 procedure TModuleUser.Install; 62 var 63 DbRows: TDbRows; 64 begin 65 try 66 DbRows := TDbRows.Create; 67 Core.CommonDatabase.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `User` (' + 68 '`Id` int(11) NOT NULL AUTO_INCREMENT,' + 69 '`Name` varchar(255) NOT NULL,' + 70 '`FullName` varchar(255) NOT NULL,' + 71 '`Password` varchar(255) NOT NULL,' + 72 '`Salt` varchar(255) NOT NULL,' + 73 '`Email` varchar(255) NOT NULL,' + 74 '`RegistrationTime` datetime NOT NULL,' + 75 'PRIMARY KEY (`Id`)' + 76 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 77 Core.CommonDatabase.Query(DbRows, 'CREATE TABLE IF NOT EXISTS `UserOnline` (' + 78 '`Id` int(11) NOT NULL AUTO_INCREMENT,' + 79 '`User` int(11) NOT NULL DEFAULT ''0'',' + 80 '`ActivityTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' + 81 '`LoginTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' + 82 '`SessionId` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' + 83 '`IpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' + 84 '`HostName` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' + 85 '`ScriptName` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 86 'PRIMARY KEY (`Id`),' + 87 'KEY `User` (`User`)' + 88 ') ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;'); 89 finally 90 DbRows.Free; 91 end; 92 inherited Install; 93 end; 94 95 procedure TModuleUser.Uninstall; 96 var 97 DbRows: TDbRows; 98 begin 99 inherited Uninstall; 100 try 101 DbRows := TDbRows.Create; 102 Core.CommonDatabase.Query(DbRows, 'DROP TABLE `User`'); 103 Core.CommonDatabase.Query(DbRows, 'DROP TABLE `UserOnline`'); 104 finally 105 DbRows.Free; 106 end; 107 end; 108 109 procedure TModuleUser.Upgrade; 48 110 begin 49 111 inherited;
Note:
See TracChangeset
for help on using the changeset viewer.