function base_convert_utf8_dist($titre='', $reprise=false) { if (!$titre) return; // anti-testeur automatique // une liste des tables a convertir, avec le champ dans lequel on // indique '<CONVERT charset>' ; on commence par les rubriques sinon // ca fait desordre dans l'interface privee $tables_a_convertir = array( 'spip_rubriques' => 'titre', 'spip_auteurs' => 'nom', 'spip_articles' => 'titre', 'spip_breves' => 'titre', 'spip_documents' => 'titre', 'spip_forum' => 'titre', 'spip_mots' => 'titre', 'spip_groupes_mots' => 'titre', 'spip_petitions' => 'texte', 'spip_signatures' => 'nom_email', 'spip_syndic' => 'nom_site', 'spip_syndic_articles' => 'titre', 'spip_messages' => 'titre' ); if (!$reprise) convert_utf8_init($tables_a_convertir); echo install_debut_html($titre); echo "<p>", _T('utf8_convert_timeout'), "</p><hr />\n"; // preparer un fichier de sauvegarde au cas ou // on met 'a' car ca peut demander plusieurs rechargements $f = @fopen(_DIR_TMP.'convert_utf8_backup.sql', 'a'); foreach ($tables_a_convertir as $table => $champ) { convert_table_utf8($f, $table, $champ); } if ($f) fclose($f); echo "<p><b>"._T('utf8_convert_termine')."</b></p>"; echo "<p>,"._T('utf8_convert_verifier', array('rep' => joli_repertoire(_DIR_TMP))), '</p>'; // bouton "retour au site" + redirige_par_entete echo "<p style='text-align: right'>", "<a href='", generer_url_ecrire("config_lang"), "'> >> ", _T('icone_retour'),"</a></p>", install_fin_html(); }
{ global $lang_update; echo sprintf($lang_update['Converting item'], $lang_update['user'], $cur_item['id']) . '<br />' . "\n"; convert_to_utf8($cur_item['username'], $old_charset); convert_to_utf8($cur_item['title'], $old_charset); convert_to_utf8($cur_item['realname'], $old_charset); convert_to_utf8($cur_item['location'], $old_charset); convert_to_utf8($cur_item['signature'], $old_charset); convert_to_utf8($cur_item['admin_note'], $old_charset); return $cur_item; } function _error_users($cur_user) { $_SESSION['dupe_users'][$cur_user['id']] = $cur_user; } $end_at = convert_table_utf8($db->prefix . 'users', '_conv_users', $old_charset, 'id', $start_at, '_error_users'); if ($end_at !== true) { $query_str = '?stage=conv_users&req_old_charset=' . $old_charset . '&start_at=' . $end_at; } else { if (!empty($_SESSION['dupe_users'])) { $query_str = '?stage=conv_users_dupe'; } } break; // Handle any duplicate users which occured due to conversion // Handle any duplicate users which occured due to conversion case 'conv_users_dupe': $query_str = '?stage=preparse_posts'; if (!$mysql || empty($_SESSION['dupe_users'])) { break; }
convert_table_utf8($forum_db->prefix . 'search_cache'); echo 'Converting table ' . $forum_db->prefix . 'search_matches…<br />' . "\n"; flush(); convert_table_utf8($forum_db->prefix . 'search_matches'); echo 'Converting table ' . $forum_db->prefix . 'search_words…<br />' . "\n"; flush(); convert_table_utf8($forum_db->prefix . 'search_words'); echo 'Converting table ' . $forum_db->prefix . 'subscriptions…<br />' . "\n"; flush(); convert_table_utf8($forum_db->prefix . 'subscriptions'); echo 'Converting table ' . $forum_db->prefix . 'topics…<br />' . "\n"; flush(); convert_table_utf8($forum_db->prefix . 'topics'); echo 'Converting table ' . $forum_db->prefix . 'users…<br />' . "\n"; flush(); convert_table_utf8($forum_db->prefix . 'users'); } $query_str = '?stage=preparse_posts'; break; case 'preparse_posts': if (!defined('FORUM_PARSER_LOADED')) { require FORUM_ROOT . 'include/parser.php'; } // Now we're definitely using UTF-8, so we convert the output properly $forum_db->set_names('utf8'); // Determine where to start if ($start_at == 0) { // Get the first post ID from the db $query = array('SELECT' => 'id', 'FROM' => 'posts', 'ORDER BY' => 'id', 'LIMIT' => '1'); $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); $start_at = $forum_db->result($result);