Completed
Push — spip-3.0 ( ab100a...484b62 )
by cam
06:49
created
ecrire/base/repair.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 // http://doc.spip.org/@base_admin_repair_dist
16 18
 function base_repair_dist($titre='', $reprise='') {
@@ -44,11 +46,13 @@  discard block
 block discarded – undo
44 46
 			continue;
45 47
 		}
46 48
 		if (!isset($repertoire[$ext])){
47
-			if (@file_exists($plat = _DIR_IMG. $ext .".plat"))
48
-				spip_unlink($plat);
49
+			if (@file_exists($plat = _DIR_IMG. $ext .".plat")) {
50
+							spip_unlink($plat);
51
+			}
49 52
 			$repertoire[$ext] = creer_repertoire_documents($ext);
50
-			if (preg_match(',_$,',$repertoire[$ext]))
51
-				$repertoire[$ext] = false;
53
+			if (preg_match(',_$,',$repertoire[$ext])) {
54
+							$repertoire[$ext] = false;
55
+			}
52 56
 		}
53 57
 		if ($d=$repertoire[$ext]){
54 58
 			$d = substr($d,strlen(_DIR_IMG));
@@ -91,7 +95,9 @@  discard block
 block discarded – undo
91 95
 			effacer_meta('admin_repair');
92 96
 			if ($repair){
93 97
 				$result_repair = sql_repair($tab);
94
-				if (!$result_repair) return false;
98
+				if (!$result_repair) {
99
+				    return false;
100
+				}
95 101
 			}
96 102
 
97 103
 			// essayer de maj la table (creation de champs manquants)
@@ -99,21 +105,22 @@  discard block
 block discarded – undo
99 105
 
100 106
 			$count = sql_countsel($tab);
101 107
 	
102
-			if ($count>1)
103
-				$m .= "("._T('texte_compte_elements', array('count' => $count)).")\n";
104
-			else if ($count==1)
105
-				$m .= "("._T('texte_compte_element', array('count' => $count)).")\n";
106
-			else
107
-				$m .= "("._T('texte_vide').")\n";
108
+			if ($count>1) {
109
+							$m .= "("._T('texte_compte_elements', array('count' => $count)).")\n";
110
+			} else if ($count==1) {
111
+							$m .= "("._T('texte_compte_element', array('count' => $count)).")\n";
112
+			} else {
113
+							$m .= "("._T('texte_vide').")\n";
114
+			}
108 115
 	
109 116
 			if ($result_repair
110 117
 			  AND $msg = join(" ", sql_fetch($result_repair)) . ' '
111 118
 				AND strpos($msg, ' OK ')==FALSE){
112 119
 				$class = " class='notice'";
113 120
 				$m .= "<br /><tt>".spip_htmlentities($msg)."</tt>\n";
121
+			} else {
122
+							$m .= " "._T('texte_table_ok');
114 123
 			}
115
-			else
116
-				$m .= " "._T('texte_table_ok');
117 124
 
118 125
 			$res .="<div$class>$m</div>";
119 126
 	  }
Please login to merge, or discard this patch.
ecrire/base/delete_all.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 // http://doc.spip.org/@base_delete_all_dist
16 18
 function base_delete_all_dist($titre)
@@ -19,9 +21,11 @@  discard block
 block discarded – undo
19 21
 	$res = array();
