/** * Installe le jeu d'essai * * @author Christophe Beyer <*****@*****.**> * @since 2006/10/26 */ public function processInstall() { global $params; $db = new Demo_DB(); $tools = new Demo_Tools(); $db->extract_db_infos(); $db->db_connect(); $fileSQL = '../instal/demo/jeu_essai.sql'; $errors = array(); if (CopixConfig::get('kernel|jeuEssaiInstalled') == 1) { $errors[] = CopixI18N::get('sysutils|demo.error.alreadyInstalled'); } elseif (!is_file($fileSQL)) { $errors[] = CopixI18N::get('sysutils|demo.error.noFileSql'); } if ($errors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $errors), 'back' => CopixUrl::get())); } $contents = file_get_contents($fileSQL); $lines = explode(";\n", $contents); $path = CopixUrl::getRequestedScriptPath(); foreach ($lines as $line) { $line = trim($line); if ($line) { $line = str_replace('<PATH>', $path, $line); // print_r("<br>***line=".$line); $db->run_query($line); } } $db->db_close(); // Copie des dossiers (pas de slashs à la fin!) $tools->installFolder('www/static/malle/2_9a4ba0cdef'); $tools->installFolder('var/data/blog/logos'); $tools->installFolder('www/static/album/2_be8550b87c'); $tools->installFolder('www/static/album/3_cf057489c9'); $tools->installFolder('www/static/album/4_c996b6cf13'); $tools->installFolder('www/static/prefs/avatar'); // Fin CopixConfig::set('kernel|jeuEssaiInstalled', 1); // Vidage de cache CacheServices::clearCache(); CacheServices::clearConfDB(); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', CopixI18N::get('sysutils|demo.titlePage')); $tplDemo = new CopixTpl(); //$tplDemo->assign ("toto", 1); $tplDemo->assign('demo_txt_installed', CopixI18N::get('sysutils|demo.txt.installed')); $tplDemo->assign('demo_txt_accounts', CopixI18N::get('sysutils|demo.txt.accounts')); $tpl->assign("MAIN", $tplDemo->fetch("demo_install.tpl")); $tpl->assign('MENU', Admin::getMenu('demo')); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
} } if ($ok) { $result = check_mysql_importdump('../../instal/gestionautonome_nullable.sql'); if ($result) { display_message(_LOGO_GOOD . "Les modifications des tables scolaires ont été importées."); } else { display_message(_LOGO_ERROR . "Erreur lors des modifications des tables scolaires."); $ok = false; } } if ($ok) { $tools = new Demo_Tools(); $folders = array('www/static/classeur/1-49376fcb9d', 'www/static/prefs/avatar'); foreach ($folders as $folder) { $installFolder = $tools->installFolder($folder, false); if (!$installFolder) { display_message(_LOGO_ERROR . "Problème de mise en place du dossier " . $folder . "."); $ok = false; } } if ($ok) { display_message(_LOGO_GOOD . "Les dossiers et fichiers de l'édito ont bien été mis en place."); } } if ($ok) { check_mysql_runquery("INSERT INTO version SET version='" . $version . "', date=NOW()"); } if ($ok) { display_link("Cliquez ici pour continuer", 'index.php?step=' . ($step + 1)); } else {