Vergleich admin/modules/tools/backupdb.php - 1.8.5 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 14Zeile 14
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


// Allows us to refresh cache to prevent over flowing






/**
* Allows us to refresh cache to prevent over flowing
*
* @param resource $fp
* @param string $contents
*/

function clear_overflow($fp, &$contents)
{
global $mybb;

function clear_overflow($fp, &$contents)
{
global $mybb;

Zeile 72Zeile 77
		header('Content-disposition: attachment; filename='.$file);
header("Content-type: ".$ext);
header("Content-length: ".filesize(MYBB_ADMIN_DIR.'backups/'.$file));

		header('Content-disposition: attachment; filename='.$file);
header("Content-type: ".$ext);
header("Content-length: ".filesize(MYBB_ADMIN_DIR.'backups/'.$file));

		echo file_get_contents(MYBB_ADMIN_DIR.'backups/'.$file);








$handle = fopen(MYBB_ADMIN_DIR.'backups/'.$file, 'rb');
while(!feof($handle))
{
echo fread($handle, 8192);
}
fclose($handle);

	}
else

	}
else

	{

	{

		flash_message($lang->error_invalid_backup, 'error');

		flash_message($lang->error_invalid_backup, 'error');

		admin_redirect("index.php?module=tools-backupdb");
}

		admin_redirect("index.php?module=tools-backupdb");
}

}

if($mybb->input['action'] == "delete")
{

}

if($mybb->input['action'] == "delete")
{

	if($mybb->input['no'])
{

	if($mybb->get_input('no'))
{

		admin_redirect("index.php?module=tools-backupdb");
}

		admin_redirect("index.php?module=tools-backupdb");
}





	$file = basename($mybb->input['file']);

if(!trim($mybb->input['file']) || !file_exists(MYBB_ADMIN_DIR.'backups/'.$file))
{
flash_message($lang->error_backup_doesnt_exist, 'error');
admin_redirect("index.php?module=tools-backupdb");

	$file = basename($mybb->input['file']);

if(!trim($mybb->input['file']) || !file_exists(MYBB_ADMIN_DIR.'backups/'.$file))
{
flash_message($lang->error_backup_doesnt_exist, 'error');
admin_redirect("index.php?module=tools-backupdb");

	}


	}


	$plugins->run_hooks("admin_tools_backupdb_delete");

if($mybb->request_method == "post")
{
$delete = @unlink(MYBB_ADMIN_DIR.'backups/'.$file);

	$plugins->run_hooks("admin_tools_backupdb_delete");

if($mybb->request_method == "post")
{
$delete = @unlink(MYBB_ADMIN_DIR.'backups/'.$file);





		if($delete)

		if($delete)

		{

		{

			$plugins->run_hooks("admin_tools_backupdb_delete_commit");

// Log admin action

			$plugins->run_hooks("admin_tools_backupdb_delete_commit");

// Log admin action

Zeile 116Zeile 127
		{
flash_message($lang->error_backup_not_deleted, 'error');
admin_redirect("index.php?module=tools-backupdb");

		{
flash_message($lang->error_backup_not_deleted, 'error');
admin_redirect("index.php?module=tools-backupdb");

		}

		}

	}
else
{

	}
else
{

Zeile 130Zeile 141

if($mybb->request_method == "post")
{


if($mybb->request_method == "post")
{

		if(!is_array($mybb->input['tables']))

		if(empty($mybb->input['tables']) || !is_array($mybb->input['tables']))

		{
flash_message($lang->error_tables_not_selected, 'error');
admin_redirect("index.php?module=tools-backupdb&action=backup");

		{
flash_message($lang->error_tables_not_selected, 'error');
admin_redirect("index.php?module=tools-backupdb&action=backup");

Zeile 169Zeile 180
				}

// Send headers for gzip file

				}

// Send headers for gzip file

				header('Content-Encoding: gzip');

 
				header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="'.$file.'.sql.gz"');
}

				header('Content-Type: application/x-gzip');
header('Content-Disposition: attachment; filename="'.$file.'.sql.gz"');
}

Zeile 181Zeile 191
			}
}
$db->set_table_prefix('');

			}
}
$db->set_table_prefix('');





		$time = date('dS F Y \a\t H:i', TIME_NOW);
$header = "-- MyBB Database Backup\n-- Generated: {$time}\n-- -------------------------------------\n\n";
$contents = $header;

		$time = date('dS F Y \a\t H:i', TIME_NOW);
$header = "-- MyBB Database Backup\n-- Generated: {$time}\n-- -------------------------------------\n\n";
$contents = $header;

Zeile 192Zeile 202
				continue;
}
if($mybb->input['analyzeoptimize'] == 1)

				continue;
}
if($mybb->input['analyzeoptimize'] == 1)

			{

			{

				$db->optimize_table($table);
$db->analyze_table($table);
}

				$db->optimize_table($table);
$db->analyze_table($table);
}

Zeile 202Zeile 212
			foreach($fields_array as $field)
{
$field_list[] = $field['Field'];

			foreach($fields_array as $field)
{
$field_list[] = $field['Field'];

			}


			}


			$fields = "`".implode("`,`", $field_list)."`";
if($mybb->input['contents'] != 'data')
{
$structure = $db->show_create_table($table).";\n";
$contents .= $structure;

			$fields = "`".implode("`,`", $field_list)."`";
if($mybb->input['contents'] != 'data')
{
$structure = $db->show_create_table($table).";\n";
$contents .= $structure;

				clear_overflow($fp, $contents);






if(isset($fp))
{
clear_overflow($fp, $contents);
}

			}

if($mybb->input['contents'] != 'structure')

			}

if($mybb->input['contents'] != 'structure')

Zeile 245Zeile 259
					}
$insert .= ");\n";
$contents .= $insert;

					}
$insert .= ");\n";
$contents .= $insert;

					clear_overflow($fp, $contents);






if(isset($fp))
{
clear_overflow($fp, $contents);
}

				}
$db->free_result($query);
}

				}
$db->free_result($query);
}