Created
January 14, 2019 14:21
-
-
Save jimains/a4407b2885bdfcff082b7b1ced28d310 to your computer and use it in GitHub Desktop.
Generate ignore XML declarations for data migration (M1->M2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Ignore fields per table</h1> | |
<form method="post"> | |
<label>Fields</label> | |
<input type="text" name="fields"> | |
<label>Table</label> | |
<input type="text" name="table"> | |
<input type="submit"> | |
</form> | |
<?php | |
if(isset($_POST['fields'])) | |
{ | |
$fields = explode(',', $_POST['fields']); | |
echo '<textarea rows="50" cols="100">'; | |
foreach ($fields as $field) | |
{ | |
echo "<ignore>\r\n"; | |
echo sprintf("<field>%s.%s</field>\r\n", $_POST['table'], $field); | |
echo "</ignore>\r\n"; | |
} | |
echo '</textarea>'; | |
} | |
?> | |
<h1>Ignore whole tables</h1> | |
<form method="post"> | |
<label>Tables, comma separated</label> | |
<input type="text" name="tables2"> | |
<input type="submit"> | |
</form> | |
<?php | |
if(isset($_POST['tables2'])) | |
{ | |
$tables = explode(',', $_POST['tables2']); | |
echo '<textarea rows="50" cols="100">'; | |
foreach ($tables as $table) | |
{ | |
echo "<ignore>\r\n"; | |
echo sprintf("<document>%s</document>\r\n", $table); | |
echo "</ignore>\r\n"; | |
} | |
echo '</textarea>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment