diff --git a/.gitattributes b/.gitattributes index a84496f75d996462f64eb13593f4d01751c5ba33..b5bd72e04f160cd8c73f6d7f23f2d31b8528378d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -259,6 +259,7 @@ ecrire/img_pack/xml.gif -text ecrire/inc_accueil.php -text ecrire/inc_admin_effacer.php -text ecrire/inc_admin_index.php -text +ecrire/inc_admin_repair.php -text ecrire/inc_admin_tech.php -text ecrire/inc_admin_vider.php -text ecrire/inc_aide_index.php -text diff --git a/ecrire/admin_repair.php3 b/ecrire/admin_repair.php3 index 2acd26fa6e3d9a659825ed180349d7b28fba545e..31abd3ad9f604f82cfa1b0bbdd14c0d320f12c8e 100644 --- a/ecrire/admin_repair.php3 +++ b/ecrire/admin_repair.php3 @@ -10,14 +10,6 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -include ("inc_version.php3"); - -include_ecrire ("inc_admin"); -include_ecrire ("inc_texte"); -include_ecrire ("inc_minipres"); - - /* * REMARQUE IMPORTANTE : SECURITE * Ce systeme de reparation doit pouvoir fonctionner meme si @@ -26,71 +18,9 @@ include_ecrire ("inc_minipres"); * */ -$connect_statut = '0minirezo'; - -function verifier_base() { - if (! $res1= spip_query("SHOW TABLES")) - return false; - - $res = ""; - while ($tab = spip_fetch_array($res1)) { - $res .= "<p><b>".$tab[0]."</b> "; - - if (!($result_repair = spip_query("REPAIR TABLE ".$tab[0]))) - return false; - - if (!($result = spip_query("SELECT COUNT(*) FROM ".$tab[0]))) - return false; - - list($count) = spip_fetch_array($result); - if ($count>1) - $res .= "("._T('texte_compte_elements', array('count' => $count)).")\n"; - else if ($count==1) - $res .= "("._T('texte_compte_element', array('count' => $count)).")\n"; - else - $res .= "("._T('texte_vide').")\n"; - - $row = spip_fetch_array($result_repair); - $ok = ($row[3] == 'OK'); - - if (!$ok) - $res .= "<pre><font color='red'><b>".htmlentities(join("\n", $row))."</b></font></pre>\n"; - else - $res .= " "._T('texte_table_ok')."<br>\n"; - - } - - return $res; -} - -// verifier version MySQL -if (! $res1= spip_query("SELECT version()")) - $message = _T('avis_erreur_connexion_mysql'); -else { - $tab = spip_fetch_array($res1); - $version_mysql = $tab[0]; - if ($version_mysql < '3.23.14') - $message = _T('avis_version_mysql', array('version_mysql' => $version_mysql)); - else { - $message = _T('texte_requetes_echouent'); - $ok = true; - } -} - -$action = _T('texte_tenter_reparation'); - -if ($ok) { - debut_admin($action, $message); - - if (! $res = verifier_base()) - $res = "<br><br><font color='red'><b><tt>"._T('avis_erreur_mysql').' '.spip_sql_errno().': '.spip_sql_error() ."</tt></b></font><br /><br /><br />\n"; - install_debut_html(_T('texte_tentative_recuperation'));echo $res; install_fin_html(); - - fin_admin($action); -} -else { - install_debut_html(_T('titre_reparation'));echo "<p>$message</p>";install_fin_html(); -} - +include ("inc_version.php3"); +$GLOBALS['connect_statut'] = '0minirezo'; +$var_f = include_fonction($SCRIPT_NAME); +$var_f(); ?> diff --git a/ecrire/inc_admin_repair.php b/ecrire/inc_admin_repair.php new file mode 100644 index 0000000000000000000000000000000000000000..98cf428e81301f439c3258d7d22c706c8f6231a2 --- /dev/null +++ b/ecrire/inc_admin_repair.php @@ -0,0 +1,89 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_ecrire ("inc_admin"); +include_ecrire ("inc_texte"); +include_ecrire ("inc_minipres"); + + +function verifier_base() { + if (! $res1= spip_query("SHOW TABLES")) + return false; + + $res = ""; + while ($tab = spip_fetch_array($res1)) { + $res .= "<p><b>".$tab[0]."</b> "; + + if (!($result_repair = spip_query("REPAIR TABLE ".$tab[0]))) + return false; + + if (!($result = spip_query("SELECT COUNT(*) FROM ".$tab[0]))) + return false; + + list($count) = spip_fetch_array($result); + if ($count>1) + $res .= "("._T('texte_compte_elements', array('count' => $count)).")\n"; + else if ($count==1) + $res .= "("._T('texte_compte_element', array('count' => $count)).")\n"; + else + $res .= "("._T('texte_vide').")\n"; + + $row = spip_fetch_array($result_repair); + $ok = ($row[3] == 'OK'); + + if (!$ok) + $res .= "<pre><font color='red'><b>".htmlentities(join("\n", $row))."</b></font></pre>\n"; + else + $res .= " "._T('texte_table_ok')."<br>\n"; + + } + + return $res; +} + +function admin_repair_dist() +{ + +// verifier version MySQL +if (! $res1= spip_query("SELECT version()")) + $message = _T('avis_erreur_connexion_mysql'); +else { + $tab = spip_fetch_array($res1); + $version_mysql = $tab[0]; + if ($version_mysql < '3.23.14') + $message = _T('avis_version_mysql', array('version_mysql' => $version_mysql)); + else { + $message = _T('texte_requetes_echouent'); + $ok = true; + } +} + +$action = _T('texte_tenter_reparation'); + +if ($ok) { + debut_admin($action, $message); + + if (! $res = verifier_base()) + $res = "<br><br><font color='red'><b><tt>"._T('avis_erreur_mysql').' '.spip_sql_errno().': '.spip_sql_error() ."</tt></b></font><br /><br /><br />\n"; + install_debut_html(_T('texte_tentative_recuperation'));echo $res; install_fin_html(); + + fin_admin($action); +} +else { + install_debut_html(_T('titre_reparation'));echo "<p>$message</p>";install_fin_html(); +} + +} + +?>