Source for file migrate.php

Documentation is available at migrate.php

  1. <?php
  2. // ----------------------------------------
  3. // processing program
  4. // ----------------------------------------
  5.  
  6. include "inc/config_inc.php";
  7. include "inc/header.html";
  8.  
  9. // --------------------------------------------------
  10. // decode script time limit config params
  11. // --------------------------------------------------
  12.  
  13. if (isset($config_time_limit) and $config_time_limit > 0) {
  14. set_time_limit($config_time_limit);
  15. }
  16. else {
  17. set_time_limit(1800);
  18. }
  19.  
  20. // --------------------------------------------------
  21. // go
  22. // --------------------------------------------------
  23.  
  24. $time_start = getmicrotime();
  25.  
  26. $display_debug = 0;
  27. $write_debug = 0;
  28. $nb_transfered = 0;
  29.  
  30.  
  31. print "<h2>Transfert des données</h2>";
  32.  
  33. // --------------------------------------------------
  34. // in case of, no primary key for these
  35. // --------------------------------------------------
  36.  
  37. remove_primary_key('spip_auteurs_messages');
  38. remove_primary_key('spip_auteurs_rubriques');
  39. remove_primary_key('spip_referers');
  40. remove_primary_key('spip_referers_articles');
  41.  
  42.  
  43. // --------------------------------------------------
  44. // migrate according to table and field definition for this version
  45. // --------------------------------------------------
  46.  
  47. for ($i = 1; $i <= count($table_to_migrate); $i++) {
  48. $from_table_name = $table_to_migrate[$i]['from'];
  49. $to_table_name = $table_to_migrate[$i]['to'];
  50. $field_definition = $table_to_migrate[$i]['field'];
  51.  
  52. if (in_array($from_table_name, $_REQUEST['selected_source_table_name'])) {
  53. $nb_transfered = $nb_transfered + migrate_data($from_table_name, $to_table_name, $field_definition);
  54. }
  55. }
  56.  
  57. // --------------------------------------------------
  58. // result
  59. // --------------------------------------------------
  60.  
  61. $time_end = getmicrotime();
  62. $duration = exetime($time_start,$time_end);
  63. $rate = ceil($nb_transfered / $duration);
  64.  
  65. $nb_transfered_f = fr_format_number($nb_transfered);
  66. $duration_f = convert_hms($duration);
  67.  
  68.  
  69. print "Au total $nb_transfered_f fiches transférées en $duration_f <br />";
  70. print "$rate fiches par seconde <br /><br />";
  71. print "<a href=\"confirm.php\">Retour au choix des tables</a>";
  72.  
  73.  
  74. include "inc/footer.html";
  75. ?>

Documentation generated on Mon, 31 Mar 2008 18:08:45 +0200 by phpDocumentor 1.3.0RC3