Modifications entre les versions 2 et 3
Version 2 à la date du 2007-09-20 12:05:46
Taille: 3091
Éditeur: JérômeSantini
Commentaire: même pas vrai !
Version 3 à la date du 2007-09-20 12:40:36
Taille: 3487
Commentaire: Corrections et en fait c'est pas Phil qui a fait le plugin, il l'a juste amélioré.
Texte supprimé. Texte ajouté.
Ligne 33: Ligne 33:
if (!defined("_ECRIRE_INC_VERSION")) return;
require _DIR_RACINE . 'mutualisation/mutualiser.php';
Ligne 36: Ligne 34:
// mutualise http://serveur/spip/le_site/
if (
                preg_match(',^/spip/([\.a-zA-Z0-9_-]+)/,', $_SERVER['REQUEST_URI'], $r)
                AND !is_dir(_DIR_RACINE . $r[1])
) {
        // definir les prefixe des tables aussi lorsque ce n'est pas une installation.
        $GLOBALS['table_prefix'] = 'spip';
       if (!defined("_ECRIRE_INC_VERSION")) return;
       require _DIR_RACINE.'mutualisation/mutualiser.php';
Ligne 44: Ligne 37:
        // rep plugin (decocher pour qu'il soit dans /sites/le_site/plugins et non mutualises dans /plugins)
        #define('_DIR_PLUGINS', _DIR_RACINE . 'sites/' . $r[1] . '/plugins/');
       $site = str_replace('www.', '', $_SERVER['HTTP_HOST']);
       if ($site != $_SERVER['HTTP_HOST']) {
               include_spip('inc/headers');
               redirige_par_entete('http://'.$site.'/');
       }
Ligne 47: Ligne 43:
        // params installation
        define ('_INSTALL_HOST_DB', 'localhost');
        define ('_INSTALL_USER_DB_ROOT', 'spip');
        define ('_INSTALL_PASS_DB_ROOT', 'mot2passe');
        define ('_INSTALL_NAME_DB', 'mutu_'.prefixe_mutualisation($r[1]));
        define ('_INSTALL_TABLE_PREFIX', 'spip');
       define('_DIR_PLUGINS', _DIR_RACINE . 'sites/' . $site . '/plugins/');
Ligne 54: Ligne 45:
        // demarrage mutu
        demarrer_site($r[1],
                array(
                        'cookie_prefix' => true,
                        'table_prefix' => false,
                        'creer_site' => true,
                        'creer_base' => true,
                        'creer_user_base' => true,
                        'repertoire' => 'sites',
                        'mail' => 'root+spip@xx.refer.org'
                )
        );
}

       define ('_INSTALL_SERVER_DB', 'mysql');
       define ('_INSTALL_HOST_DB', 'localhost');
       define ('_INSTALL_USER_DB_ROOT', 'root');
       define ('_INSTALL_PASS_DB_ROOT', '******');
       define ('_INSTALL_NAME_DB', 'mu_'.prefixe_mutualisation($site));
       define ('_INSTALL_TABLE_PREFIX', 'spip');

    /* Inutile pour le moment mais ca te servira pour le service
    d'hébergement avec les utilisateurs / code d'activation stockés en BD
       define ('_INSTALL_PANEL_HOST_DB', 'localhost');
       define ('_INSTALL_PANEL_USER_DB', 'root');
       define ('_INSTALL_PANEL_PASS_DB', '******');
       define ('_INSTALL_PANEL_NAME_DB', 'mutualisation_spip');
       define ('_INSTALL_PANEL_NAME_TABLE', 'utilisateurs');
       define ('_INSTALL_PANEL_FIELD_SITE', 'url');
       define ('_INSTALL_PANEL_FIELD_PASS', 'password');
       define ('_INSTALL_PANEL_FIELD_CODE', 'code'); */



       demarrer_site($site,
               array(
                       'creer_site' => true,
                       'creer_base' => true,
                       'creer_user_base' => true,
                       'repertoire' => 'spip',
                       /*'code' => 'etrangerencontre',
                       'mail' => 'phil@africacomputing.org',
                       'utiliser_panel' => true */
               )
       );


