Subversion Repositories eFlore/Applications.cel

Rev

Rev 2418 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2418 Rev 2427
Line 20... Line 20...
20
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
20
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
21
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
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>
22
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
23
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
23
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
24
 */
24
 */
25
class MigrationOptimisation extends Script {
25
class MigrationOptimisation extends CelScript {
Line 26... Line 26...
26
 
26
 
27
	public function executer() {
27
	public function executer() {
28
		$cmd = $this->getParametre('a');
28
		try {
Line -... Line 29...
-
 
29
			$this->initialiserProjet('migration_optimisation');
-
 
30
 
29
		$this->mode_verbeux = $this->getParametre('v');
31
			// Lancement de l'action demandée
30
 
32
			$cmd = $this->getParametre('a');
-
 
33
			switch ($cmd) {
31
		switch($cmd) {
34
				case 'maj' :
32
			case 'maj':
35
					$script = $this->chargerClasse('MajOptimisation');
33
				$this->migrerBdd();
36
					$script->executer();
-
 
37
					break;
-
 
38
				default :
34
				break;
39
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
-
 
40
			}
35
			default:
41
		} catch (Exception $e) {
36
				echo "Action «$cmd» inconnue.\n";
42
			$this->traiterErreur($e->getMessage());
Line 37... Line -...
37
		}
-
 
38
	}
-
 
39
 
-
 
40
	private function migrerBdd() {
-
 
41
		$contenuSql = FichierUtil::recupererContenu(__DIR__.'/maj_optimisation.sql');
-
 
42
		$this->executerScripSql($contenuSql);
43
		}
43
	}
-
 
44
 
44
	}
45
	private function executerScripSql($sql) {
45
 
46
		$requetes = SqlUtil::extraireRequetes($sql);
46
	private function chargerClasse($classe) {
47
		foreach ($requetes as $requete) {
-
 
48
			echo "Exécution de la requete : $requete\n";
47
		require_once $classe.'.php';
49
			$this->executer($requete);
48
		$conteneur = new Conteneur($this->parametres);
50
		}
49
		return new $classe($conteneur);