Version Description
- 2012-08-15 =
- Removed WP App Store installer - not allowed in WP.org repo
Download this release
Release Info
Developer | bradt |
Plugin | WP Migrate DB |
Version | 0.4.1 |
Comparing to | |
See all releases |
Code changes from version 0.4 to 0.4.1
- installer.php +0 -240
- readme.txt +4 -1
- wp-migrate-db.php +1 -3
installer.php
DELETED
@@ -1,240 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
WP App Store Installer for Product Integration
|
4 |
-
http://wpappstore.com/
|
5 |
-
Version: 0.2
|
6 |
-
|
7 |
-
The following code is intended for developers to include
|
8 |
-
in their themes/plugins to help distribute the WP App Store plugin.
|
9 |
-
|
10 |
-
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
11 |
-
*/
|
12 |
-
|
13 |
-
if ( !class_exists( 'WP_App_Store_Installer' ) ) :
|
14 |
-
|
15 |
-
class WP_App_Store_Installer {
|
16 |
-
public $api_url = 'https://wpappstore.com/api/client';
|
17 |
-
public $cdn_url = 'http://cdn.wpappstore.com';
|
18 |
-
|
19 |
-
public $slug = 'wp-app-store';
|
20 |
-
|
21 |
-
public $run_installer = null;
|
22 |
-
|
23 |
-
public $affiliate_id = '2421';
|
24 |
-
|
25 |
-
public $output = array(
|
26 |
-
'head' => '',
|
27 |
-
'body' => ''
|
28 |
-
);
|
29 |
-
|
30 |
-
function __construct() {
|
31 |
-
// Stop if the user doesn't have access to install themes
|
32 |
-
if ( !current_user_can( 'install_plugins' ) ) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
// Stop if user has chosen to hide this already
|
37 |
-
$user = wp_get_current_user();
|
38 |
-
if ( get_user_meta( $user->ID, 'wpas_installer_hide' ) ) {
|
39 |
-
return;
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( defined( 'WPAS_API_URL' ) ) {
|
43 |
-
$this->api_url = WPAS_API_URL;
|
44 |
-
}
|
45 |
-
|
46 |
-
add_action( 'admin_init', array( $this, 'handle_request' ) );
|
47 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
48 |
-
|
49 |
-
// Plugin upgrade hooks
|
50 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
|
51 |
-
}
|
52 |
-
|
53 |
-
function get_menu() {
|
54 |
-
$menu = get_site_transient( 'wpas_menu' );
|
55 |
-
if ( $menu ) return $menu;
|
56 |
-
|
57 |
-
// Let's refresh the menu
|
58 |
-
$url = $this->cdn_url . '/client/menu.json';
|
59 |
-
$data = wp_remote_get( $url );
|
60 |
-
|
61 |
-
if ( !is_wp_error( $data ) && 200 == $data['response']['code'] ) {
|
62 |
-
$menu = json_decode( $data['body'], true );
|
63 |
-
}
|
64 |
-
|
65 |
-
// Try retrieve a backup from the last refresh time
|
66 |
-
if ( !$menu ) {
|
67 |
-
$menu = get_site_transient( 'wpas_menu_backup' );
|
68 |
-
}
|
69 |
-
|
70 |
-
// Not even a backup? Yikes, let's use the hardcoded menu
|
71 |
-
if ( !$menu ) {
|
72 |
-
$menu = array(
|
73 |
-
'slug' => 'wp-app-store',
|
74 |
-
'title' => 'WP App Store',
|
75 |
-
'subtitle' => 'Home',
|
76 |
-
'position' => 999,
|
77 |
-
'submenu' => array(
|
78 |
-
'wp-app-store-themes' => 'Themes',
|
79 |
-
'wp-app-store-plugins' => 'Plugins'
|
80 |
-
)
|
81 |
-
);
|
82 |
-
}
|
83 |
-
|
84 |
-
set_site_transient( 'wpas_menu', $menu, 60*60*24 );
|
85 |
-
set_site_transient( 'wpas_menu_backup', $menu );
|
86 |
-
|
87 |
-
return $menu;
|
88 |
-
}
|
89 |
-
|
90 |
-
function admin_menu() {
|
91 |
-
// Stop if the WP App Store plugin is already installed and activated
|
92 |
-
if ( class_exists( 'WP_App_Store' ) ) {
|
93 |
-
return;
|
94 |
-
}
|
95 |
-
|
96 |
-
// Stop if the WP App Store plugin is already installed, but not activated
|
97 |
-
$plugins = array_keys( get_plugins() );
|
98 |
-
foreach ( $plugins as $plugin ) {
|
99 |
-
if ( strpos( $plugin, 'wp-app-store.php' ) !== false ) {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
$menu = $this->get_menu();
|
105 |
-
|
106 |
-
add_menu_page( $menu['title'], $menu['title'], 'install_themes', $this->slug, array( $this, 'render_page' ), null, $menu['position'] );
|
107 |
-
|
108 |
-
add_action( 'admin_print_styles', array( $this, 'enqueue_styles' ) );
|
109 |
-
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
110 |
-
}
|
111 |
-
|
112 |
-
function enqueue_styles() {
|
113 |
-
wp_enqueue_style( $this->slug . '-global', $this->cdn_url . '/asset/css/client-global.css' );
|
114 |
-
}
|
115 |
-
|
116 |
-
function get_install_url() {
|
117 |
-
return 'update.php?action=install-plugin&plugin=wp-app-store&_wpnonce=' . urlencode( wp_create_nonce( 'install-plugin_wp-app-store' ) );
|
118 |
-
}
|
119 |
-
|
120 |
-
function current_url() {
|
121 |
-
$ssl = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 's' : '';
|
122 |
-
$port = ( $_SERVER['SERVER_PORT'] != '80' ) ? ':' . $_SERVER['SERVER_PORT'] : '';
|
123 |
-
return sprintf( 'http%s://%s%s%s', $ssl, $_SERVER['SERVER_NAME'], $port, $_SERVER['REQUEST_URI'] );
|
124 |
-
}
|
125 |
-
|
126 |
-
function handle_request() {
|
127 |
-
if ( !isset( $_GET['page'] ) || !preg_match( '@^' . $this->slug . '@', $_GET['page'] ) ) {
|
128 |
-
return;
|
129 |
-
}
|
130 |
-
|
131 |
-
if ( isset( $_GET['wpas-hide'] ) ) {
|
132 |
-
$user = wp_get_current_user();
|
133 |
-
update_user_meta( $user->ID, 'wpas_installer_hide', '1' );
|
134 |
-
wp_redirect( 'index.php' );
|
135 |
-
exit;
|
136 |
-
}
|
137 |
-
|
138 |
-
$url = $this->api_url . '/installer-splash/?wpas-install-url=' . urlencode( $this->get_install_url() );
|
139 |
-
|
140 |
-
$args = array(
|
141 |
-
'sslverify' => false,
|
142 |
-
'timeout' => 30,
|
143 |
-
'headers' => array(
|
144 |
-
'Referer' => $this->current_url(),
|
145 |
-
'User-Agent' => 'PHP/' . PHP_VERSION . ' WordPress/' . get_bloginfo( 'version' )
|
146 |
-
)
|
147 |
-
);
|
148 |
-
|
149 |
-
$remote = wp_remote_get( $url, $args );
|
150 |
-
|
151 |
-
//print_r($remote);
|
152 |
-
|
153 |
-
if ( is_wp_error( $remote ) || 200 != $remote['response']['code'] || !( $data = json_decode( $remote['body'], true ) ) ) {
|
154 |
-
$this->output['body'] .= $this->get_communication_error();
|
155 |
-
}
|
156 |
-
|
157 |
-
$this->output['body'] .= $data['body'];
|
158 |
-
|
159 |
-
$this->output['head'] .= "
|
160 |
-
<script>
|
161 |
-
WPAPPSTORE = {};
|
162 |
-
WPAPPSTORE.INSTALL_URL = '" . addslashes( $this->get_install_url() ) . "';
|
163 |
-
</script>
|
164 |
-
";
|
165 |
-
|
166 |
-
if ( isset( $data['head'] ) ) {
|
167 |
-
$this->output['head'] .= $data['head'];
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
function get_communication_error() {
|
172 |
-
ob_start();
|
173 |
-
?>
|
174 |
-
<div class="wrap">
|
175 |
-
<h2>Communication Error</h2>
|
176 |
-
<p><?php _e( 'Sorry, we could not reach the WP App Store to setup the auto installer. Please try again later.' ); ?></p>
|
177 |
-
<p><?php _e( 'In the meantime, you can check out the WP App Store at <a href="http://wpappstore.com/">http://wpappstore.com/</a>.' ); ?></p>
|
178 |
-
</div>
|
179 |
-
<?php
|
180 |
-
return ob_get_clean();
|
181 |
-
}
|
182 |
-
|
183 |
-
function admin_head() {
|
184 |
-
if ( !isset( $this->output['head'] ) ) return;
|
185 |
-
echo $this->output['head'];
|
186 |
-
}
|
187 |
-
|
188 |
-
function render_page() {
|
189 |
-
echo $this->output['body'];
|
190 |
-
}
|
191 |
-
|
192 |
-
function get_client_upgrade_data() {
|
193 |
-
$info = get_site_transient( 'wpas_client_upgrade' );
|
194 |
-
if ( $info ) return $info;
|
195 |
-
|
196 |
-
$url = $this->cdn_url . '/client/upgrade.json';
|
197 |
-
$data = wp_remote_get( $url, array( 'timeout' => 30 ) );
|
198 |
-
|
199 |
-
if ( !is_wp_error( $data ) && 200 == $data['response']['code'] ) {
|
200 |
-
if ( $info = json_decode( $data['body'], true ) ) {
|
201 |
-
set_site_transient( 'wpas_client_upgrade', $info, 60*60*24 );
|
202 |
-
return $info;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
return false;
|
207 |
-
}
|
208 |
-
|
209 |
-
function plugins_api( $api, $action, $args ) {
|
210 |
-
if (
|
211 |
-
'plugin_information' != $action || false !== $api
|
212 |
-
|| !isset( $args->slug ) || 'wp-app-store' != $args->slug
|
213 |
-
) return $api;
|
214 |
-
|
215 |
-
$upgrade = $this->get_client_upgrade_data();
|
216 |
-
$menu = $this->get_menu();
|
217 |
-
|
218 |
-
if ( !$upgrade ) return $api;
|
219 |
-
|
220 |
-
// Add affiliate ID to WP settings if it's not already set by another
|
221 |
-
// theme or plugin
|
222 |
-
if ( $this->affiliate_id && !get_site_transient( 'wpas_affiliate_id' ) ) {
|
223 |
-
set_site_transient( 'wpas_affiliate_id', $this->affiliate_id );
|
224 |
-
}
|
225 |
-
|
226 |
-
$api = new stdClass();
|
227 |
-
$api->name = $menu['title'];
|
228 |
-
$api->version = $upgrade['version'];
|
229 |
-
$api->download_link = $upgrade['download_url'];
|
230 |
-
return $api;
|
231 |
-
}
|
232 |
-
}
|
233 |
-
|
234 |
-
function wp_app_store_installer_init() {
|
235 |
-
new WP_App_Store_Installer();
|
236 |
-
}
|
237 |
-
|
238 |
-
add_action( 'init', 'wp_app_store_installer_init' );
|
239 |
-
|
240 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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2
|
9 |
|
10 |
Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
@@ -29,6 +29,9 @@ Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
|
|
|
|
32 |
= 0.4 - 2012-08-07 =
|
33 |
* New: More than 4x faster than version 0.3 due to find & replace improvements
|
34 |
* New: Option to turn off replacing GUIDs
|
4 |
Tags: database, migrate, backup, mysql
|
5 |
Requires at least: 2.0.3
|
6 |
Tested up to: 3.4.1
|
7 |
+
Stable tag: 0.4.1
|
8 |
License: GPLv2
|
9 |
|
10 |
Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 0.4.1 - 2012-08-15 =
|
33 |
+
* Removed WP App Store installer - not allowed in WP.org repo
|
34 |
+
|
35 |
= 0.4 - 2012-08-07 =
|
36 |
* New: More than 4x faster than version 0.3 due to find & replace improvements
|
37 |
* New: Option to turn off replacing GUIDs
|
wp-migrate-db.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP-Migrate-DB
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-migrate-db/
|
5 |
Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
6 |
Author: Brad Touesnard
|
7 |
-
Version: 0.4
|
8 |
Author URI: http://bradt.ca/
|
9 |
*/
|
10 |
|
@@ -704,5 +704,3 @@ function wp_migrate_db_init() {
|
|
704 |
}
|
705 |
|
706 |
add_action( 'init', 'wp_migrate_db_init' );
|
707 |
-
|
708 |
-
include dirname( __FILE__ ) . DS . '/installer.php';
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/wp-migrate-db/
|
5 |
Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
|
6 |
Author: Brad Touesnard
|
7 |
+
Version: 0.4.1
|
8 |
Author URI: http://bradt.ca/
|
9 |
*/
|
10 |
|
704 |
}
|
705 |
|
706 |
add_action( 'init', 'wp_migrate_db_init' );
|
|
|
|