Projekt

Allgemein

Profil

GX-Bug #60732 » Bugfixing_DBBackup.patch

Timo Backhaus, 11.01.2019 04:40

Unterschiede anzeigen:

src/admin/javascript/legacy/db_backup/db_backup_create.js (date 1547173077005)
1 1
/* db_backup_create.js <?php
2 2
#   --------------------------------------------------------------
3
#   db_backup_create.js 2014-01-03 tb@gambio
3
#   db_backup_create.js 2019-01-11 gambio
4 4
#   Gambio GmbH
5 5
#   http://www.gambio.de
6
#   Copyright (c) 2014 Gambio GmbH
6
#   Copyright (c) 2019 Gambio GmbH
7 7
#   Released under the GNU General Public License (Version 2)
8 8
#   [http://www.gnu.org/licenses/gpl-2.0.html]
9 9
#   --------------------------------------------------------------
......
26 26
		timeout:	30000,
27 27
		context:	this,
28 28
		success:	function( p_response )
29
					{
30
						create_backup();
31
					},
29
		{
30
			create_backup();
31
		},
32 32
		error:		function( p_jqXHR, p_exception )
33
					{
34
						reset();
35
					}
33
		{
34
			reset();
35
		}
36 36
	});
37 37
}
38 38

  
......
41 41
	$.ajax({
42 42
		type:		"GET",
43 43
		url:		"request_port.php?module=DBBackup&action=create_db_backup&page_token=" + jse.core.config.get('pageToken'),
44
		timeout:	30000,
44
		timeout:	300000,
45 45
		context:	this,
46 46
		success:	function( p_response )
47
					{
48
						if( $.type( p_response ) == "object" && ( p_response.status == "continue_backup" || p_response.status == "backup_done" ) )
49
						{
50
							$( ".progress_text", t_lightbox_package ).html( p_response.progress + "%" );
51
							$( ".progress_job", t_lightbox_package ).html( p_response.job );
52
							$( ".progress_marker", t_lightbox_package ).width( p_response.progress + "%" );
53
							if( p_response.status == "continue_backup" )
54
							{
55
								create_backup();
56
							}
57
							else if( p_response.status == "backup_done" )
58
							{
59
								bundle_backup( 'zip' );
60
							}	
61
						}
62
						else
63
						{
64
							if( $.type( p_response ) == "object" )
65
							{
66
								var t_error = p_response.error_message;
67
								if( $.trim( t_error ) == "" )
68
								{
69
									t_error = "Unbekannter Fehler!";
70
								}
71
								reset_backup( t_error );
72
							}
73
							else
74
							{
75
								reset_backup( p_response );
76
							}
77
						}
78
										
79
					},
47
		{
48
			if( $.type( p_response ) == "object" && ( p_response.status == "continue_backup" || p_response.status == "backup_done" ) )
49
			{
50
				$( ".progress_text", t_lightbox_package ).html( p_response.progress + "%" );
51
				$( ".progress_job", t_lightbox_package ).html( p_response.job );
52
				$( ".progress_marker", t_lightbox_package ).width( p_response.progress + "%" );
53
				if( p_response.status == "continue_backup" )
54
				{
55
					create_backup();
56
				}
57
				else if( p_response.status == "backup_done" )
58
				{
59
					bundle_backup( 'zip' );
60
				}
61
			}
62
			else
63
			{
64
				if( $.type( p_response ) == "object" )
65
				{
66
					var t_error = p_response.error_message;
67
					if( $.trim( t_error ) == "" )
68
					{
69
						t_error = "Unbekannter Fehler!";
70
					}
71
					reset_backup( t_error );
72
				}
73
				else
74
				{
75
					reset_backup( p_response );
76
				}
77
			}
78
			
79
		},
80 80
		error:		function( p_jqXHR, p_exception )
81
					{
82
						reset_backup( "Unbekannter Fehler!" );
83
					}
81
		{
82
			reset_backup( "Unbekannter Fehler!" );
83
		}
84 84
	});
85 85
}
86 86

  
......
90 90
	$.ajax({
91 91
		type:		"GET",
92 92
		url:		"request_port.php?module=DBBackup&action=bundle_db_backup&bundle_type=" + c_bundle_type + "&page_token=" + jse.core.config.get('pageToken'),
93
		timeout:	30000,
93
		timeout:	300000,
94 94
		context:	this,
95 95
		success:	function( p_response )
96
					{
97
						if( $.type( p_response ) != "object" || p_response.status == "error" )
98
						{
99
							if( c_bundle_type == 'zip' )
100
							{
101
								$( ".progress_marker", t_lightbox_package ).width( "97%" );
102
								$( ".progress_text", t_lightbox_package ).html( "97%" );
103
								bundle_backup( 'gzip' );
104
							}
105
							else if( c_bundle_type == 'gzip' )
106
							{
107
								$( ".progress_marker", t_lightbox_package ).width( "98%" );
108
								$( ".progress_text", t_lightbox_package ).html( "98%" );
109
								bundle_backup( 'sql' );
110
							}
111
							else if( c_bundle_type == 'sql' && $.type( p_response ) != "object" )
112
							{
113
								reset_backup( p_response );
114
							}
115
							else if( c_bundle_type == 'sql' && $.type( p_response ) == "object" )
116
							{
117
								reset_backup( p_response.error_message );
118
							}
119
						}
120
						else if( p_response.status == "success" )
121
						{
122
							$( ".progress_marker", t_lightbox_package ).width( "99%" );
123
							$( ".progress_text", t_lightbox_package ).html( "99%" );
124
							$( ".progress_job", t_lightbox_package ).html( p_response.job );
125
							reset_backup();
126
						}					
127
					},
96
		{
97
			if( $.type( p_response ) != "object" || p_response.status == "error" )
98
			{
99
				if( c_bundle_type == 'zip' )
100
				{
101
					$( ".progress_marker", t_lightbox_package ).width( "98%" );
102
					$( ".progress_text", t_lightbox_package ).html( "98%" );
103
					bundle_backup( 'gzip' );
104
				}
105
				else if( c_bundle_type == 'gzip' )
106
				{
107
					$( ".progress_marker", t_lightbox_package ).width( "99%" );
108
					$( ".progress_text", t_lightbox_package ).html( "99%" );
109
					bundle_backup( 'sql' );
110
				}
111
				else if( c_bundle_type == 'sql' && $.type( p_response ) != "object" )
112
				{
113
					reset_backup( p_response );
114
				}
115
				else if( c_bundle_type == 'sql' && $.type( p_response ) == "object" )
116
				{
117
					reset_backup( p_response.error_message );
118
				}
119
			}
120
			else if( p_response.status == "success" )
121
			{
122
				$( ".progress_marker", t_lightbox_package ).width( "99%" );
123
				$( ".progress_text", t_lightbox_package ).html( "99%" );
124
				$( ".progress_job", t_lightbox_package ).html( p_response.job );
125
				reset_backup();
126
			}
127
		},
128 128
		error:		function( p_jqXHR, p_exception )
129
					{
130
						reset_backup( "Unbekannter Fehler!" );
131
					}
129
		{
130
			reset_backup( "Unbekannter Fehler!" );
131
		}
132 132
	});
133 133
}
134 134

  
......
145 145
		timeout:	30000,
146 146
		context:	this,
147 147
		success:	function( p_response )
148
					{
149
						if( c_error == false )
150
						{
151
							$( ".progress_job", t_lightbox_package ).html( p_response.job );
152
							$( "#db_backup_wrapper" ).html( p_response.html );
153
							$( ".progress_marker", t_lightbox_package ).width( "100%" );
154
							$( ".progress_text", t_lightbox_package ).html( "100%" );
155
						}
156
						else
157
						{
158
							$( ".db_backup_lightbox_error_message", t_lightbox_package ).html( c_error ).show();
159
							$( ".db_backup_lightbox_process", t_lightbox_package ).hide();
160
						}
161
						$( ".button_right_container .lightbox_close", t_lightbox_package ).show();	
162
					},
148
		{
149
			if( c_error == false )
150
			{
151
				$( ".progress_job", t_lightbox_package ).html( p_response.job );
152
				$( "#db_backup_wrapper" ).html( p_response.html );
153
				$( ".progress_marker", t_lightbox_package ).width( "100%" );
154
				$( ".progress_text", t_lightbox_package ).html( "100%" );
155
			}
156
			else
157
			{
158
				$( ".db_backup_lightbox_error_message", t_lightbox_package ).html( c_error ).show();
159
				$( ".db_backup_lightbox_process", t_lightbox_package ).hide();
160
			}
161
			$( ".button_right_container .lightbox_close", t_lightbox_package ).show();
162
		},
163 163
		error:		function( p_jqXHR, p_exception )
164
					{
165
						reset_backup( c_error );
166
					}
164
		{
165
			reset_backup( c_error );
166
		}
167 167
	});
168 168
}
169 169

  
src/system/classes/db_backup/DBBackupAjaxHandler.inc.php (date 1547173101673)
1 1
<?php
2 2
/* --------------------------------------------------------------
3
   DBBackupAjaxHandler.inc.php 2017-12-18
3
   DBBackupAjaxHandler.inc.php 2019-01-11
4 4
   Gambio GmbH
5 5
   http://www.gambio.de
6
   Copyright (c) 2017 Gambio GmbH
6
   Copyright (c) 2019 Gambio GmbH
7 7
   Released under the GNU General Public License (Version 2)
8 8
   [http://www.gnu.org/licenses/gpl-2.0.html]
9 9
   --------------------------------------------------------------
......
148 148
							foreach( $t_files AS $t_file )
149 149
							{
150 150
								$t_old_sql_handle = fopen( $t_file, 'r' );
151
								while( !feof( $t_old_sql_handle ) )
152
								{
153
									fwrite( $t_new_sql_handle, fread( $t_old_sql_handle, 8192 ) );
154
								}
151
								stream_copy_to_stream($t_old_sql_handle, $t_new_sql_handle);
155 152
								fwrite( $t_new_sql_handle, "\n\n" );
153
                                fclose($t_old_sql_handle);
156 154
							}
155
							fclose($t_new_sql_handle);
157 156
							$c_response = array( 'status' => 'success', 'filename' => $t_new_sql_file );
158 157
						}
159 158
						else
src/system/classes/db_backup/DBBackupControl.inc.php (date 1547173114157)
1 1
<?php
2 2
/* --------------------------------------------------------------
3
   DBBackupControl.inc.php 2018-01-18
3
   DBBackupControl.inc.php 2019-11-01
4 4
   Gambio GmbH
5 5
   http://www.gambio.de
6
   Copyright (c) 2018 Gambio GmbH
6
   Copyright (c) 2019 Gambio GmbH
7 7
   Released under the GNU General Public License (Version 2)
8 8
   [http://www.gnu.org/licenses/gpl-2.0.html]
9 9
   --------------------------------------------------------------
......
167 167
					$t_db_export_session['offset'] = $t_offset;
168 168
					
169 169
					fwrite( $handle_export_session, serialize( $t_db_export_session ) );
170
					$t_progress = floor( $i / 100 );
171
					$t_progress = 10;
170
					$t_progress = floor( ($i / $t_tables_count)*100 );
172 171
					return array( 'status' => 'continue_backup', 'progress' => $t_progress );
173 172
				}
174 173
				// export table
    (1-1/1)