<commit_before>#!/usr/bin/php
<?php

$config = json_decode(file_get_contents("../etc/config.phoenix.json"));

$db_host = $config->mysql->servers[0]->hostname;
$db_user = $config->mysql->username;
$db_pass = $config->mysql->password;
$db_old  = "bnetdocs_botdev";
$db_new  = $config->mysql->database;

$link1 = mysqli_connect($db_host, $db_user, $db_pass, $db_old);
$link2 = mysqli_connect($db_host, $db_user, $db_pass, $db_new);

$link2->query("TRUNCATE TABLE `packet_used_by`;");

$rows = $link1->query("SELECT `id`, `usedby` FROM `packets` ORDER BY `id` ASC;");
$i = 0; $j = $rows->num_rows;
while ($row = $rows->fetch_object()) {
  $id     = $row->id;
  $usedby = explode(",", str_replace(", ", ",", $row->usedby));<commit_msg>Use both config files to migrate packet usedby<commit_after>#!/usr/bin/php
<?php

$config1 = json_decode(file_get_contents("../etc/config.redux.json"));
$config2 = json_decode(file_get_contents("../etc/config.phoenix.json"));

$db1_host = $config1->database->hostname;
$db1_user = $config1->database->username;
$db1_pass = $config1->database->password;
$db1_name = $config1->database->name;

$db2_host = $config2->mysql->servers[0]->hostname;
$db2_user = $config2->mysql->username;
$db2_pass = $config2->mysql->password;
$db2_name = $config2->mysql->database;

$link1 = mysqli_connect($db1_host, $db1_user, $db1_pass, $db1_name);
$link2 = mysqli_connect($db2_host, $db2_user, $db2_pass, $db2_name);

$link2->query("TRUNCATE TABLE `packet_used_by`;");

$rows = $link1->query("SELECT `id`, `usedby` FROM `packets` ORDER BY `id` ASC;");
$i = 0; $j = $rows->num_rows;
while ($row = $rows->fetch_object()) {
  $id     = $row->id;
  $usedby = explode(",", str_replace(", ", ",", $row->usedby));
{'fraction_non_alphanumeric': 0.220023282887078, 'fraction_numerical': 0.02211874272409779, 'mean_word_length': 6.074074074074074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1336015', 'n_tokens_mistral': 691, 'n_tokens_neox': 686, 'n_words': 114}