@@ -11,74 +11,74 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Correction typographique francaise |
| 18 | 18 | |
| 19 | 19 | function typographie_fr_dist($letexte) { |
| 20 | 20 | |
| 21 | - static $trans; |
|
| 21 | + static $trans; |
|
| 22 | 22 | |
| 23 | - // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | - // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | - if (!$trans) { |
|
| 26 | - $trans = [ |
|
| 27 | - "'" => '’', |
|
| 28 | - ' ' => '~', |
|
| 29 | - '»' => '»', |
|
| 30 | - '«' => '«', |
|
| 31 | - '”' => '”', |
|
| 32 | - '“' => '“', |
|
| 33 | - '°' => '°' |
|
| 34 | - ]; |
|
| 35 | - $chars = [160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°']; |
|
| 36 | - $chars_trans = array_keys($chars); |
|
| 37 | - $chars = array_values($chars); |
|
| 38 | - $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | - $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | - $chars_trans = explode(' ', $chars_trans); |
|
| 41 | - foreach ($chars as $k => $r) { |
|
| 42 | - $trans[$chars_trans[$k]] = $r; |
|
| 43 | - } |
|
| 44 | - } |
|
| 23 | + // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | + // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | + if (!$trans) { |
|
| 26 | + $trans = [ |
|
| 27 | + "'" => '’', |
|
| 28 | + ' ' => '~', |
|
| 29 | + '»' => '»', |
|
| 30 | + '«' => '«', |
|
| 31 | + '”' => '”', |
|
| 32 | + '“' => '“', |
|
| 33 | + '°' => '°' |
|
| 34 | + ]; |
|
| 35 | + $chars = [160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°']; |
|
| 36 | + $chars_trans = array_keys($chars); |
|
| 37 | + $chars = array_values($chars); |
|
| 38 | + $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | + $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | + $chars_trans = explode(' ', $chars_trans); |
|
| 41 | + foreach ($chars as $k => $r) { |
|
| 42 | + $trans[$chars_trans[$k]] = $r; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $letexte = strtr($letexte, $trans); |
|
| 46 | + $letexte = strtr($letexte, $trans); |
|
| 47 | 47 | |
| 48 | - $cherche1 = [ |
|
| 49 | - /* 1 */ |
|
| 50 | - '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | - /* 2 */ |
|
| 52 | - '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | - /* 3 */ |
|
| 54 | - '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | - /* 4 */ |
|
| 56 | - '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | - ]; |
|
| 58 | - $remplace1 = [ |
|
| 59 | - /* 1 */ |
|
| 60 | - '\1~;', |
|
| 61 | - /* 2 */ |
|
| 62 | - '~\0', |
|
| 63 | - /* 3 */ |
|
| 64 | - '\1~\2', |
|
| 65 | - /* 4 */ |
|
| 66 | - '\0~' |
|
| 67 | - ]; |
|
| 68 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | - $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 48 | + $cherche1 = [ |
|
| 49 | + /* 1 */ |
|
| 50 | + '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | + /* 2 */ |
|
| 52 | + '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | + /* 3 */ |
|
| 54 | + '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | + /* 4 */ |
|
| 56 | + '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | + ]; |
|
| 58 | + $remplace1 = [ |
|
| 59 | + /* 1 */ |
|
| 60 | + '\1~;', |
|
| 61 | + /* 2 */ |
|
| 62 | + '~\0', |
|
| 63 | + /* 3 */ |
|
| 64 | + '\1~\2', |
|
| 65 | + /* 4 */ |
|
| 66 | + '\0~' |
|
| 67 | + ]; |
|
| 68 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | + $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 70 | 70 | |
| 71 | - $cherche2 = [ |
|
| 72 | - '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | - '/~/' |
|
| 75 | - ]; |
|
| 76 | - $remplace2 = [ |
|
| 77 | - '\1—\2', |
|
| 78 | - '\1\3\4', |
|
| 79 | - ' ' |
|
| 80 | - ]; |
|
| 81 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 71 | + $cherche2 = [ |
|
| 72 | + '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | + ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | + '/~/' |
|
| 75 | + ]; |
|
| 76 | + $remplace2 = [ |
|
| 77 | + '\1—\2', |
|
| 78 | + '\1\3\4', |
|
| 79 | + ' ' |
|
| 80 | + ]; |
|
| 81 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 82 | 82 | |
| 83 | - return $letexte; |
|
| 83 | + return $letexte; |
|
| 84 | 84 | } |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // rien sauf les "~" et "-," |
| 18 | 18 | |
| 19 | 19 | function typographie_en_dist($letexte) { |
| 20 | 20 | |
| 21 | - // zouli apostrophe |
|
| 22 | - $letexte = str_replace("'", '’', $letexte); |
|
| 21 | + // zouli apostrophe |
|
| 22 | + $letexte = str_replace("'", '’', $letexte); |
|
| 23 | 23 | |
| 24 | - $cherche1 = [ |
|
| 25 | - '/ --?,/S' |
|
| 26 | - ]; |
|
| 27 | - $remplace1 = [ |
|
| 28 | - '~\0' |
|
| 29 | - ]; |
|
| 30 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 24 | + $cherche1 = [ |
|
| 25 | + '/ --?,/S' |
|
| 26 | + ]; |
|
| 27 | + $remplace1 = [ |
|
| 28 | + '~\0' |
|
| 29 | + ]; |
|
| 30 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 31 | 31 | |
| 32 | - $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | - $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 32 | + $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | + $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 34 | 34 | |
| 35 | - $cherche2 = [ |
|
| 36 | - '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | - '/~/' |
|
| 38 | - ]; |
|
| 39 | - $remplace2 = [ |
|
| 40 | - '\1—\2', |
|
| 41 | - ' ' |
|
| 42 | - ]; |
|
| 35 | + $cherche2 = [ |
|
| 36 | + '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | + '/~/' |
|
| 38 | + ]; |
|
| 39 | + $remplace2 = [ |
|
| 40 | + '\1—\2', |
|
| 41 | + ' ' |
|
| 42 | + ]; |
|
| 43 | 43 | |
| 44 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 44 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 45 | 45 | |
| 46 | - return $letexte; |
|
| 46 | + return $letexte; |
|
| 47 | 47 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -34,33 +34,33 @@ discard block |
||
| 34 | 34 | * Contenu HTML, avec boutons d'administrations et sa CSS |
| 35 | 35 | **/ |
| 36 | 36 | function affiche_boutons_admin($contenu) { |
| 37 | - include_spip('inc/filtres'); |
|
| 37 | + include_spip('inc/filtres'); |
|
| 38 | 38 | |
| 39 | - // Inserer le css d'admin |
|
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | - . "' type='text/css' />\n"; |
|
| 42 | - if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | - $css .= "<link rel='stylesheet' href='" |
|
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | - } |
|
| 39 | + // Inserer le css d'admin |
|
| 40 | + $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | + . "' type='text/css' />\n"; |
|
| 42 | + if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | + $css .= "<link rel='stylesheet' href='" |
|
| 44 | + . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - ($pos = stripos($contenu, '</head>')) |
|
| 48 | - || ($pos = stripos($contenu, '<body>')) |
|
| 49 | - || ($pos = 0); |
|
| 50 | - $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 47 | + ($pos = stripos($contenu, '</head>')) |
|
| 48 | + || ($pos = stripos($contenu, '<body>')) |
|
| 49 | + || ($pos = 0); |
|
| 50 | + $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | - $boutons_admin = inclure_balise_dynamique( |
|
| 55 | - balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | - false |
|
| 57 | - ); |
|
| 53 | + // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | + $boutons_admin = inclure_balise_dynamique( |
|
| 55 | + balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | + false |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - ($pos = strripos($contenu, '</body>')) |
|
| 60 | - || ($pos = strripos($contenu, '</html>')) |
|
| 61 | - || ($pos = strlen($contenu)); |
|
| 62 | - $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 59 | + ($pos = strripos($contenu, '</body>')) |
|
| 60 | + || ($pos = strripos($contenu, '</html>')) |
|
| 61 | + || ($pos = strlen($contenu)); |
|
| 62 | + $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - return $contenu; |
|
| 65 | + return $contenu; |
|
| 66 | 66 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * Code PHP compilé de la boucle |
| 33 | 33 | **/ |
| 34 | 34 | function boucle_DEFAUT_dist($id_boucle, &$boucles) { |
| 35 | - return calculer_boucle($id_boucle, $boucles); |
|
| 35 | + return calculer_boucle($id_boucle, $boucles); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * Code PHP compilé de la boucle |
| 52 | 52 | **/ |
| 53 | 53 | function boucle_BOUCLE_dist($id_boucle, &$boucles) { |
| 54 | - return calculer_boucle($id_boucle, $boucles); |
|
| 54 | + return calculer_boucle($id_boucle, $boucles); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -81,30 +81,30 @@ discard block |
||
| 81 | 81 | * Code PHP compilé de la boucle |
| 82 | 82 | **/ |
| 83 | 83 | function boucle_HIERARCHIE_dist($id_boucle, &$boucles) { |
| 84 | - $boucle = &$boucles[$id_boucle]; |
|
| 85 | - $id_table = $boucle->id_table . '.id_rubrique'; |
|
| 84 | + $boucle = &$boucles[$id_boucle]; |
|
| 85 | + $id_table = $boucle->id_table . '.id_rubrique'; |
|
| 86 | 86 | |
| 87 | - // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 88 | - // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 89 | - // ou {id_article} qui positionne aussi le {tout} |
|
| 87 | + // Si la boucle mere est une boucle RUBRIQUES il faut ignorer la feuille |
|
| 88 | + // sauf en presence du critere {tout} (vu par phraser_html) |
|
| 89 | + // ou {id_article} qui positionne aussi le {tout} |
|
| 90 | 90 | |
| 91 | - $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 92 | - . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 93 | - . ")))\n\t\treturn '';\n\t" |
|
| 94 | - . "include_spip('inc/rubriques');\n\t" |
|
| 95 | - . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 96 | - . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 97 | - . ");\n\t" |
|
| 98 | - . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 91 | + $boucle->hierarchie = 'if (!($id_rubrique = intval(' |
|
| 92 | + . calculer_argument_precedent($boucle->id_boucle, 'id_rubrique', $boucles) |
|
| 93 | + . ")))\n\t\treturn '';\n\t" |
|
| 94 | + . "include_spip('inc/rubriques');\n\t" |
|
| 95 | + . '$hierarchie = calcul_hierarchie_in($id_rubrique,' |
|
| 96 | + . (isset($boucle->modificateur['tout']) ? 'true' : 'false') |
|
| 97 | + . ");\n\t" |
|
| 98 | + . 'if (!$hierarchie) return "";' . "\n\t"; |
|
| 99 | 99 | |
| 100 | - $boucle->where[] = ["'IN'", "'$id_table'", '"($hierarchie)"']; |
|
| 100 | + $boucle->where[] = ["'IN'", "'$id_table'", '"($hierarchie)"']; |
|
| 101 | 101 | |
| 102 | - $order = "FIELD($id_table, \$hierarchie)"; |
|
| 103 | - if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != ' DESC') { |
|
| 104 | - $boucle->default_order[] = "\"$order\""; |
|
| 105 | - } else { |
|
| 106 | - $boucle->default_order[0] = "\"$order DESC\""; |
|
| 107 | - } |
|
| 102 | + $order = "FIELD($id_table, \$hierarchie)"; |
|
| 103 | + if (!isset($boucle->default_order[0]) or $boucle->default_order[0] != ' DESC') { |
|
| 104 | + $boucle->default_order[] = "\"$order\""; |
|
| 105 | + } else { |
|
| 106 | + $boucle->default_order[0] = "\"$order DESC\""; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - return calculer_boucle($id_boucle, $boucles); |
|
| 109 | + return calculer_boucle($id_boucle, $boucles); |
|
| 110 | 110 | } |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | * @package SPIP\Core\SQL\Upgrade |
| 19 | 19 | **/ |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][21676] = [ |
| 26 | - ['ranger_cache_gd2'], |
|
| 26 | + ['ranger_cache_gd2'], |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -32,30 +32,30 @@ discard block |
||
| 32 | 32 | * https://core.spip.net/issues/3277 |
| 33 | 33 | */ |
| 34 | 34 | function ranger_cache_gd2() { |
| 35 | - spip_log('ranger_cache_gd2'); |
|
| 36 | - $base = _DIR_VAR . 'cache-gd2/'; |
|
| 37 | - if (is_dir($base) and is_readable($base)) { |
|
| 38 | - if ($dir = opendir($base)) { |
|
| 39 | - while (($f = readdir($dir)) !== false) { |
|
| 40 | - if ( |
|
| 41 | - !is_dir($base . $f) and strncmp($f, '.', 1) !== 0 |
|
| 42 | - and preg_match(',[0-9a-f]{32}\.\w+,', $f) |
|
| 43 | - ) { |
|
| 44 | - $sub = substr($f, 0, 2); |
|
| 45 | - $sub = sous_repertoire($base, $sub); |
|
| 46 | - @rename($base . $f, $sub . substr($f, 2)); |
|
| 47 | - @unlink($base . $f); // au cas ou le rename a foire (collision) |
|
| 48 | - } |
|
| 49 | - if (time() >= _TIME_OUT) { |
|
| 50 | - return; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - } |
|
| 35 | + spip_log('ranger_cache_gd2'); |
|
| 36 | + $base = _DIR_VAR . 'cache-gd2/'; |
|
| 37 | + if (is_dir($base) and is_readable($base)) { |
|
| 38 | + if ($dir = opendir($base)) { |
|
| 39 | + while (($f = readdir($dir)) !== false) { |
|
| 40 | + if ( |
|
| 41 | + !is_dir($base . $f) and strncmp($f, '.', 1) !== 0 |
|
| 42 | + and preg_match(',[0-9a-f]{32}\.\w+,', $f) |
|
| 43 | + ) { |
|
| 44 | + $sub = substr($f, 0, 2); |
|
| 45 | + $sub = sous_repertoire($base, $sub); |
|
| 46 | + @rename($base . $f, $sub . substr($f, 2)); |
|
| 47 | + @unlink($base . $f); // au cas ou le rename a foire (collision) |
|
| 48 | + } |
|
| 49 | + if (time() >= _TIME_OUT) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | $GLOBALS['maj'][21742] = [ |
| 59 | - ['sql_alter', "TABLE spip_articles CHANGE url_site url_site text DEFAULT '' NOT NULL"], |
|
| 60 | - ['sql_alter', "TABLE spip_articles CHANGE virtuel virtuel text DEFAULT '' NOT NULL"], |
|
| 59 | + ['sql_alter', "TABLE spip_articles CHANGE url_site url_site text DEFAULT '' NOT NULL"], |
|
| 60 | + ['sql_alter', "TABLE spip_articles CHANGE virtuel virtuel text DEFAULT '' NOT NULL"], |
|
| 61 | 61 | ]; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @package SPIP\Core\SQL\Upgrade |
| 19 | 19 | **/ |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | include_spip('base/medias'); |
@@ -27,27 +27,27 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // http://archives.rezo.net/archives/spip-zone.mbox/C6RZKNBUNJYN42IOEOC4QKVCA233AMLI/ |
| 29 | 29 | $GLOBALS['maj'][13833] = [ |
| 30 | - ['sql_alter', 'TABLE spip_documents_liens ADD INDEX objet(id_objet,objet)'] |
|
| 30 | + ['sql_alter', 'TABLE spip_documents_liens ADD INDEX objet(id_objet,objet)'] |
|
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | // 2.1 |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['maj'][13904] = [ |
| 36 | - ['sql_alter', "TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"], |
|
| 37 | - [ |
|
| 38 | - 'sql_update', |
|
| 39 | - 'spip_auteurs', |
|
| 40 | - ['webmestre' => "'oui'"], |
|
| 41 | - sql_in('id_auteur', defined('_ID_WEBMESTRES') ? explode( |
|
| 42 | - ':', |
|
| 43 | - _ID_WEBMESTRES |
|
| 44 | - ) : (autoriser('configurer') ? [$GLOBALS['visiteur_session']['id_auteur']] : [0])) |
|
| 45 | - ] // le webmestre est celui qui fait l'upgrade si rien de defini |
|
| 36 | + ['sql_alter', "TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"], |
|
| 37 | + [ |
|
| 38 | + 'sql_update', |
|
| 39 | + 'spip_auteurs', |
|
| 40 | + ['webmestre' => "'oui'"], |
|
| 41 | + sql_in('id_auteur', defined('_ID_WEBMESTRES') ? explode( |
|
| 42 | + ':', |
|
| 43 | + _ID_WEBMESTRES |
|
| 44 | + ) : (autoriser('configurer') ? [$GLOBALS['visiteur_session']['id_auteur']] : [0])) |
|
| 45 | + ] // le webmestre est celui qui fait l'upgrade si rien de defini |
|
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | 48 | // sites plantes en mode "'su" au lieu de "sus" |
| 49 | 49 | $GLOBALS['maj'][13929] = [ |
| 50 | - ['sql_update', 'spip_syndic', ['syndication' => "'sus'"], "syndication LIKE '\\'%'"] |
|
| 50 | + ['sql_update', 'spip_syndic', ['syndication' => "'sus'"], "syndication LIKE '\\'%'"] |
|
| 51 | 51 | ]; |
| 52 | 52 | |
| 53 | 53 | // Types de fichiers m4a/m4b/m4p/m4u/m4v/dv |
@@ -61,24 +61,24 @@ discard block |
||
| 61 | 61 | // La version 14588 etait une mauvaise piste: |
| 62 | 62 | // Retour en arriere pour ceux qui l'ont subi, ne rien faire sinon |
| 63 | 63 | if (@$GLOBALS['meta']['version_installee'] >= 14588) { |
| 64 | - // "mode" est un mot-cle d'Oracle |
|
| 65 | - $GLOBALS['maj'][14588] = [ |
|
| 66 | - ['sql_alter', 'TABLE spip_documents DROP INDEX mode'], |
|
| 67 | - [ |
|
| 68 | - 'sql_alter', |
|
| 69 | - "TABLE spip_documents CHANGE mode genre ENUM('vignette', 'image', 'document') DEFAULT 'document' NOT NULL" |
|
| 70 | - ], |
|
| 71 | - ['sql_alter', 'TABLE spip_documents ADD INDEX genre(genre)'] |
|
| 72 | - ]; |
|
| 73 | - // solution moins intrusive au pb de mot-cle d'Oracle, retour avant 14588 |
|
| 74 | - $GLOBALS['maj'][14598] = [ |
|
| 75 | - ['sql_alter', 'TABLE spip_documents DROP INDEX genre'], |
|
| 76 | - [ |
|
| 77 | - 'sql_alter', |
|
| 78 | - "TABLE spip_documents CHANGE genre mode ENUM('vignette', 'image', 'document') DEFAULT 'document' NOT NULL" |
|
| 79 | - ], |
|
| 80 | - ['sql_alter', 'TABLE spip_documents ADD INDEX mode(mode)'] |
|
| 81 | - ]; |
|
| 64 | + // "mode" est un mot-cle d'Oracle |
|
| 65 | + $GLOBALS['maj'][14588] = [ |
|
| 66 | + ['sql_alter', 'TABLE spip_documents DROP INDEX mode'], |
|
| 67 | + [ |
|
| 68 | + 'sql_alter', |
|
| 69 | + "TABLE spip_documents CHANGE mode genre ENUM('vignette', 'image', 'document') DEFAULT 'document' NOT NULL" |
|
| 70 | + ], |
|
| 71 | + ['sql_alter', 'TABLE spip_documents ADD INDEX genre(genre)'] |
|
| 72 | + ]; |
|
| 73 | + // solution moins intrusive au pb de mot-cle d'Oracle, retour avant 14588 |
|
| 74 | + $GLOBALS['maj'][14598] = [ |
|
| 75 | + ['sql_alter', 'TABLE spip_documents DROP INDEX genre'], |
|
| 76 | + [ |
|
| 77 | + 'sql_alter', |
|
| 78 | + "TABLE spip_documents CHANGE genre mode ENUM('vignette', 'image', 'document') DEFAULT 'document' NOT NULL" |
|
| 79 | + ], |
|
| 80 | + ['sql_alter', 'TABLE spip_documents ADD INDEX mode(mode)'] |
|
| 81 | + ]; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Restauration correcte des types mime des fichiers Ogg |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | * @package SPIP\Core\SQL\Upgrade |
| 19 | 19 | **/ |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][23375] = [ |
| 26 | - ['sql_alter', 'TABLE spip_auteurs CHANGE prefs prefs text'], |
|
| 26 | + ['sql_alter', 'TABLE spip_auteurs CHANGE prefs prefs text'], |
|
| 27 | 27 | ]; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @package SPIP\Core\SQL\Upgrade |
| 21 | 21 | **/ |
| 22 | 22 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
@@ -35,49 +35,49 @@ discard block |
||
| 35 | 35 | **/ |
| 36 | 36 | function maj_timestamp_mysql($tables = null) { |
| 37 | 37 | |
| 38 | - include_spip('base/dump'); |
|
| 39 | - if (is_null($tables)) { |
|
| 40 | - $tables = base_lister_toutes_tables(); |
|
| 41 | - } elseif (is_string($tables)) { |
|
| 42 | - $tables = [$tables]; |
|
| 43 | - } elseif (!is_array($tables)) { |
|
| 44 | - return; |
|
| 45 | - } |
|
| 38 | + include_spip('base/dump'); |
|
| 39 | + if (is_null($tables)) { |
|
| 40 | + $tables = base_lister_toutes_tables(); |
|
| 41 | + } elseif (is_string($tables)) { |
|
| 42 | + $tables = [$tables]; |
|
| 43 | + } elseif (!is_array($tables)) { |
|
| 44 | + return; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - // rien a faire si base non mysql |
|
| 48 | - if (strncmp($GLOBALS['connexions'][0]['type'], 'mysql', 5) !== 0) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + // rien a faire si base non mysql |
|
| 48 | + if (strncmp($GLOBALS['connexions'][0]['type'], 'mysql', 5) !== 0) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 53 | - // forcer le vidage de cache |
|
| 54 | - $trouver_table(''); |
|
| 52 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 53 | + // forcer le vidage de cache |
|
| 54 | + $trouver_table(''); |
|
| 55 | 55 | |
| 56 | - foreach ($tables as $table) { |
|
| 57 | - if (time() >= _TIME_OUT) { |
|
| 58 | - return; |
|
| 59 | - } |
|
| 60 | - if ($desc = $trouver_table($table)) { |
|
| 61 | - $fields_corrected = _mysql_remplacements_definitions_table($desc['field']); |
|
| 62 | - $d = array_diff($desc['field'], $fields_corrected); |
|
| 63 | - if ($d) { |
|
| 64 | - spip_log("Table $table TIMESTAMP incorrect", 'maj'); |
|
| 65 | - foreach ($desc['field'] as $field => $type) { |
|
| 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]); |
|
| 69 | - $trouver_table(''); |
|
| 70 | - $new_desc = $trouver_table($table); |
|
| 71 | - spip_log( |
|
| 72 | - "Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 73 | - 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 74 | - ); |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 56 | + foreach ($tables as $table) { |
|
| 57 | + if (time() >= _TIME_OUT) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | + if ($desc = $trouver_table($table)) { |
|
| 61 | + $fields_corrected = _mysql_remplacements_definitions_table($desc['field']); |
|
| 62 | + $d = array_diff($desc['field'], $fields_corrected); |
|
| 63 | + if ($d) { |
|
| 64 | + spip_log("Table $table TIMESTAMP incorrect", 'maj'); |
|
| 65 | + foreach ($desc['field'] as $field => $type) { |
|
| 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]); |
|
| 69 | + $trouver_table(''); |
|
| 70 | + $new_desc = $trouver_table($table); |
|
| 71 | + spip_log( |
|
| 72 | + "Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 73 | + 'maj.' . _LOG_INFO_IMPORTANTE |
|
| 74 | + ); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - // forcer le vidage de cache |
|
| 82 | - $trouver_table(''); |
|
| 81 | + // forcer le vidage de cache |
|
| 82 | + $trouver_table(''); |
|
| 83 | 83 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | include_spip('maj/legacy/v30'); |