?>

SPIP

Présentation

TODO cékoidonc

Mutualisation

Aide de référence : http://www.spip-contrib.net/La-mutualisation-facile Merci à Philippe Drouot pour ses explications et son plugin

Procédure rapide pour tester sur sa machine

Téléchargement des fichiers

  • Création de /var/www/mutualisation/ et récupération de spip svn

sudo svn checkout svn://trac.rezo.net/spip/spip /var/www/mutualisation/
  • Création de /var/www/mutualisation/mutualisation et récupération de zone.spip.org/spip-zone/_plugins_/_test_/mutualisation

sudo svn co svn://zone.spip.org/spip-zone/_plugins_/_test_/mutualisation/ /var/www/mutualisation/mutualisation/

Configuration

  • Modif de /etc/apache2/sites-available/default : modifier le DocumentRoot par défaut pour le remplacer par DocumentRoot /var/www/mutualisation + relance d'apache

sudo apache2ctl restart
  • Créer /var/www/mutualisation/config/mes_options.php comme indiqué dans http://www.spip-contrib.net/La-mutualisation-facile (typiquement prendre l'exemple indiqué dans la section "Création automatique d’un utilisateur sur la base de donnée créé automatiquement" en renseignant _INSTALL_USER_DB_ROOT et _INSTALL_PASS_DB_ROOT)

<?php

       if (!defined("_ECRIRE_INC_VERSION")) return;
       require _DIR_RACINE.'mutualisation/mutualiser.php';

       $site = str_replace('www.', '', $_SERVER['HTTP_HOST']);
       if ($site != $_SERVER['HTTP_HOST']) {
               include_spip('inc/headers');
               redirige_par_entete('http://'.$site.'/');
       }

       define('_DIR_PLUGINS', _DIR_RACINE . 'sites/' . $site . '/plugins/');


       define ('_INSTALL_SERVER_DB', 'mysql');
       define ('_INSTALL_HOST_DB', 'localhost');
       define ('_INSTALL_USER_DB_ROOT', 'root');
       define ('_INSTALL_PASS_DB_ROOT', '******');
       define ('_INSTALL_NAME_DB', 'mu_'.prefixe_mutualisation($site));
       define ('_INSTALL_TABLE_PREFIX', 'spip');

    /* Inutile pour le moment mais ca te servira pour le service
    d'hébergement avec les utilisateurs / code d'activation stockés en BD
       define ('_INSTALL_PANEL_HOST_DB', 'localhost');
       define ('_INSTALL_PANEL_USER_DB', 'root');
       define ('_INSTALL_PANEL_PASS_DB', '******');
       define ('_INSTALL_PANEL_NAME_DB', 'mutualisation_spip');
       define ('_INSTALL_PANEL_NAME_TABLE', 'utilisateurs');
       define ('_INSTALL_PANEL_FIELD_SITE', 'url');
       define ('_INSTALL_PANEL_FIELD_PASS', 'password');
       define ('_INSTALL_PANEL_FIELD_CODE', 'code'); */



       demarrer_site($site,
               array(
                       'creer_site' => true,
                       'creer_base' => true,
                       'creer_user_base' => true,
                       'repertoire' => 'spip',
                       /*'code' => 'etrangerencontre',
                       'mail' => 'phil@africacomputing.org',
                       'utiliser_panel' => true    */
               )
       );


?>

Tests

  • Pour tester sur sa machine des trucs bidons, éditer /etc/hosts et ajouter des lignes du genre :

127.0.0.1 toto.chezmoi
127.0.0.1 titi.chezmoi
127.0.0.1 tutu.chezmoi
  • Se rendre sur http://toto.chezmoi, l'installation automatique de spip devrait apparaître. (Mot d'activation par défaut : ecureuil)

SPIP (dernière édition le 2008-02-21 22:09:24 par localhost)