array( __DIR__ . '/../../library/Zend/autoload_classmap.php', __DIR__ . '/../../library/Application/autoload_classmap.php', __DIR__ . '/../../application/autoload_classmap.php', __DIR__ . '/../../library/Scores/autoload_classmap.php', __DIR__ . '/../../library/SdMetier/autoload_classmap.php', ), 'Zend_Loader_StandardAutoloader' => array( 'prefixes' => array( 'Zend' => __DIR__ . '/../../library/Zend', 'Application' => __DIR__ . '/../../library/Application', 'Scores' => __DIR__ . '/../../library/Scores', 'SdMetier' => __DIR__ . '/../../library/SdMetier', 'Metier' => __DIR__ . '/../../library/Metier', ), 'fallback_autoloader' => true ) )); // Zend_Application - Use it if you don't have autoloaders //require_once 'Zend/Application.php'; try { $opts = new Zend_Console_Getopt( //Options array( 'help|?' => "Affiche les informations d'utilisation", 'install=s' => "Installe et configure", ) ); $opts->parse(); } catch (Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); exit; } //Usage if (isset($opts->help)) { echo $opts->getUsageMessage(); exit; } if ($opts->install) { echo date('Y-m-d H:i:s')." - Démarrage de la configuration.\n"; //Copy configuration $configDir = realpath(dirname(__FILE__)).'/profil'; $appconfigDir = APPLICATION_PATH.'/configs'; $profil = $opts->install; if ( ! file_exists($appconfigDir.'/application.ini') ) { $result = copy($configDir.'/'.$profil.'/application.ini', $appconfigDir.'/application.ini'); if ($result !== true) { echo date('Y-m-d H:i:s')." - Impossible de copier la configuration.\n"; exit(1); } } else { echo date('Y-m-d H:i:s')." - Le profil de configuration existe déja.\n"; exit(1); } // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $c = new Zend_Config($application->getOptions()); //Create data directory and all his children $dirToCreate = array( APPLICATION_PATH.'/../data', APPLICATION_PATH.'/../data/cache', APPLICATION_PATH.'/../data/log', APPLICATION_PATH.'/../data/files', APPLICATION_PATH.'/../data/sessions', APPLICATION_PATH.'/../data/wsdl', ); foreach ($dirToCreate as $dir) { if ( !file_exists($dir) ) { mkdir($dir); } } // Generate cache file // genCache.php // genCodeRatios.php if ( substr(strtoupper(PHP_OS),0,3) != 'WIN' ) { //Copy files passthru('cp -rv '.realpath(dirname(__FILE__)).'/files/* '.$c->profil->path->files.'/'); //Modification des permissions passthru('chown -R www-data: '.APPLICATION_PATH.'/../'); //Check WKHTMLTOPDF $wkhtml = exec('echo $(which wkhtmltopdf)'); if ( empty(trim($wkhtml)) ) { echo date('Y-m-d H:i:s')." - Warning : WKHTMLTOPDF non installé.\n"; } } //Check persistent data directories if ( !file_exists($c->profil->path->data.'/log') ) { echo date('Y-m-d H:i:s')." - Info répertoire ".$c->profil->path->data.'/log'. " non présent"; echo "\n"; } echo date('Y-m-d H:i:s')." - Fin de la configuration.\n"; }