20 22
 	if (is_array($delete)) {
21 23
 		foreach ($delete as $table) {
22
-			if (sql_drop_table($table))
23
-				$res[] = $table;
24
-			else spip_log( "SPIP n'a pas pu detruire $table.", _LOG_ERREUR);
24
+			if (sql_drop_table($table)) {
25
+							$res[] = $table;
26
+			} else {
27
+			    spip_log( "SPIP n'a pas pu detruire $table.", _LOG_ERREUR);
28
+			}
25 29
 		}
26 30
 
27 31
 	// un pipeline pour detruire les tables installees par les plugins
Please login to merge, or discard this patch.
ecrire/maj/v015.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 function maj_v015_dist($version_installee, $version_cible)
16 18
 {
Please login to merge, or discard this patch.
ecrire/maj/svn10000.php 1 patch
Braces   +47 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 /*--------------------------------------------------------------------- */
16 18
 /*	Gestion des MAJ par tableau indexe par le numero SVN du chgt	*/
@@ -287,8 +289,7 @@  discard block
 block discarded – undo
287 289
 		include_spip('base/auxiliaires');
288 290
 		include_spip('base/create');
289 291
 		creer_ou_upgrader_table($liens, $tables_auxiliaires[$liens], false);
290
-	}
291
-	else {
292
+	} else {
292 293
 		// Preparer
293 294
 		$l = preg_replace(',[^\w],','',$l); // securite
294 295
 		$primary = "id_$l";
@@ -298,16 +299,22 @@  discard block
 block discarded – undo
298 299
 		$pool = 400;
299 300
 
300 301
 		$trouver_table = charger_fonction('trouver_table','base');
301
-		if (!$desc = $trouver_table($ancienne_table))
302
-			return;
302
+		if (!$desc = $trouver_table($ancienne_table)) {
303
+					return;
304
+		}
303 305
 
304 306
 		// securite pour ne pas perdre de donnees
305
-		if (!$trouver_table($liens))
306
-			return;
307
+		if (!$trouver_table($liens)) {
308
+					return;
309
+		}
307 310
 
308 311
 		$champs = $desc['field'];
309
-		if (isset($champs['maj'])) unset($champs['maj']);
310
-		if (isset($champs[$primary])) unset($champs[$primary]);
312
+		if (isset($champs['maj'])) {
313
+		    unset($champs['maj']);
314
+		}
315
+		if (isset($champs[$primary])) {
316
+		    unset($champs[$primary]);
317
+		}
311 318
 
312 319
 		$champs = array_keys($champs);
313 320
 		// ne garder que les champs qui existent sur la table destination
@@ -328,20 +335,26 @@  discard block
 block discarded – undo
328 335
 				while ($t = sql_allfetsel($champs, $ancienne_table,"$primary=".intval($id),'',$id_pivot,"$n,$pool")) {
329 336
 					$n+=count($t);
330 337
 					// empiler en s'assurant a minima de l'unicite
331
-					while ($r = array_shift($t))
332
-						$insert[$r[$id_pivot].':'.$r['id_objet']] = $r;
338
+					while ($r = array_shift($t)) {
339
+											$insert[$r[$id_pivot].':'.$r['id_objet']] = $r;
340
+					}
333 341
 					if (count($insert)>=$sub_pool){
334 342
 						maj_liens_insertq_multi_check($liens,$insert,$tables_auxiliaires[$liens]);
335 343
 						$insert = array();
336 344
 					}
337 345
 					// si timeout, sortir, la relance nous ramenera dans cette fonction
338 346
 					// et on verifiera/repartira de la
339
-					if (time() >= _TIME_OUT) return;
347
+					if (time() >= _TIME_OUT) {
348
+					    return;
349
+					}
350
+				}
351
+				if (time() >= _TIME_OUT) {
352
+				    return;
340 353
 				}
341
-				if (time() >= _TIME_OUT) return;
342 354
 			}
343
-			if (count($insert))
344
-				maj_liens_insertq_multi_check($liens,$insert,$tables_auxiliaires[$liens]);
355
+			if (count($insert)) {
356
+							maj_liens_insertq_multi_check($liens,$insert,$tables_auxiliaires[$liens]);
357
+			}
345 358
 			sql_delete ($ancienne_table, sql_in($primary,$ids));
346 359
 		}
347 360
 	}
@@ -350,13 +363,15 @@  discard block
 block discarded – undo
350 363
 	$n_before = sql_countsel($table);
