Correction script de configuration

This commit is contained in:
Michael RICOIS 2012-04-23 08:50:51 +00:00
parent aac6d30ef4
commit 8e9c2f9263

View File

@ -1,7 +1,7 @@
#!/usr/bin/php
<?php
// Paramètres
if ( count($argc)<1 || in_array($argv[1], array('--help', '-help', '-h', '-?')) ) {
if ( count($argv)<1 || in_array($argv[1], array('--help', '-help', '-h', '-?')) ) {
?>
Utilisation : <?php echo $argv[0]; ?> [actions]
@ -26,6 +26,17 @@ $SPHINX_VERSION = array(
'2.0.4' => array('archive'=>'sphinx-2.0.4-release.tar.gz', 'dir'=>'sphinx-2.0.4-release'),
);
/**
* Nécessaire :
* ============
* GCC : gcc g++
* MySQL : libmysqld-dev
*
* tree
*
*/
if ($argv[1]=='install')
{
//Version
@ -34,6 +45,8 @@ if ($argv[1]=='install')
}
$version = $argv[2];
//Vérification nécessaires
//Compilation
$cmd = array();
$cmd[] = "tar xzvf ".$SPHINX_VERSION[$version]['archive'];
@ -69,15 +82,16 @@ if ($argv[1]=='config')
}
//Configuration
if (!file_exist("config/".$hostname."/".$argv[2])){
if (!file_exists("config/".$hostname."/".$argv[2])){
echo "Erreur\n"; exit;
}
$server = $argv[2];
$concat = '';
for($i=3;$i<count($argc);$i++){
$concat.= "config/".$hostname."/".$server."/".$argv[$i];
for($i=3;$i<count($argv);$i++){
$concat.= " config/".$hostname."/".$server."/".$argv[$i];
}
exec("cat config/".$hostname."/".$server."/sphinx.conf ".$concact." > /usr/local/sphinx/etc/sphinx.conf");
//@todo :
exec("cat config/".$hostname."/".$server."/sphinx.conf".$concat." > /usr/local/sphinx/etc/sphinx.conf");
}