Index: branches/5.1.x/core/install.php =================================================================== diff -u -N -r12657 -r13086 --- branches/5.1.x/core/install.php (.../install.php) (revision 12657) +++ branches/5.1.x/core/install.php (.../install.php) (revision 13086) @@ -1,6 +1,6 @@ toolkit->getThemes(true)) == 1) { - // only one theme -> set it as primary - $sql = 'UPDATE ' . $this->Application->getUnitOption('theme', 'TableName') . ' - SET Enabled = 1, PrimaryTheme = 1 - LIMIT 1'; - $this->Conn->Query($sql); - - $this->toolkit->rebuildThemes(); // rescan theme to create structure after theme is enabled !!! - - $this->currentStep = $this->GetNextStep(); - } + // put available theme list in database + $this->toolkit->rebuildThemes(); break; case 'upgrade_modules': @@ -575,8 +566,17 @@ $this->toolkit->RunSQL('/core/install/install_data.sql'); // create category using sql, because Application is not available here + $table_name = $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'IdGenerator'; + $this->Conn->Query('UPDATE ' . $table_name . ' SET lastid = lastid + 1'); + $resource_id = $this->Conn->GetOne('SELECT lastid FROM ' . $table_name); + if ($resource_id === false) { + $this->Conn->Query('INSERT INTO '.$table_name.' (lastid) VALUES (2)'); + $resource_id = 2; + } + $fields_hash = Array ( 'l1_Name' => 'Content', 'Filename' => 'Content', 'AutomaticFilename' => 0, + 'CreatedById' => -1, 'CreatedOn' => time(), 'ResourceId' => $resource_id - 1, 'l1_Description' => 'Content', 'Status' => 4, ); @@ -773,6 +773,9 @@ // import base language for core (english) $this->toolkit->ImportLanguage('/core/install/english'); + // make sure imported language is set as active in session, created during installation + $this->Application->Session->SetField('Language', 1); + // set imported language as primary $lang =& $this->Application->recallObject('lang.-item', null, Array('skip_autoload' => true)); /* @var $lang LanguagesItem */ @@ -842,6 +845,22 @@ $this->Conn->Query($sql); } } + + // install theme dependent demo data + if ($this->Application->GetVar('install_demo_data')) { + $sql = 'SELECT Name + FROM ' . $theme_table . ' + WHERE ' . $theme_idfield . ' = ' . $theme_id; + $theme_name = $this->Conn->GetOne($sql); + + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { + if ($module_name == 'In-Portal') { + continue; + } + + $this->toolkit->RunSQL('/themes' . '/' . $theme_name . '/' . $module_info['TemplatePath'] . '_install/install_data.sql', '{ThemeId}', $theme_id); + } + } break; case 'upgrade_modules': @@ -961,7 +980,7 @@ } foreach ($versions as $version) { - $upgrade_method = 'Upgrade_'.str_replace('.', '_', $version); + $upgrade_method = 'Upgrade_'.str_replace(Array ('.', '-'), '_', $version); if (method_exists($upgrade_object, $upgrade_method)) { $upgrade_object->$upgrade_method($mode); } @@ -1434,4 +1453,3 @@ return array_key_exists($name, $button_visibility) ? $button_visibility[$name] : true; } } -?> \ No newline at end of file