22,42 → 22,57 |
$cmd = $this->getParametre('a'); |
switch ($cmd) { |
case 'chargerTous' : |
$this->chargerStructureSql(); |
$this->chargerVersions(); |
$version = $this->getClasseVersion(); |
$version->chargerTous(); |
break; |
case 'chargerStructureSql' : |
$this->chargerStructureSql(); |
$version = $this->getClasseVersion(); |
$version->chargerStructureSql(); |
break; |
case 'chargerVersions' : |
$this->chargerVersions(); |
$version = $this->getClasseVersion(); |
$version->chargerVersions(); |
break; |
case 'supprimerTous' : |
$this->supprimerTous(); |
$version = $this->getClasseVersion(); |
$version->supprimerTous(); |
break; |
case 'creerV1' : |
$this->creerVersion1(); |
$version = $this->getClasseVersion(); |
$version->creerVersion1(); |
break; |
case 'nettoyerV1' : |
$this->nettoyerVersion1(); |
$version = $this->getClasseVersion(); |
$version->nettoyerVersion1(); |
break; |
case 'creerDscTxt' : |
$this->creerDescriptionTxt(); |
$description = $this->getClasseDescription(); |
$description->genererDescriptionTxt(); |
break; |
case 'statDscTxt' : |
$this->verifierDescriptionTxt(); |
$description = $this->getClasseDescription(); |
$description->verifierDescriptionTxt(); |
break; |
case 'correspondanceDsc' : |
$this->genererCorrespondanceDescription(); |
$description = $this->getClasseDescription(); |
$description->genererCorrespondance(); |
break; |
case 'fusionIndex' : |
$this->fusionnerIndex(); |
$description = $this->getClasseIndex(); |
$description->fusionnerIndex(); |
break; |
case 'uploadFichiersSp' : |
$this->uploaderFichiersSp(); |
$wiki = $this->getClasseWiki(); |
$wiki->uploaderFichiersSp(); |
break; |
case 'downloadWiki' : |
$this->dowloaderWiki(); |
$wiki = $this->getClasseWiki(); |
$wiki->dowloaderPagesWiki(); |
break; |
case 'uploadEflore' : |
$wiki = $this->getClasseWiki(); |
$wiki->uploaderDansWikiEflore(); |
break; |
default : |
throw new Exception("Erreur : la commande '$cmd' n'existe pas!"); |
} |
66,132 → 81,21 |
} |
} |
|
private function chargerVersions() { |
$versions = explode(',', Config::get('versions')); |
$versionsDonnees = explode(',', Config::get('versionsDonnees')); |
foreach ($versions as $id => $version) { |
$versionDonnees = $versionsDonnees[$id]; |
$this->chargerStructureSqlVersion($versionDonnees, $version); |
$this->chargerIndexVersion($versionDonnees, $version); |
$this->chargerDumpWikiniVersion($versionDonnees, $version); |
} |
private function getClasseVersion($version = '1') { |
$version1 = $this->getClasse('Version'); |
return $version1; |
} |
|
private function chargerStructureSqlVersion($versionDonnees, $version) { |
$fichierSqlTpl = Config::get('chemins.structureSqlVersionTpl'); |
$fichierSql = sprintf($fichierSqlTpl, $versionDonnees, $version); |
$contenuSql = $this->recupererContenu($fichierSql); |
$this->executerScripSql($contenuSql); |
} |
|
private function chargerIndexVersion($versionDonnees, $version) { |
$fichierTsvTpl = Config::get('chemins.costeTpl'); |
$fichierTsv = sprintf($fichierTsvTpl, $versionDonnees, $version); |
$tableTpl = Config::get('tables.costeTpl'); |
$table = sprintf($tableTpl, $version); |
$requete = "LOAD DATA INFILE '$fichierTsv' ". |
"REPLACE INTO TABLE $table ". |
'CHARACTER SET utf8 '. |
'FIELDS '. |
" TERMINATED BY '\t' ". |
" ENCLOSED BY '' ". |
" ESCAPED BY '\\\' ". |
'IGNORE 1 LINES '; |
$this->getBdd()->requeter($requete); |
} |
|
private function chargerDumpWikiniVersion($versionDonnees, $version) { |
$fichierWikiTpl = Config::get('chemins.costeWikiniTpl'); |
$fichierDump = sprintf($fichierWikiTpl, $versionDonnees, $version); |
$contenuSql = $this->recupererContenu($fichierDump); |
$this->executerScripSql($contenuSql); |
} |
|
private function supprimerTous() { |
$requete = "DROP TABLE IF EXISTS coste_meta, ". |
" coste_acls, coste_links, coste_pages, coste_referrers, coste_triples, coste_users, ". |
" coste_v1_00 "; |
$this->getBdd()->requeter($requete); |
} |
|
private function nettoyerVersion1() { |
$requete = "DROP TABLE IF EXISTS coste_correspondance_bdnff, coste_images_auteur_correspondance_bdnff, ". |
" coste_images_correspondance_bdnff, coste_index, coste_index_general"; |
$this->getBdd()->requeter($requete); |
} |
|
private function creerVersion1() { |
$this->chargerStructureSqlVersion('0.00', '0_00'); |
$this->chargerCosteImagesAuteurCorrespondanceBdnff(); |
$this->chargerCosteCorrespondanceBdnff(); |
} |
|
private function chargerCosteImagesAuteurCorrespondanceBdnff() { |
$fichierTsv = sprintf(Config::get('dossierTsvTpl'), '0.00').'coste_images_auteur_correspondance_bdnff.tsv'; |
$requete = "LOAD DATA INFILE '$fichierTsv' ". |
"REPLACE INTO TABLE coste_images_auteur_correspondance_bdnff ". |
'CHARACTER SET utf8 '. |
'FIELDS '. |
" TERMINATED BY '\t' ". |
" ENCLOSED BY '\"' ". |
" ESCAPED BY '\\\' ". |
'IGNORE 1 LINES '; |
$this->getBdd()->requeter($requete); |
} |
|
private function chargerCosteCorrespondanceBdnff() { |
$fichierTsv = sprintf(Config::get('dossierTsvTpl'), '0.00').'coste_images_correspondance_bdnff.tsv'; |
$requete = "LOAD DATA INFILE '$fichierTsv' ". |
"REPLACE INTO TABLE coste_images_correspondance_bdnff ". |
'CHARACTER SET utf8 '. |
'FIELDS '. |
" TERMINATED BY '\t' ". |
" ENCLOSED BY '' ". |
" ESCAPED BY '\\\' ". |
'IGNORE 1 LINES '; |
$this->getBdd()->requeter($requete); |
} |
|
private function creerDescriptionTxt() { |
$description = $this->getClasseDescription(); |
$description->genererDescriptionTxt(); |
} |
|
private function verifierDescriptionTxt() { |
$description = $this->getClasseDescription(); |
$description->verifierDescriptionTxt(); |
} |
|
private function genererCorrespondanceDescription() { |
$description = $this->getClasseDescription(); |
$description->genererCorrespondance(); |
} |
|
private function getClasseDescription() { |
$description = $this->getClasse('Description'); |
return $description; |
} |
|
private function fusionnerIndex() { |
$description = $this->getClasseIndex(); |
$description->fusionnerIndex(); |
} |
|
private function getClasseIndex() { |
$index = $this->getClasse('Index'); |
return $index; |
} |
|
private function uploaderFichiersSp() { |
$wiki = $this->getClasseWiki(); |
$wiki->uploaderFichiersSp(); |
} |
|
private function dowloaderWiki() { |
$wiki = $this->getClasseWiki(); |
$wiki->dowloaderPagesWiki(); |
} |
|
private function getClasseWiki() { |
$wiki = $this->getClasse('Wiki'); |
return $wiki; |
199,7 → 103,8 |
|
private function getClasse($classeNom) { |
$conteneur = new Conteneur(); |
$conteneur->setParametre('-v', $this->getParametre('-v')); |
$conteneur->setParametre('-v', $this->getParametre('-v')); |
$conteneur->setParametre('scriptChemin', $this->getScriptChemin()); |
require_once dirname(__FILE__).'/'.$classeNom.'.php'; |
$objet = new $classeNom($conteneur); |
return $objet; |