Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 794 | Rev 814 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 794 Rev 811
Line 131... Line 131...
131
	  * sachant que ucfirst(c).php et la classe ucfirst(c) apparaîssent à de multiples emplacements (selon a)
131
	  * sachant que ucfirst(c).php et la classe ucfirst(c) apparaîssent à de multiples emplacements (selon a)
Line 132... Line 132...
132
 
132
 
Line 133... Line 133...
133
	  1") Beurk... (php-className conflicts en PHP 5.2)
133
	  1") Beurk... (php-className conflicts en PHP 5.2)
134
 
134
 
135
	  Ici nous faisons des cas particuliers pour Ontologies, mais en suivant ce principe, sont affectés:
135
	  Ici nous faisons des cas particuliers pour Ontologies, mais en suivant ce principe, sont affectés:
136
	  Cartes, EfloreOntologiesTest, Images, Informations, InformationsTaxonsSup,
136
	  Images, Informations, InformationsTaxonsSup,
Line 137... Line 137...
137
	  LegendeCartes, NomCommune, Noms, NomsVernaculaires, Projets, Statuts,
137
	  LegendeCartes, NomCommune, Noms, NomsVernaculaires, Projets, Statuts,
138
	  Taxons, TaxonsCartes, Textes, ZoneGeo
138
	  Taxons, TaxonsCartes, Textes, ZoneGeo
Line 145... Line 145...
145
	  http://stackoverflow.com/questions/4555186/using-two-class-with-the-same-name
145
	  http://stackoverflow.com/questions/4555186/using-two-class-with-the-same-name
146
	  > Stop.
146
	  > Stop.
147
	  > Whatever you are doing is wrong. Backup. Re-evaluate what you are doing and why.
147
	  > Whatever you are doing is wrong. Backup. Re-evaluate what you are doing and why.
148
	*/
148
	*/
149
	private static function debusquerClasse($p, $s) {
149
	private static function debusquerClasse($p, $s) {
150
		if($s != 'ontologies') return NULL;
150
		if($s == 'ontologies') {
151
 
-
 
152
		switch($p) {
151
			switch($p) {
153
		case 'baseflor':
152
			case 'baseflor':
154
			return 'BaseFloreOntologies';
153
				return 'BaseFloreOntologies';
155
		case 'eflore':
154
			case 'eflore':
156
			return 'EfloreOntologies';
155
				return 'EfloreOntologies';
Line 161... Line 160...
161
		case 'moissonnage':
160
			case 'moissonnage':
162
			return 'MoissonnnageOntologies';
161
				return 'MoissonnnageOntologies';
163
		case 'commun':
162
			case 'commun':
164
			return 'Ontologies';
163
				return 'Ontologies';
165
		}
164
			}
-
 
165
		}
-
 
166
 
-
 
167
		if($s == 'cartes') {
-
 
168
			switch($p) {
-
 
169
			case 'bdtxa':
-
 
170
				return 'BdtxaCartes';
-
 
171
			case 'eflore':
-
 
172
				return 'EfloreCartes';
-
 
173
			case 'chorodep':
-
 
174
				return 'ChorodepCartes';
-
 
175
			case 'moissonnage':
-
 
176
				return 'MoissonnnageCartes';
-
 
177
			}
-
 
178
		}
-
 
179
 
166
		return NULL;
180
		return NULL;
167
	}
181
	}
Line 168... Line 182...
168
 
182
 
169
	private function chargerClasseProjet($classe) {
183
	private function chargerClasseProjet($classe) {
Line 198... Line 212...
198
				require_once($this->cheminCourrant . $this->projetNom . DS . $this->obtenirNomClasseService($this->serviceNom) . '.php');
212
				require_once($this->cheminCourrant . $this->projetNom . DS . $this->obtenirNomClasseService($this->serviceNom) . '.php');
199
				return;
213
				return;
200
			}
214
			}
201
		}
215
		}
Line -... Line 216...
-
 
216
 
-
 
217
		// problème de class-name conflict. Exemple:
-
 
218
		// phpunit --verbose --debug --filter 'ChorodepCartesTest::testCarteGenerique|EfloreCartesTest::testCarteGenerale'
-
 
219
		if($this->serviceNom == 'cartes') {
-
 
220
			$c = NULL;
-
 
221
			switch($this->projetNom) {
-
 
222
			case 'bdtxa':
-
 
223
				$c = 'BdtxaCartes';
-
 
224
				break;
-
 
225
			case 'eflore':
-
 
226
				$c = 'EfloreCartes';
-
 
227
				break;
-
 
228
			case 'chorodep':
-
 
229
				$c = 'ChorodepCartes';
-
 
230
				break;
-
 
231
			case 'moissonnage':
-
 
232
				$c = 'MoissonnnageCartes';
-
 
233
				break;
-
 
234
			}
-
 
235
			if($c) {
-
 
236
				require_once($this->cheminCourrant . 'commun' . DS . 'Commun.php');
-
 
237
				require_once($this->cheminCourrant . $this->projetNom . DS . $this->obtenirNomClasseService($this->serviceNom) . '.php');
-
 
238
				return;
-
 
239
			}
-
 
240
		}
202
 
241
 
203
		$cheminBiblio = Config::get('chemin_bibliotheque');
242
		$cheminBiblio = Config::get('chemin_bibliotheque');
204
		$chemins = array();
243
		$chemins = array();
205
		$chemins[] = $this->cheminCourrant.$this->projetNom.DS;
244
		$chemins[] = $this->cheminCourrant.$this->projetNom.DS;
206
		$chemins[] = $this->cheminCourrant.'commun'.DS;
245
		$chemins[] = $this->cheminCourrant.'commun'.DS;
Line 251... Line 290...
251
 
290
 
252
		$service = null;
291
		$service = null;
253
		foreach ($chemins as $chemin) {
292
		foreach ($chemins as $chemin) {
254
			if (file_exists($chemin)) {
293
			if (file_exists($chemin)) {
-
 
294
				$service = new $classe($this->getBdd());
-
 
295
				// Affichage utile lors de PHPUnit pour détecter les conflits d'autoload de classes de même nom
-
 
296
				// $reflector = new ReflectionClass($classe);
255
				$service = new $classe($this->getBdd());
297
				// printf("===> Projets init classe '%s' depuis '%s', mais provenant de '%s'\n", $classe, $chemin, $reflector->getFileName());
256
				$ressourcesPourService = $this->filtrerRessourcesPourService();
298
				$ressourcesPourService = $this->filtrerRessourcesPourService();
257
				$this->cache = new CacheEflore($service, $this->projetNom, $this->serviceNom, Config::get('cache'));
299
				$this->cache = new CacheEflore($service, $this->projetNom, $this->serviceNom, Config::get('cache'));
258
				return $this->cache->consulter($ressourcesPourService, $this->parametres);
300
				return $this->cache->consulter($ressourcesPourService, $this->parametres);
259
			}
301
			}