-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
39 lines (36 loc) · 1.7 KB
/
index.html
File metadata and controls
39 lines (36 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html ng-app>
<head>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.2/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style id="jsbin-css">
</style>
</head>
<body>
<div class="container">
<h1>Generates the <code>SQL</code> queries for migrating a wordpress DB.</h1>
<label for="oldurl">Old URL
<input type="text" id="oldurl" ng-model="oldurl" class="form-control">
</label>
<label for="newurl">New URL
<input type="text" id="newurl" ng-model="newurl" class="form-control">
</label>
<label for="newurl">Table prefix
<input type="text" value="wp_" id="table-prefix" ng-model="tablePrefix" class="form-control">
</label>
<h2>MySQL wordpress DB rename</h2>
<textarea class="form-control" onclick="this.select()" style="height: 6em;">
UPDATE {{tablePrefix}}options SET option_value = replace(option_value, 'http://{{oldurl}}', 'http://{{newurl}}') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE {{tablePrefix}}posts SET guid = REPLACE (guid, 'http://{{oldurl}}', 'http://{{newurl}}');
UPDATE {{tablePrefix}}posts SET post_content = REPLACE (post_content, 'http://{{oldurl}}', 'http://{{oldurl}}');
UPDATE {{tablePrefix}}posts SET post_content = REPLACE (post_content, 'src="http://{{oldurl}}', 'src="http://{{newurl}}');
UPDATE {{tablePrefix}}posts SET guid = REPLACE (guid, 'http://{{oldurl}}', 'http://{{newurl}}') WHERE post_type = 'attachment';
UPDATE {{tablePrefix}}postmeta SET meta_value = REPLACE (meta_value, 'http://{{oldurl}}','http://{{newurl}}');
</textarea>
</div>
<script>
</script>
</body>
</html>