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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
<?php // Incoming vars: $destination, $destination_id
//pb_backupbuddy::$ui->title( 'Deployment' ); include( pb_backupbuddy::plugin_path() . '/classes/remote_api.php' );
wp_enqueue_script( 'thickbox' ); wp_print_scripts( 'thickbox' ); wp_print_styles( 'thickbox' ); ?>
<style> .database_restore_table_select { background: #FFF; padding: 8px; max-height: 200px; overflow: scroll; border: 1px solid #ececec; } .database_restore_table_select::-webkit-scrollbar { -webkit-appearance: none; width: 11px; height: 11px; } .database_restore_table_select::-webkit-scrollbar-thumb { border-radius: 8px; border: 2px solid white; /* should match background, can't be transparent */ background-color: rgba(0, 0, 0, .1); } </style>
<?php $deployment = backupbuddy_remote_api::key_to_array( $destination['api_key'] );
require_once( pb_backupbuddy::plugin_path() . '/classes/deploy.php' ); $deploy = new backupbuddy_deploy( $destination['api_key'] ); ?>
<style> .deploy-push-text { //font-size: 1.4em; padding: 7px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .deploy-pull-text { //font-size: 1.4em; padding: 7px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .deploy-status-up { display: inline-block; background: #0074a2; font-size: 1.4em; padding: 14px; color: #FFF; opacity: 0.5; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } .deploy-pushpull-wrap { font-size: 1.4em !important; } .deploy-sites-table td { padding: 30px; vertical-align: middle; } .deploy-type-selected { font-weight: bold; background: #efefef; } .tdhead { font-weight: bold; } </style>
<script> jQuery(document).ready(function() { jQuery( '#deploy_profile_settings' ).click( function(e){ e.preventDefault(); tb_show( 'BackupBuddy', '<?php echo pb_backupbuddy::ajax_url( 'profile_settings' ); ?>&profile=' + jQuery( '#deploy_profile_selected' ).val() + '&callback_data=&TB_iframe=1&width=640&height=455', null ); }); /* jQuery( '#pb_backupbuddy_deploy_form' ).submit( function(e){ e.preventDefault(); window.location.href = '<?php echo pb_backupbuddy::ajax_url( 'deploy' ); ?>&step=run&deployment=<?php echo $destination_id; ?>&backup_profile=' + jQuery( '#deploy_profile_selected' ).val(); return false; }); */
}); </script>
<table class="widefat deploy-sites-table"> <tr> <td><span class="deploy-status-up">Site UP</span></td> <td><?php echo $deploy->_state['destination']['siteurl']; ?></td> <td class="deploy-pushpull-wrap"> <a href="#" class="deploy-push-text" onClick="jQuery( '.deploy-type-selected' ).removeClass( 'deploy-type-selected' ); jQuery(this).addClass( 'deploy-type-selected' ); jQuery('#deploy-pull-wrap').hide(); jQuery('#deploy-push-wrap').slideDown(); jQuery('#backupbuddy_deploy_direction').attr('data-direction','push' ); jQuery( '.database_contents_shortcuts-prefix' ).click();">Push to</a> | <a href="#"class="deploy-pull-text" onClick="jQuery( '.deploy-type-selected' ).removeClass( 'deploy-type-selected' ); jQuery(this).addClass( 'deploy-type-selected' ); jQuery('#deploy-push-wrap').hide(); jQuery('#deploy-pull-wrap').slideDown(); jQuery('#backupbuddy_deploy_direction').attr('data-direction','pull' ); jQuery( '.database_contents_shortcuts-prefix' ).click();">Pull from</a> </td> </tr> </table>
<?php $localInfo = backupbuddy_api::getPreDeployInfo(); $status = $deploy->start( $localInfo ); if ( false === $status ) { $errors = $deploy->getErrors(); if ( count( $errors ) > 0 ) { pb_backupbuddy::alert( 'Errors were encountered: ' . implode( ', ', $errors ) . ' If seeking support please click to Show Advanced Details above and provide a copy of the log.' ); } return; }
$deployData = $deploy->getState(); $deployDataJson = json_encode( $deployData ); echo '<script>console.log("deployData (len: ' . strlen( $deployDataJson ) . '):"); console.dir(' . $deployDataJson . ');</script>';
$activePluginsA = ''; $i = 0; $x = count( $localInfo['activePlugins'] ); foreach( (array)$localInfo['activePlugins'] as $localPlugin ) { $i++; $activePluginsA .= $localPlugin['name'] . ' v' . $localPlugin['version']; if ( $x > $i ) { $activePluginsA .= ', '; } }
$activePluginsB = ''; $i = 0; $x = count( $deployData['remoteInfo']['activePlugins'] ); foreach( (array)$deployData['remoteInfo']['activePlugins'] as $remotePlugin ) { $i++; $activePluginsB .= $remotePlugin['name'] . ' v' . $remotePlugin['version']; if ( $x > $i ) { $activePluginsB .= ', '; } } $activePluginsB .= ' (' . count( $deployData['pushPluginFiles'] ) . ' files to send)';
if ( $deployData['remoteInfo']['activeTheme'] == $localInfo['activeTheme'] ) { $activeThemeBInfo = ' ' . count( $deployData['pushThemeFiles'] ) . ' files to send'; } else { $activeThemeBInfo = ' (' . __( 'Active theme differs so not updating.', 'it-l10n-backupbuddy' ) . ')'; }
?> <br><br>
<span id="backupbuddy_deploy_direction" data-direction=""></span> <span id="backupbuddy_deploy_prefixA" data-prefix="<?php echo $localInfo['dbPrefix']; ?>"></span> <span id="backupbuddy_deploy_prefixB" data-prefix="<?php echo $deployData['remoteInfo']['dbPrefix']; ?>"></span>
<div id="deploy-push-wrap" style="display: none;"> <?php require_once( '_push.php' ); ?> </div>
<div id="deploy-pull-wrap" style="display: none;"> <?php require_once( '_pull.php' ); ?> </div>
<?php // Handles thickbox auto-resizing. Keep at bottom of page to avoid issues. if ( !wp_script_is( 'media-upload' ) ) { wp_enqueue_script( 'media-upload' ); wp_print_scripts( 'media-upload' ); }
|