mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Sort backups by date, newest first (Bug #14818)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9416 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
80c597fadf
commit
6d601d3bfc
2 changed files with 53 additions and 42 deletions
|
@ -132,6 +132,7 @@
|
||||||
<li>[Fix] Add indicator to be used in code if session was created (user visits the site for the first time).</li>
|
<li>[Fix] Add indicator to be used in code if session was created (user visits the site for the first time).</li>
|
||||||
<li>[Fix] Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445)</li>
|
<li>[Fix] Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445)</li>
|
||||||
<li>[Fix] Fix bug in postgresql db layer for LIMIT ALL clauses (reported by JRSweets)</li>
|
<li>[Fix] Fix bug in postgresql db layer for LIMIT ALL clauses (reported by JRSweets)</li>
|
||||||
|
<li>[Fix] Sort backups by date, newest first (Bug #14818)</li>
|
||||||
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
|
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
|
||||||
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
|
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
|
||||||
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
|
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>
|
||||||
|
|
|
@ -27,7 +27,7 @@ class acp_database
|
||||||
{
|
{
|
||||||
global $cache, $db, $user, $auth, $template, $table_prefix;
|
global $cache, $db, $user, $auth, $template, $table_prefix;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
$user->add_lang('acp/database');
|
$user->add_lang('acp/database');
|
||||||
|
|
||||||
$this->tpl_name = 'acp_database';
|
$this->tpl_name = 'acp_database';
|
||||||
|
@ -187,7 +187,7 @@ class acp_database
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'U_ACTION' => $this->u_action . '&action=download'
|
'U_ACTION' => $this->u_action . '&action=download'
|
||||||
));
|
));
|
||||||
|
|
||||||
$available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2');
|
$available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2');
|
||||||
|
|
||||||
foreach ($available_methods as $type => $module)
|
foreach ($available_methods as $type => $module)
|
||||||
|
@ -424,27 +424,37 @@ class acp_database
|
||||||
$dir = $phpbb_root_path . 'store/';
|
$dir = $phpbb_root_path . 'store/';
|
||||||
$dh = @opendir($dir);
|
$dh = @opendir($dir);
|
||||||
|
|
||||||
|
$backup_files = array();
|
||||||
|
|
||||||
if ($dh)
|
if ($dh)
|
||||||
{
|
{
|
||||||
while (($file = readdir($dh)) !== false)
|
while (($file = readdir($dh)) !== false)
|
||||||
{
|
{
|
||||||
if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
|
if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
|
||||||
{
|
{
|
||||||
$supported = in_array($matches[2], $methods);
|
if (in_array($matches[2], $methods))
|
||||||
|
|
||||||
if ($supported == 'true')
|
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('files', array(
|
$backup_files[gmdate("d-m-Y H:i:s", $matches[1])] = $file;
|
||||||
'FILE' => $file,
|
|
||||||
'NAME' => gmdate("d-m-Y H:i:s", $matches[1]),
|
|
||||||
'SUPPORTED' => $supported
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($backup_files))
|
||||||
|
{
|
||||||
|
krsort($backup_files);
|
||||||
|
|
||||||
|
foreach ($backup_files as $name => $file)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('files', array(
|
||||||
|
'FILE' => $file,
|
||||||
|
'NAME' => $name,
|
||||||
|
'SUPPORTED' => true,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'U_ACTION' => $this->u_action . '&action=submit'
|
'U_ACTION' => $this->u_action . '&action=submit'
|
||||||
));
|
));
|
||||||
|
@ -508,7 +518,7 @@ class base_extractor
|
||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
header("Content-Type: $mimetype; name=\"$name\"");
|
header("Content-Type: $mimetype; name=\"$name\"");
|
||||||
header("Content-disposition: attachment; filename=$name");
|
header("Content-disposition: attachment; filename=$name");
|
||||||
|
|
||||||
switch ($format)
|
switch ($format)
|
||||||
{
|
{
|
||||||
case 'bzip2':
|
case 'bzip2':
|
||||||
|
@ -527,14 +537,14 @@ class base_extractor
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($store == true)
|
if ($store == true)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
$file = $phpbb_root_path . 'store/' . $filename . $ext;
|
$file = $phpbb_root_path . 'store/' . $filename . $ext;
|
||||||
|
|
||||||
$this->fp = $open($file, 'w');
|
$this->fp = $open($file, 'w');
|
||||||
|
|
||||||
if (!$this->fp)
|
if (!$this->fp)
|
||||||
{
|
{
|
||||||
trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
|
trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
|
||||||
|
@ -662,11 +672,11 @@ class mysql_extractor extends base_extractor
|
||||||
if ($result != false)
|
if ($result != false)
|
||||||
{
|
{
|
||||||
$fields_cnt = mysqli_num_fields($result);
|
$fields_cnt = mysqli_num_fields($result);
|
||||||
|
|
||||||
// Get field information
|
// Get field information
|
||||||
$field = mysqli_fetch_fields($result);
|
$field = mysqli_fetch_fields($result);
|
||||||
$field_set = array();
|
$field_set = array();
|
||||||
|
|
||||||
for ($j = 0; $j < $fields_cnt; $j++)
|
for ($j = 0; $j < $fields_cnt; $j++)
|
||||||
{
|
{
|
||||||
$field_set[] = $field[$j]->name;
|
$field_set[] = $field[$j]->name;
|
||||||
|
@ -679,7 +689,7 @@ class mysql_extractor extends base_extractor
|
||||||
$first_set = true;
|
$first_set = true;
|
||||||
$query_len = 0;
|
$query_len = 0;
|
||||||
$max_len = get_usable_memory();
|
$max_len = get_usable_memory();
|
||||||
|
|
||||||
while ($row = mysqli_fetch_row($result))
|
while ($row = mysqli_fetch_row($result))
|
||||||
{
|
{
|
||||||
$values = array();
|
$values = array();
|
||||||
|
@ -750,7 +760,7 @@ class mysql_extractor extends base_extractor
|
||||||
$field[] = mysql_fetch_field($result, $i);
|
$field[] = mysql_fetch_field($result, $i);
|
||||||
}
|
}
|
||||||
$field_set = array();
|
$field_set = array();
|
||||||
|
|
||||||
for ($j = 0; $j < $fields_cnt; $j++)
|
for ($j = 0; $j < $fields_cnt; $j++)
|
||||||
{
|
{
|
||||||
$field_set[] = $field[$j]->name;
|
$field_set[] = $field[$j]->name;
|
||||||
|
@ -966,7 +976,7 @@ class sqlite_extractor extends base_extractor
|
||||||
$ar[] = $row;
|
$ar[] = $row;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
foreach ($ar as $value)
|
foreach ($ar as $value)
|
||||||
{
|
{
|
||||||
if (strpos($value['name'], 'autoindex') !== false)
|
if (strpos($value['name'], 'autoindex') !== false)
|
||||||
|
@ -1124,7 +1134,7 @@ class postgres_extractor extends base_extractor
|
||||||
$sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
|
$sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n";
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
|
$field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
|
||||||
FROM pg_class c, pg_attribute a, pg_type t
|
FROM pg_class c, pg_attribute a, pg_type t
|
||||||
WHERE c.relname = '" . $db->sql_escape($table_name) . "'
|
WHERE c.relname = '" . $db->sql_escape($table_name) . "'
|
||||||
|
@ -1188,7 +1198,7 @@ class postgres_extractor extends base_extractor
|
||||||
{
|
{
|
||||||
$line .= ' NOT NULL';
|
$line .= ' NOT NULL';
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines[] = $line;
|
$lines[] = $line;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -1388,33 +1398,33 @@ class mssql_extractor extends base_extractor
|
||||||
$sql_data .= "GO\n";
|
$sql_data .= "GO\n";
|
||||||
$sql_data .= "\nCREATE TABLE [$table_name] (\n";
|
$sql_data .= "\nCREATE TABLE [$table_name] (\n";
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
$text_flag = false;
|
$text_flag = false;
|
||||||
|
|
||||||
$sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
|
$sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
WHERE TABLE_NAME = '$table_name'";
|
WHERE TABLE_NAME = '$table_name'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
|
$line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
|
||||||
|
|
||||||
if ($row['DATA_TYPE'] == 'text')
|
if ($row['DATA_TYPE'] == 'text')
|
||||||
{
|
{
|
||||||
$text_flag = true;
|
$text_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['IS_IDENTITY'])
|
if ($row['IS_IDENTITY'])
|
||||||
{
|
{
|
||||||
$line .= ' IDENTITY (1 , 1)';
|
$line .= ' IDENTITY (1 , 1)';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
|
if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
|
||||||
{
|
{
|
||||||
$line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
|
$line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['IS_NULLABLE'] == 'YES')
|
if ($row['IS_NULLABLE'] == 'YES')
|
||||||
{
|
{
|
||||||
$line .= ' NULL';
|
$line .= ' NULL';
|
||||||
|
@ -1423,27 +1433,27 @@ class mssql_extractor extends base_extractor
|
||||||
{
|
{
|
||||||
$line .= ' NOT NULL';
|
$line .= ' NOT NULL';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['COLUMN_DEFAULT'])
|
if ($row['COLUMN_DEFAULT'])
|
||||||
{
|
{
|
||||||
$line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
|
$line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows[] = $line;
|
$rows[] = $line;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$sql_data .= implode(",\n", $rows);
|
$sql_data .= implode(",\n", $rows);
|
||||||
$sql_data .= "\n) ON [PRIMARY]";
|
$sql_data .= "\n) ON [PRIMARY]";
|
||||||
|
|
||||||
if ($text_flag)
|
if ($text_flag)
|
||||||
{
|
{
|
||||||
$sql_data .= " TEXTIMAGE_ON [PRIMARY]";
|
$sql_data .= " TEXTIMAGE_ON [PRIMARY]";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_data .= "\nGO\n\n";
|
$sql_data .= "\nGO\n\n";
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
|
$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
|
||||||
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||||
WHERE TABLE_NAME = '$table_name'";
|
WHERE TABLE_NAME = '$table_name'";
|
||||||
|
@ -1463,7 +1473,7 @@ class mssql_extractor extends base_extractor
|
||||||
$sql_data .= "\n\t) ON [PRIMARY] \nGO\n";
|
$sql_data .= "\n\t) ON [PRIMARY] \nGO\n";
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$index = array();
|
$index = array();
|
||||||
$sql = "EXEC sp_statistics '$table_name'";
|
$sql = "EXEC sp_statistics '$table_name'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -1475,12 +1485,12 @@ class mssql_extractor extends base_extractor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
foreach ($index as $index_name => $column_name)
|
foreach ($index as $index_name => $column_name)
|
||||||
{
|
{
|
||||||
$index[$index_name] = implode(', ', $column_name);
|
$index[$index_name] = implode(', ', $column_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($index as $index_name => $columns)
|
foreach ($index as $index_name => $columns)
|
||||||
{
|
{
|
||||||
$sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
|
$sql_data .= "\nCREATE INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n";
|
||||||
|
@ -1508,7 +1518,7 @@ class mssql_extractor extends base_extractor
|
||||||
$ary_type = $ary_name = array();
|
$ary_type = $ary_name = array();
|
||||||
$ident_set = false;
|
$ident_set = false;
|
||||||
$sql_data = '';
|
$sql_data = '';
|
||||||
|
|
||||||
// Grab all of the data from current table.
|
// Grab all of the data from current table.
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM $table_name";
|
FROM $table_name";
|
||||||
|
@ -1602,7 +1612,7 @@ class mssql_extractor extends base_extractor
|
||||||
$ary_type = $ary_name = array();
|
$ary_type = $ary_name = array();
|
||||||
$ident_set = false;
|
$ident_set = false;
|
||||||
$sql_data = '';
|
$sql_data = '';
|
||||||
|
|
||||||
// Grab all of the data from current table.
|
// Grab all of the data from current table.
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM $table_name";
|
FROM $table_name";
|
||||||
|
@ -1819,7 +1829,7 @@ class oracle_extractor extends base_extractor
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
$ary_type = $ary_name = array();
|
$ary_type = $ary_name = array();
|
||||||
|
|
||||||
// Grab all of the data from current table.
|
// Grab all of the data from current table.
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM $table_name";
|
FROM $table_name";
|
||||||
|
@ -1915,7 +1925,7 @@ class firebird_extractor extends base_extractor
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
$ary_type = $ary_name = array();
|
$ary_type = $ary_name = array();
|
||||||
|
|
||||||
// Grab all of the data from current table.
|
// Grab all of the data from current table.
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM $table_name";
|
FROM $table_name";
|
||||||
|
@ -2244,7 +2254,7 @@ function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192)
|
||||||
{
|
{
|
||||||
$record = '';
|
$record = '';
|
||||||
$delim_len = strlen($delim);
|
$delim_len = strlen($delim);
|
||||||
|
|
||||||
while (!$eof($fp))
|
while (!$eof($fp))
|
||||||
{
|
{
|
||||||
$pos = strpos($record, $delim);
|
$pos = strpos($record, $delim);
|
||||||
|
|
Loading…
Add table
Reference in a new issue