- Timestamp:
- Mar 13, 2012, 4:08:31 PM (13 years ago)
- Location:
- branches/Modular
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Modular/Common/Model.php
r378 r398 33 33 var $Module; 34 34 var $Installed; 35 var $Parent; 35 36 36 37 function __construct($Database, $System) … … 181 182 if($Property['Null']) $Null = 'NULL'; 182 183 else $Null = 'NOT NULL'; 184 $Null = 'NULL'; 183 185 if($Property['Type'] == PropertyDateTime) 184 186 $Query .= '`'.$Property['Name'].'` DATETIME '.$Null.','; … … 223 225 } 224 226 $Query .= 'PRIMARY KEY (`Id`)'. 225 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1 227 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=1;'; 226 228 $this->Database->query($Query); 227 229 foreach($this->Properties as $Property) -
branches/Modular/Common/Module.php
r383 r398 5 5 class Module 6 6 { 7 var $Id; 7 8 var $Name; 8 9 var $Version; … … 127 128 `Installed` int(11) NOT NULL, 128 129 `Description` text COLLATE utf8_czech_ci NOT NULL, 129 `Dependencies` varchar(255) COLLATE utf8_czech_ci NOT NULL,130 130 PRIMARY KEY (`Id`) 131 131 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 132 133 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModuleDependency` ( 134 `Id` int(11) NOT NULL AUTO_INCREMENT, 135 `Module` int(11) NOT NULL, 136 `DependencyModule` int(11) NOT NULL, 137 PRIMARY KEY (`Id`), 138 KEY (`Module`), 139 KEY (`DependencyModule`), 140 UNIQUE (`Module` , `DependencyModule`) 141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 142 $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)'); 143 $this->Database->query('ALTER TABLE `SystemModuleDependency` ADD FOREIGN KEY ( `DependencyModule` ) REFERENCES `SystemModule` (`Id`)'); 144 132 145 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModel` ( 133 146 `Id` int(11) NOT NULL AUTO_INCREMENT, … … 137 150 PRIMARY KEY (`Id`) 138 151 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 152 $this->Database->query('ALTER TABLE `SystemModel` ADD FOREIGN KEY ( `Module` ) REFERENCES `SystemModule` (`Id`)'); 153 139 154 $this->Database->query('CREATE TABLE IF NOT EXISTS `SystemModelProperty` ( 140 155 `Id` int(11) NOT NULL AUTO_INCREMENT, … … 145 160 PRIMARY KEY (`Id`) 146 161 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 162 $this->Database->query('ALTER TABLE `SystemModelProperty` ADD FOREIGN KEY ( `Model` ) REFERENCES `SystemModel` (`Id`)'); 163 147 164 $this->ReloadList(); 148 165 $this->LoadModules(false); 149 foreach($this->Modules as $Index => $Module) 150 { 151 $this->Modules[$Index]->Install(); 152 } 166 $this->Modules['System']->Install(); 167 //foreach($this->Modules as $Index => $Module) 168 //{ 169 // $this->Modules[$Index]->Install(); 170 //} 153 171 } 154 172 … … 162 180 $this->Database->query('DROP TABLE IF EXISTS `SystemModelProperty`'); 163 181 $this->Database->query('DROP TABLE IF EXISTS `SystemModel`'); 182 $this->Database->query('DROP TABLE IF EXISTS `SystemModuleDependency`'); 164 183 $this->Database->query('DROP TABLE IF EXISTS `SystemModule`'); 165 184 } … … 195 214 'Version' => $Module->Version, 'Creator' => $Module->Creator, 196 215 'Description' => $Module->Description, 'License' => $Module->License, 197 'Installed' => 0 , 'Dependencies' => implode(',', $Module->Dependencies)));216 'Installed' => 0)); 198 217 unset($Module); 199 218 } else throw new Exception('Missing class '.$ModuleClassName.' in module '.$ModuleName); … … 207 226 $this->Database->query('DELETE FROM `SystemModule` WHERE `Id` = '.$Module['Id']); 208 227 } 228 229 // Reload dependencies 230 $this->LoadModules(false); 231 foreach($this->Modules as $Module) 232 { 233 foreach($Module->Dependencies as $Dependency) 234 { 235 $this->Database->insert('SystemModuleDependency', array('Module' => $Module->Id, 236 'DependencyModule' => $this->Modules[$Dependency]->Id)); 237 } 238 } 209 239 } 210 240 } -
branches/Modular/Modules/Member/Member.php
r379 r398 40 40 $this->AddPropertyBoolean('Blocked'); 41 41 } 42 } 43 44 class MemberUser extends Model 45 { 46 function __construct($Database, $System) 47 { 48 parent::__construct($Database, $System); 49 $this->Name = 'MemberUser'; 50 $this->Parent = 'User'; 51 $this->AddPropertyOneToMany('Member', 'Member', true); 52 } 42 53 } 43 54 -
branches/Modular/Modules/System/System.php
r383 r398 44 44 $this->License = 'GNU/GPL'; 45 45 $this->Description = 'Base system module'; 46 $this->Dependencies = array( );46 $this->Dependencies = array('User'); 47 47 $this->SupportedModels = array('SystemMenu', 'SystemView', 'SystemAction'); 48 48 } -
branches/Modular/Modules/User/User.php
r383 r398 48 48 $this->AddPropertyString('Password'); 49 49 $this->AddPropertyString('Email'); 50 $this->AddPropertyString('LastIpAddress'); 51 $this->AddPropertyDateTime('LastLoginTime'); 52 $this->AddPropertyDateTime('RegistrationTime'); 53 $this->AddPropertyOneToMany('Member', 'Member'); 50 $this->AddPropertyString('LastIpAddress'); 51 $this->AddPropertyDateTime('LastLoginTime', true); 52 $this->AddPropertyDateTime('RegistrationTime', true); 54 53 $this->AddPropertyBoolean('Locked'); 55 54 $this->AddPropertyInteger('ICQ'); 56 $this->AddPropertyString('PhoneNumber'); 57 $this->AddPropertyString('InitPassword'); 55 $this->AddPropertyString('PhoneNumber'); 56 $this->AddPropertyString('InitPassword'); 58 57 } 59 58 … … 372 371 $this->License = 'GNU/GPL'; 373 372 $this->Description = 'User management'; 374 $this->Dependencies = array( );373 $this->Dependencies = array('System'); 375 374 $this->SupportedModels = array('User', 'UserOnline'); 376 375 $this->Views = array('UserLogin', 'PasswordRecove', 'UserRegister', 'UserOptions', … … 389 388 function Install() 390 389 { 390 $Installed = $this->Installed; 391 391 parent::Install(); 392 if(!$ this->Installed)392 if(!$Installed) 393 393 { 394 394 $this->Database->insert('User', array('Id' => ANONYMOUS_ID, 'Login' => 'Anonymous', 'Name' => 'Anonymous', -
branches/Modular/config.sample.php
r344 r398 7 7 'Database' => array 8 8 ( 9 'Host' => ' centrala',9 'Host' => 'localhost', 10 10 'User' => 'root', 11 11 'Password' => '', 12 'Database' => ' is',12 'Database' => 'centrala', 13 13 'Prefix' => '', 14 14 'Charset' => 'utf8', … … 25 25 'Admin' => 'Admin', 26 26 'AdminEmail' => 'admin@localhost', 27 'ShowSQLError' => false,27 'ShowSQLError' => $IsDeveloper, 28 28 'ShowSQLQuery' => false, 29 'ShowPHPError' => false,29 'ShowPHPError' => $IsDeveloper, 30 30 'ShowRuntimeInfo' => false, 31 'ShowDebug' => $IsDeveloper, 31 32 'ErrorLogFile' => '/var/www/html/dev/centrala/www/php_script_error.log', 32 33 'WebcamPassword' => '',
Note:
See TracChangeset
for help on using the changeset viewer.