351 364
 	sql_insertq_multi($table,$couples,$desc);
352 365
 	$n_after = sql_countsel($table);
353
-	if (($n_after-$n_before)==count($couples))
354
-		return;
366
+	if (($n_after-$n_before)==count($couples)) {
367
+			return;
368
+	}
355 369
 	// si ecart, on recommence l'insertion ligne par ligne...
356 370
 	// moins rapide mais secure : seul le couple en doublon echouera, et non toute la serie
357
-	foreach($couples as $c)
358
-		sql_insertq($table,$c,$desc);
359
-}
371
+	foreach($couples as $c) {
372
+			sql_insertq($table,$c,$desc);
373
+	}
374
+	}
360 375
 
361 376
 $GLOBALS['maj'][17311] = array(
362 377
 	array('ecrire_meta',"multi_objets",implode(',',
@@ -421,8 +436,9 @@  discard block
 block discarded – undo
421 436
 	$tables = base_lister_toutes_tables();
422 437
 
423 438
 	// rien a faire si base non sqlite
424
-	if (strncmp($GLOBALS['connexions'][0]['type'],'sqlite',6)!==0)
425
-		return;
439
+	if (strncmp($GLOBALS['connexions'][0]['type'],'sqlite',6)!==0) {
440
+			return;
441
+	}
426 442
 
427 443
 	$trouver_table = charger_fonction('trouver_table','base');
428 444
 	// forcer le vidage de cache
@@ -440,7 +456,9 @@  discard block
 block discarded – undo
440 456
 	}
441 457
 
442 458
 	foreach ($tables as $table){
443
-		if (time() >= _TIME_OUT) return;
459
+		if (time() >= _TIME_OUT) {
460
+		    return;
461
+		}
444 462
 		if ($desc = $trouver_table($table)){
445 463
 			$desc_collate = _sqlite_remplacements_definitions_table($desc['field']);
446 464
 			if ($d=array_diff($desc['field'],$desc_collate)){
@@ -454,9 +472,9 @@  discard block
 block discarded – undo
454 472
 					$urls = array();
455 473
 					foreach ($data as $d){
456 474
 						$key = $d['id_parent']."::".strtolower($d['url']);
457
-						if (!isset($urls[$key]))
458
-							$urls[$key] = true;
459
-						else {
475
+						if (!isset($urls[$key])) {
476
+													$urls[$key] = true;
477
+						} else {
460 478
 							spip_log("Suppression doublon dans spip_urls avant conversion : ".serialize($d),"maj."._LOG_INFO_IMPORTANTE);
461 479
 							sql_delete("spip_urls","id_parent=".sql_quote($d['id_parent'])." AND url=".sql_quote($d['url']));
462 480
 						}
@@ -498,7 +516,9 @@  discard block
 block discarded – undo
498 516
 	$dir = opendir(_DIR_SESSIONS);
499 517
 	while(($f = readdir($dir)) !== false) {
500 518
 		spip_unlink(_DIR_SESSIONS . $f);
501
-		if (time() >= _TIME_OUT) return;
519
+		if (time() >= _TIME_OUT) {
520
+		    return;
521
+		}
502 522
 	}
503 523
 }
504 524
 
Please login to merge, or discard this patch.
ecrire/maj/v013.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 
16 18
 function maj_v013_dist($version_installee, $version_cible)
Please login to merge, or discard this patch.
ecrire/maj/v017.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 function maj_v017_dist($version_installee, $version_cible)
16 18
 {
Please login to merge, or discard this patch.
ecrire/maj/v016.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 function maj_v016_dist($version_installee, $version_cible)
16 18
 {
Please login to merge, or discard this patch.
ecrire/maj/v011.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 
16 18
 function maj_v011_dist($version_installee, $version_cible)
Please login to merge, or discard this patch.
ecrire/maj/v012.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 function maj_v012_dist($version_installee, $version_cible)
16 18
 {
Please login to merge, or discard this patch.