@@ -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 | /** |
@@ -36,20 +36,20 @@ discard block |
||
| 36 | 36 | **/ |
| 37 | 37 | function base_repair_dist($titre = '', $reprise = '') { |
| 38 | 38 | |
| 39 | - $res = admin_repair_tables(); |
|
| 40 | - if (!$res) { |
|
| 41 | - $res = "<div class='error'>" . _T('avis_erreur_mysql') . ' ' . sql_errno() . ': ' . sql_error() . "</div>\n"; |
|
| 42 | - } else { |
|
| 43 | - include_spip('inc/rubriques'); |
|
| 44 | - calculer_rubriques(); |
|
| 45 | - propager_les_secteurs(); |
|
| 46 | - } |
|
| 47 | - include_spip('inc/minipres'); |
|
| 48 | - $res .= pipeline('base_admin_repair', $res); |
|
| 49 | - echo minipres( |
|
| 50 | - _T('texte_tentative_recuperation'), |
|
| 51 | - $res . generer_form_ecrire('accueil', '', '', _T('public:accueil_site')) |
|
| 52 | - ); |
|
| 39 | + $res = admin_repair_tables(); |
|
| 40 | + if (!$res) { |
|
| 41 | + $res = "<div class='error'>" . _T('avis_erreur_mysql') . ' ' . sql_errno() . ': ' . sql_error() . "</div>\n"; |
|
| 42 | + } else { |
|
| 43 | + include_spip('inc/rubriques'); |
|
| 44 | + calculer_rubriques(); |
|
| 45 | + propager_les_secteurs(); |
|
| 46 | + } |
|
| 47 | + include_spip('inc/minipres'); |
|
| 48 | + $res .= pipeline('base_admin_repair', $res); |
|
| 49 | + echo minipres( |
|
| 50 | + _T('texte_tentative_recuperation'), |
|
| 51 | + $res . generer_form_ecrire('accueil', '', '', _T('public:accueil_site')) |
|
| 52 | + ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,60 +63,60 @@ discard block |
||
| 63 | 63 | **/ |
| 64 | 64 | function admin_repair_tables() { |
| 65 | 65 | |
| 66 | - $repair = sql_serveur('repair', '', true); |
|
| 66 | + $repair = sql_serveur('repair', '', true); |
|
| 67 | 67 | |
| 68 | - // recreer les tables manquantes eventuelles |
|
| 69 | - include_spip('base/create'); |
|
| 70 | - creer_base(); |
|
| 71 | - $tables = sql_alltable(); |
|
| 68 | + // recreer les tables manquantes eventuelles |
|
| 69 | + include_spip('base/create'); |
|
| 70 | + creer_base(); |
|
| 71 | + $tables = sql_alltable(); |
|
| 72 | 72 | |
| 73 | - $res = ''; |
|
| 74 | - foreach ($tables as $tab) { |
|
| 75 | - $class = ''; |
|
| 76 | - $m = "<strong>$tab</strong> "; |
|
| 77 | - spip_log("Repare $tab", _LOG_INFO_IMPORTANTE); |
|
| 78 | - // supprimer la meta avant de lancer la reparation |
|
| 79 | - // car le repair peut etre long ; on ne veut pas boucler |
|
| 80 | - effacer_meta('admin_repair'); |
|
| 81 | - if ($repair) { |
|
| 82 | - $result_repair = sql_repair($tab); |
|
| 83 | - if (!$result_repair) { |
|
| 84 | - return false; |
|
| 85 | - } |
|
| 86 | - } |
|
| 73 | + $res = ''; |
|
| 74 | + foreach ($tables as $tab) { |
|
| 75 | + $class = ''; |
|
| 76 | + $m = "<strong>$tab</strong> "; |
|
| 77 | + spip_log("Repare $tab", _LOG_INFO_IMPORTANTE); |
|
| 78 | + // supprimer la meta avant de lancer la reparation |
|
| 79 | + // car le repair peut etre long ; on ne veut pas boucler |
|
| 80 | + effacer_meta('admin_repair'); |
|
| 81 | + if ($repair) { |
|
| 82 | + $result_repair = sql_repair($tab); |
|
| 83 | + if (!$result_repair) { |
|
| 84 | + return false; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - // essayer de maj la table (creation de champs manquants) |
|
| 89 | - maj_tables($tab); |
|
| 88 | + // essayer de maj la table (creation de champs manquants) |
|
| 89 | + maj_tables($tab); |
|
| 90 | 90 | |
| 91 | - $count = sql_countsel($tab); |
|
| 91 | + $count = sql_countsel($tab); |
|
| 92 | 92 | |
| 93 | - if ($count > 1) { |
|
| 94 | - $m .= '(' . _T('texte_compte_elements', ['count' => $count]) . ")\n"; |
|
| 95 | - } else { |
|
| 96 | - if ($count == 1) { |
|
| 97 | - $m .= '(' . _T('texte_compte_element', ['count' => $count]) . ")\n"; |
|
| 98 | - } else { |
|
| 99 | - $m .= '(' . _T('texte_vide') . ")\n"; |
|
| 100 | - } |
|
| 101 | - } |
|
| 93 | + if ($count > 1) { |
|
| 94 | + $m .= '(' . _T('texte_compte_elements', ['count' => $count]) . ")\n"; |
|
| 95 | + } else { |
|
| 96 | + if ($count == 1) { |
|
| 97 | + $m .= '(' . _T('texte_compte_element', ['count' => $count]) . ")\n"; |
|
| 98 | + } else { |
|
| 99 | + $m .= '(' . _T('texte_vide') . ")\n"; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - if ( |
|
| 104 | - $repair |
|
| 105 | - and $result_repair |
|
| 106 | - and $msg = join( |
|
| 107 | - ' ', |
|
| 108 | - (is_resource($result_repair) or is_object($result_repair)) ? sql_fetch($result_repair) : $result_repair |
|
| 109 | - ) . ' ' |
|
| 110 | - and !str_contains($msg, ' OK ') |
|
| 111 | - ) { |
|
| 112 | - $class = " class='notice'"; |
|
| 113 | - $m .= '<br /><tt>' . spip_htmlentities($msg) . "</tt>\n"; |
|
| 114 | - } else { |
|
| 115 | - $m .= ' ' . _T('texte_table_ok'); |
|
| 116 | - } |
|
| 103 | + if ( |
|
| 104 | + $repair |
|
| 105 | + and $result_repair |
|
| 106 | + and $msg = join( |
|
| 107 | + ' ', |
|
| 108 | + (is_resource($result_repair) or is_object($result_repair)) ? sql_fetch($result_repair) : $result_repair |
|
| 109 | + ) . ' ' |
|
| 110 | + and !str_contains($msg, ' OK ') |
|
| 111 | + ) { |
|
| 112 | + $class = " class='notice'"; |
|
| 113 | + $m .= '<br /><tt>' . spip_htmlentities($msg) . "</tt>\n"; |
|
| 114 | + } else { |
|
| 115 | + $m .= ' ' . _T('texte_table_ok'); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - $res .= "<div$class>$m</div>"; |
|
| 119 | - } |
|
| 118 | + $res .= "<div$class>$m</div>"; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - return $res; |
|
| 121 | + return $res; |
|
| 122 | 122 | } |