$microVersion = 0; $flagNextVersion = true; } } } } if ($gDbType === 'postgresql') { // soundex is not a default function in PostgreSQL $sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = \'0\' WHERE prf_name LIKE \'system_search_similar\''; $gDb->query($sql); } // since version 3 we do the update with xml files and a new class model if ($mainVersion >= 3) { // reread component because in version 3.0 the component will be created within the update $componentUpdateHandle = new ComponentUpdate($gDb); $componentUpdateHandle->readDataByColumns(array('com_type' => 'SYSTEM', 'com_name_intern' => 'CORE')); $componentUpdateHandle->setTargetVersion(ADMIDIO_VERSION); $componentUpdateHandle->update(); } if ($gDbType === 'mysql') { // activate foreign key checks, so database is consistent $sql = 'SET foreign_key_checks = 1 '; $gDb->query($sql); } // nach dem Update erst einmal bei Sessions das neue Einlesen des Organisations- und Userobjekts erzwingen $sql = 'UPDATE ' . TBL_SESSIONS . ' SET ses_renew = 1 '; $gDb->query($sql); // create an installation unique cookie prefix and remove special characters $gCookiePraefix = 'ADMIDIO_' . $g_organization . '_' . $g_adm_db . '_' . $g_tbl_praefix; $gCookiePraefix = strtr($gCookiePraefix, ' .,;:[]', '_______');
// read data from sql script db.sql and execute all statements to the current database $filename = 'db_scripts/db.sql'; $file = fopen($filename, 'r') or showNotice($gL10n->get('INS_DATABASE_FILE_NOT_FOUND', 'db.sql', 'adm_program/installation/db_scripts'), 'installation.php?mode=6', $gL10n->get('SYS_BACK'), 'layout/back.png'); $content = fread($file, filesize($filename)); $sql_arr = explode(';', $content); fclose($file); foreach ($sql_arr as $sql) { if (trim($sql) !== '') { // Prefix fuer die Tabellen einsetzen und SQL-Statement ausfuehren $sql = str_replace('%PREFIX%', $g_tbl_praefix, $sql); $db->query($sql); } } // create default data // add system component to database $component = new ComponentUpdate($db); $component->setValue('com_type', 'SYSTEM'); $component->setValue('com_name', 'Admidio Core'); $component->setValue('com_name_intern', 'CORE'); $component->setValue('com_version', ADMIDIO_VERSION); $component->setValue('com_beta', (string) ADMIDIO_VERSION_BETA); $component->setValue('com_update_step', $component->getMaxUpdateStep()); $component->save(); // create a hidden system user for internal use // all recordsets created by installation will get the create id of the system user $gCurrentUser = new TableUsers($db); $gCurrentUser->setValue('usr_login_name', $gL10n->get('SYS_SYSTEM')); $gCurrentUser->setValue('usr_valid', '0'); $gCurrentUser->setValue('usr_timestamp_create', DATETIME_NOW); $gCurrentUser->save(false); // no registered user -> UserIdCreate couldn't be filled