Subversion Repositories eFlore/Applications.cel

Rev

Rev 2418 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2415 jpm 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Mise à jour de la base de données afin de l'optimiser :
5
 * - remplacement du champ "eflore_publiable" de la table "cel_images" par un champ "transmission" (correspondant au champ tansmission des obs)
6
 * - ajout du champ "date_liaison" dans la table "cel_images"
2418 jpm 7
 * - ajout du champ "ce_observation" dans la table "cel_images"
8
 * - migration des données de la table cel_obs_images dans cel_images
9
 * - création d'un index sur cel_images.ce_observation
10
 * - suppression de la table cel_obs_images
2415 jpm 11
 *
12
 * Utilisation :
13
 * - mise à jour de la bdd : <code>/opt/lamp/bin/php cli.php migration_optimisation -a migrer</code>
14
 *
15
 * @category   CEL
16
 * @package    Scripts
17
 * @subpackage Migration : Optimisation
18
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
19
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
20
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
21
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
22
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
23
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
24
 */
2427 jpm 25
class MigrationOptimisation extends CelScript {
2415 jpm 26
 
27
	public function executer() {
2427 jpm 28
		try {
29
			$this->initialiserProjet('migration_optimisation');
2415 jpm 30
 
2427 jpm 31
			// Lancement de l'action demandée
32
			$cmd = $this->getParametre('a');
33
			switch ($cmd) {
34
				case 'maj' :
35
					$script = $this->chargerClasse('MajOptimisation');
36
					$script->executer();
37
					break;
38
				default :
39
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
40
			}
41
		} catch (Exception $e) {
42
			$this->traiterErreur($e->getMessage());
2415 jpm 43
		}
44
	}
45
 
2427 jpm 46
	private function chargerClasse($classe) {
47
		require_once $classe.'.php';
48
		$conteneur = new Conteneur($this->parametres);
49
		return new $classe($conteneur);
2415 jpm 50
	}
51
}