/**
  * Vide le cache
  *
  * @author Christophe Beyer <*****@*****.**>
  * @since 2006/12/05
  */
 public function clearCache()
 {
     // Les dossiers de temp
     $folder = COPIX_TEMP_PATH . 'cache';
     Demo_Tools::dirempty($folder);
     $folder = COPIX_TEMP_PATH . 'modules/registry';
     Demo_Tools::dirempty($folder);
     return true;
 }
 /**
  * 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);
 }
 public function dirSize($path, $recursive = true)
 {
     $result = 0;
     if (!is_dir($path) || !is_readable($path)) {
         return 0;
     }
     $fd = dir($path);
     while ($file = $fd->read()) {
         if ($file != "." && $file != "..") {
             if (is_dir($path . '/' . $file)) {
                 $result += $recursive ? Demo_Tools::dirSize($path . '/' . $file) : 0;
             } else {
                 $result += filesize($path . '/' . $file);
             }
         }
     }
     $fd->close();
     return $result;
 }
예제 #4
0
     } else {
         display_message(_LOGO_ERROR . "Erreur lors de l'importation des droits.");
         $ok = false;
     }
 }
 if ($ok) {
     $result = check_mysql_importdump('../../instal/gestionautonome_nullable.sql');
     if ($result) {
         display_message(_LOGO_GOOD . "Les modifications des tables scolaires ont &eacute;t&eacute; import&eacute;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&egrave;me de mise en place du dossier " . $folder . ".");
             $ok = false;
         }
     }
     if ($ok) {
         display_message(_LOGO_GOOD . "Les dossiers et fichiers de l'&eacute;dito ont bien &eacute;t&eacute; mis en place.");
     }
 }
 if ($ok) {
     check_mysql_runquery("INSERT INTO version SET version='" . $version . "', date=NOW()");
 }
예제 #5
0
<?php

ob_start();
session_start();
define('_MAIN_TITLE', "Mise &agrave; jour de la base de donn&eacute;es d'<a href=\"../\">ICONITO - Ecole Num&eacute;rique</a>");
require_once "install_check.class.php";
require_once "install_design.class.php";
require_once '../../utils/copix/copix.inc.php';
require_once '../../project/project.inc.php';
require_once "../../project/modules/public/stable/iconito/sysutils/classes/demo_tools.class.php";
define('_LOGO_GOOD', '<img src="images/accept.png" align="baseline" />&nbsp;&nbsp;');
define('_LOGO_WARNING', '<img src="images/error.png" align="baseline" />&nbsp;&nbsp;');
define('_LOGO_ERROR', '<img src="images/cancel.png" align="baseline" />&nbsp;&nbsp;');
define('_LOGO_INFO', '<img src="images/process_accept.png" align="baseline" />&nbsp;&nbsp;');
$Demo_Tools = new Demo_Tools();
display_menu();
display_title();
require COPIX_VAR_PATH . 'config/db_profiles.conf.php';
$dbOpt = $_db_profiles[$_db_default_profile];
$host = 'localhost';
$database = '';
if (preg_match('/dbname=([0-9A-Za-z-_\\.]+);?(host=)?([0-9A-Za-z-_\\.]+)?/', $dbOpt['connectionString'], $regs)) {
    if (isset($regs[3])) {
        $host = $regs[3];
    }
    $database = $regs[1];
    //echo '<pre>'; print_r($regs); echo '</pre>';
}
$_SESSION['install_iconito']['host'] = $host;
$_SESSION['install_iconito']['database'] = $database;
$_SESSION['install_iconito']['login'] = $dbOpt['user'];