Documentation is available at migrate.php
- <?php
- // ----------------------------------------
- // processing program
- // ----------------------------------------
- include "inc/config_inc.php";
- include "inc/header.html";
- // --------------------------------------------------
- // decode script time limit config params
- // --------------------------------------------------
- if (isset($config_time_limit) and $config_time_limit > 0) {
- set_time_limit($config_time_limit);
- }
- else {
- set_time_limit(1800);
- }
- // --------------------------------------------------
- // go
- // --------------------------------------------------
- $time_start = getmicrotime();
- $display_debug = 0;
- $write_debug = 0;
- $nb_transfered = 0;
- print "<h2>Transfert des données</h2>";
- // --------------------------------------------------
- // in case of, no primary key for these
- // --------------------------------------------------
- remove_primary_key('spip_auteurs_messages');
- remove_primary_key('spip_auteurs_rubriques');
- remove_primary_key('spip_referers');
- remove_primary_key('spip_referers_articles');
- // --------------------------------------------------
- // migrate according to table and field definition for this version
- // --------------------------------------------------
- for ($i = 1; $i <= count($table_to_migrate); $i++) {
- $from_table_name = $table_to_migrate[$i]['from'];
- $to_table_name = $table_to_migrate[$i]['to'];
- $field_definition = $table_to_migrate[$i]['field'];
- if (in_array($from_table_name, $_REQUEST['selected_source_table_name'])) {
- $nb_transfered = $nb_transfered + migrate_data($from_table_name, $to_table_name, $field_definition);
- }
- }
- // --------------------------------------------------
- // result
- // --------------------------------------------------
- $time_end = getmicrotime();
- $duration = exetime($time_start,$time_end);
- $rate = ceil($nb_transfered / $duration);
- $nb_transfered_f = fr_format_number($nb_transfered);
- $duration_f = convert_hms($duration);
- print "Au total $nb_transfered_f fiches transférées en $duration_f <br />";
- print "$rate fiches par seconde <br /><br />";
- print "<a href=\"confirm.php\">Retour au choix des tables</a>";
- include "inc/footer.html";
- ?>