Created
June 7, 2014 05:39
-
-
Save withinboredom/d4e810a580700969dda2 to your computer and use it in GitHub Desktop.
Moving wordpress
This file contains 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
$read = fopen("db513204537.sql", 'r'); | |
$write = fopen("scrubbed.sql", "w"); | |
$on = 0; | |
while($line = fgets($read)) { | |
$on++; | |
// change site url | |
$line = str_ireplace("verbatl.com", "verb.azurewebsites.net", $line); | |
$line = str_ireplace("MyISAM", "innodb", $line); | |
// replace everyones email address | |
//$line = preg_replace("/[^@\s]*@[^@\s]*\.[^@\s]*/", "nobody@verbatl.com", $line); | |
// reset serialization | |
$line = preg_replace_callback("!s:(\d+):\"(.*?)\";!", function($matches) { | |
$len = strlen($matches[2]); | |
$sub = substr_count($matches[2], '\r'); | |
$sub += substr_count($matches[2], '\n'); | |
return "s:" . ($len - $sub) . ":\"" . $matches[2] . "\";"; | |
}, $line); | |
//$line = preg_replace("!s:(\d+):\"(.*?)\";!e", "'s:'.strlen('$2').':\"$2\";'", $line); | |
// check line 338 | |
echo "$line"; | |
fwrite($write, $line); | |
} | |
fclose($read); | |
fclose($write); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment