@@ -33,17 +33,17 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | function ranger_cache_gd2() { |
| 35 | 35 | spip_log("ranger_cache_gd2"); |
| 36 | - $base = _DIR_VAR . "cache-gd2/"; |
|
| 36 | + $base = _DIR_VAR."cache-gd2/"; |
|
| 37 | 37 | if (is_dir($base) and is_readable($base)) { |
| 38 | 38 | if ($dir = opendir($base)) { |
| 39 | 39 | while (($f = readdir($dir)) !== false) { |
| 40 | - if (!is_dir($base . $f) and strncmp($f, ".", 1) !== 0 |
|
| 40 | + if (!is_dir($base.$f) and strncmp($f, ".", 1) !== 0 |
|
| 41 | 41 | and preg_match(",[0-9a-f]{32}\.\w+,", $f) |
| 42 | 42 | ) { |
| 43 | 43 | $sub = substr($f, 0, 2); |
| 44 | 44 | $sub = sous_repertoire($base, $sub); |
| 45 | - @rename($base . $f, $sub . substr($f, 2)); |
|
| 46 | - @unlink($base . $f); // au cas ou le rename a foire (collision) |
|
| 45 | + @rename($base.$f, $sub.substr($f, 2)); |
|
| 46 | + @unlink($base.$f); // au cas ou le rename a foire (collision) |
|
| 47 | 47 | } |
| 48 | 48 | if (time() >= _TIME_OUT) { |
| 49 | 49 | return; |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | $exceptions_pluriel = array('forum' => 'forum', 'syndic' => 'syndic'); |
| 61 | 61 | |
| 62 | 62 | $pivot = preg_replace(',[^\w],', '', $pivot); // securite |
| 63 | - $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot . "s"); |
|
| 64 | - $liens = "spip_" . $pivots . "_liens"; |
|
| 65 | - $id_pivot = "id_" . $pivot; |
|
| 63 | + $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot."s"); |
|
| 64 | + $liens = "spip_".$pivots."_liens"; |
|
| 65 | + $id_pivot = "id_".$pivot; |
|
| 66 | 66 | // Creer spip_auteurs_liens |
| 67 | 67 | global $tables_auxiliaires; |
| 68 | 68 | if (!$l) { |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | $l = preg_replace(',[^\w],', '', $l); // securite |
| 75 | 75 | $primary = "id_$l"; |
| 76 | 76 | $objet = ($l == 'syndic' ? 'site' : $l); |
| 77 | - $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l . "s"); |
|
| 78 | - $ancienne_table = 'spip_' . $pivots . '_' . $ls; |
|
| 77 | + $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l."s"); |
|
| 78 | + $ancienne_table = 'spip_'.$pivots.'_'.$ls; |
|
| 79 | 79 | $pool = 400; |
| 80 | 80 | |
| 81 | 81 | $trouver_table = charger_fonction('trouver_table', 'base'); |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) { |
| 112 | 112 | $insert = array(); |
| 113 | 113 | foreach ($ids as $id) { |
| 114 | - $n = sql_countsel($liens, "objet='$objet' AND id_objet=" . intval($id)); |
|
| 115 | - while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 114 | + $n = sql_countsel($liens, "objet='$objet' AND id_objet=".intval($id)); |
|
| 115 | + while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=".intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 116 | 116 | $n += count($t); |
| 117 | 117 | // empiler en s'assurant a minima de l'unicite |
| 118 | 118 | while ($r = array_shift($t)) { |
| 119 | - $insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r; |
|
| 119 | + $insert[$r[$id_pivot].':'.$r['id_objet']] = $r; |
|
| 120 | 120 | } |
| 121 | 121 | if (count($insert) >= $sub_pool) { |
| 122 | 122 | maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]); |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | // cas particulier spip_auteurs : retablir le collate binary sur le login |
| 265 | 265 | $desc = $trouver_table("spip_auteurs"); |
| 266 | - spip_log("spip_auteurs : " . var_export($desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 266 | + spip_log("spip_auteurs : ".var_export($desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 267 | 267 | if (stripos($desc['field']['login'], "BINARY") === false) { |
| 268 | 268 | spip_log("Retablir champ login BINARY sur table spip_auteurs", "maj"); |
| 269 | 269 | sql_alter("table spip_auteurs change login login VARCHAR(255) BINARY"); |
| 270 | 270 | $trouver_table(''); |
| 271 | 271 | $new_desc = $trouver_table("spip_auteurs"); |
| 272 | - spip_log("Apres conversion spip_auteurs : " . var_export($new_desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 272 | + spip_log("Apres conversion spip_auteurs : ".var_export($new_desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | foreach ($tables as $table) { |
@@ -288,24 +288,24 @@ discard block |
||
| 288 | 288 | $data = sql_allfetsel("*", "spip_urls", '', '', 'date DESC'); |
| 289 | 289 | $urls = array(); |
| 290 | 290 | foreach ($data as $d) { |
| 291 | - $key = $d['id_parent'] . "::" . strtolower($d['url']); |
|
| 291 | + $key = $d['id_parent']."::".strtolower($d['url']); |
|
| 292 | 292 | if (!isset($urls[$key])) { |
| 293 | 293 | $urls[$key] = true; |
| 294 | 294 | } else { |
| 295 | - spip_log("Suppression doublon dans spip_urls avant conversion : " . serialize($d), |
|
| 296 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 297 | - sql_delete("spip_urls", "id_parent=" . sql_quote($d['id_parent']) . " AND url=" . sql_quote($d['url'])); |
|
| 295 | + spip_log("Suppression doublon dans spip_urls avant conversion : ".serialize($d), |
|
| 296 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 297 | + sql_delete("spip_urls", "id_parent=".sql_quote($d['id_parent'])." AND url=".sql_quote($d['url'])); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | foreach ($desc['field'] as $field => $type) { |
| 302 | 302 | if ($desc['field'][$field] !== $desc_collate[$field]) { |
| 303 | - spip_log("Conversion COLLATE table $table", "maj." . _LOG_INFO_IMPORTANTE); |
|
| 304 | - sql_alter("table $table change $field $field " . $desc_collate[$field]); |
|
| 303 | + spip_log("Conversion COLLATE table $table", "maj."._LOG_INFO_IMPORTANTE); |
|
| 304 | + sql_alter("table $table change $field $field ".$desc_collate[$field]); |
|
| 305 | 305 | $trouver_table(''); |
| 306 | 306 | $new_desc = $trouver_table($table); |
| 307 | - spip_log("Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 308 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 307 | + spip_log("Apres conversion $table : ".var_export($new_desc['field'], true), |
|
| 308 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 309 | 309 | continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $GLOBALS['maj'][19236] = array( |
| 323 | 323 | array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom='version_installee'"), // version base principale |
| 324 | - array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 324 | + array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 325 | 325 | array('maj_collation_sqlite'), |
| 326 | 326 | ); |
| 327 | 327 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | spip_log("supprimer sessions auteur"); |
| 339 | 339 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 340 | 340 | while (($f = readdir($dir)) !== false) { |
| 341 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 341 | + spip_unlink(_DIR_SESSIONS.$f); |
|
| 342 | 342 | if (time() >= _TIME_OUT) { |
| 343 | 343 | return; |
| 344 | 344 | } |
@@ -64,12 +64,12 @@ |
||
| 64 | 64 | spip_log("Table $table TIMESTAMP incorrect", "maj"); |
| 65 | 65 | foreach ($desc['field'] as $field => $type) { |
| 66 | 66 | if ($desc['field'][$field] !== $fields_corrected[$field]) { |
| 67 | - spip_log("Adaptation TIMESTAMP table $table", "maj." . _LOG_INFO_IMPORTANTE); |
|
| 68 | - sql_alter("table $table change $field $field " . $fields_corrected[$field]); |
|
| 67 | + spip_log("Adaptation TIMESTAMP table $table", "maj."._LOG_INFO_IMPORTANTE); |
|
| 68 | + sql_alter("table $table change $field $field ".$fields_corrected[$field]); |
|
| 69 | 69 | $trouver_table(''); |
| 70 | 70 | $new_desc = $trouver_table($table); |
| 71 | - spip_log("Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 72 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 71 | + spip_log("Apres conversion $table : ".var_export($new_desc['field'], true), |
|
| 72 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) { |
| 57 | 57 | if (!is_numeric(_request('reinstall'))) { |
| 58 | 58 | include_spip('base/create'); |
| 59 | - spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 59 | + spip_log('recree les tables eventuellement disparues', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 60 | 60 | creer_base(); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | exit; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 72 | + spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 73 | 73 | |
| 74 | 74 | // supprimer quelques fichiers temporaires qui peuvent se retrouver invalides |
| 75 | 75 | @spip_unlink(_CACHE_RUBRIQUES); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | @spip_unlink(_CACHE_PLUGINS_OPT); |
| 79 | 79 | @spip_unlink(_CACHE_PLUGINS_FCT); |
| 80 | 80 | @spip_unlink(_CACHE_CHEMIN); |
| 81 | - @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz'); |
|
| 81 | + @spip_unlink(_DIR_TMP.'plugin_xml_cache.gz'); |
|
| 82 | 82 | |
| 83 | 83 | include_spip('inc/auth'); |
| 84 | 84 | auth_synchroniser_distant(); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | $version_installee = $GLOBALS['meta']['version_installee'] ?? null; |
| 118 | 118 | |
| 119 | 119 | spip_log( |
| 120 | - "Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'], |
|
| 121 | - 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 120 | + "Version anterieure: $version_installee. Courante: ".$GLOBALS['spip_version_base'], |
|
| 121 | + 'maj.'._LOG_INFO_IMPORTANTE |
|
| 122 | 122 | ); |
| 123 | 123 | if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
| 124 | 124 | sql_replace( |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page); |
| 152 | 152 | if ($res) { |
| 153 | 153 | if (!is_array($res)) { |
| 154 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_INFO_ERREUR); |
|
| 154 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_INFO_ERREUR); |
|
| 155 | 155 | } else { |
| 156 | - echo _T('avis_operation_echec') . ' ' . join(' ', $res); |
|
| 156 | + echo _T('avis_operation_echec').' '.join(' ', $res); |
|
| 157 | 157 | echo install_fin_html(); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | $res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect); |
| 241 | 241 | if ($res) { |
| 242 | 242 | if (!is_array($res)) { |
| 243 | - spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_INFO_ERREUR); |
|
| 243 | + spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_INFO_ERREUR); |
|
| 244 | 244 | } else { |
| 245 | - echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>'; |
|
| 245 | + echo '<p>'._T('avis_operation_echec').' '.join(' ', $res).'</p>'; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | $timeout = _UPGRADE_TIME_OUT * 2; |
| 295 | 295 | $titre = _T('titre_page_upgrade'); |
| 296 | 296 | $balise_img = charger_filtre('balise_img'); |
| 297 | - $titre .= $balise_img(chemin_image('loader.svg'),'','loader'); |
|
| 297 | + $titre .= $balise_img(chemin_image('loader.svg'), '', 'loader'); |
|
| 298 | 298 | echo(install_debut_html($titre)); |
| 299 | 299 | // script de rechargement auto sur timeout |
| 300 | 300 | $redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true); |
| 301 | - echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')'); |
|
| 301 | + echo http_script("window.setTimeout('location.href=\"".$redirect."\";',".($timeout * 1000).')'); |
|
| 302 | 302 | echo "<div style='text-align: left'>\n"; |
| 303 | 303 | if (ob_get_level()) { |
| 304 | 304 | ob_flush(); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | return array($v, $etape); |
| 387 | 387 | } |
| 388 | 388 | $n = time() - $time; |
| 389 | - spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 389 | + spip_log("$table $meta: $v en $n secondes", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 390 | 390 | if ($meta) { |
| 391 | 391 | ecrire_meta($meta, $installee = $v, 'oui', $table); |
| 392 | 392 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | if ($meta) { |
| 403 | 403 | ecrire_meta($meta, $cible, 'oui', $table); |
| 404 | 404 | } |
| 405 | - spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 405 | + spip_log("MAJ terminee. $meta: $installee", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 406 | 406 | |
| 407 | 407 | return array(); |
| 408 | 408 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * @return int |
| 428 | 428 | */ |
| 429 | 429 | function serie_alter($serie, $q = array(), $meta = '', $table = 'meta', $redirect = '') { |
| 430 | - $meta2 = $meta . '_maj_' . $serie; |
|
| 430 | + $meta2 = $meta.'_maj_'.$serie; |
|
| 431 | 431 | $etape = 0; |
| 432 | 432 | if (isset($GLOBALS[$table][$meta2])) { |
| 433 | 433 | $etape = intval($GLOBALS[$table][$meta2]); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | and function_exists($f = array_shift($r)) |
| 440 | 440 | ) { |
| 441 | 441 | // note: $r (arguments de la fonction $f) peut avoir des données tabulaires |
| 442 | - spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 442 | + spip_log("$msg: $f ".@join(',', $r), 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 443 | 443 | // pour les fonctions atomiques sql_xx |
| 444 | 444 | // on enregistre le meta avant de lancer la fonction, |
| 445 | 445 | // de maniere a eviter de boucler sur timeout |
@@ -457,12 +457,12 @@ discard block |
||
| 457 | 457 | relance_maj($meta, $table, $redirect); |
| 458 | 458 | } |
| 459 | 459 | ecrire_meta($meta2, $i + 1, 'non', $table); |
| 460 | - spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE); |
|
| 460 | + spip_log("$meta2: ok", 'maj.'._LOG_INFO_IMPORTANTE); |
|
| 461 | 461 | } else { |
| 462 | 462 | if (!is_array($r)) { |
| 463 | - spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR); |
|
| 463 | + spip_log("maj $i format incorrect", 'maj.'._LOG_ERREUR); |
|
| 464 | 464 | } else { |
| 465 | - spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR); |
|
| 465 | + spip_log("maj $i fonction $f non definie", 'maj.'._LOG_ERREUR); |
|
| 466 | 466 | } |
| 467 | 467 | // en cas d'erreur serieuse, on s'arrete |
| 468 | 468 | // mais on permet de passer par dessus en rechargeant la page. |