1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/15311] Use storage in backups

PHPBB3-15311
This commit is contained in:
Rubén Calvo
2017-08-09 18:56:35 +02:00
parent 1b11013988
commit fb716743d2
9 changed files with 207 additions and 68 deletions

View File

@@ -21,10 +21,6 @@ use phpbb\db\extractor\exception\extractor_not_initialized_exception;
*/
abstract class base_extractor implements extractor_interface
{
/**
* @var string phpBB root path
*/
protected $phpbb_root_path;
/**
* @var \phpbb\request\request_interface
@@ -84,13 +80,11 @@ abstract class base_extractor implements extractor_interface
/**
* Constructor
*
* @param string $phpbb_root_path
* @param \phpbb\request\request_interface $request
* @param \phpbb\db\driver\driver_interface $db
*/
public function __construct($phpbb_root_path, \phpbb\request\request_interface $request, \phpbb\db\driver\driver_interface $db)
public function __construct(\phpbb\request\request_interface $request, \phpbb\db\driver\driver_interface $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->request = $request;
$this->db = $db;
$this->fp = null;
@@ -164,13 +158,13 @@ abstract class base_extractor implements extractor_interface
if ($store === true)
{
$file = $this->phpbb_root_path . 'store/' . $filename . $ext;
$file = sys_get_temp_dir() . '/' . $filename . $ext;
$this->fp = $open($file, 'w');
if (!$this->fp)
{
trigger_error('FILE_WRITE_FAIL', E_USER_ERROR);
throw new \phpbb\exception\runtime_exception('FILE_WRITE_FAIL');
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\migration\data\v330;
class storage_backup extends \phpbb\db\migration\migration
{
public function update_schema()
{
return array(
'add_tables' => array(
$this->table_prefix . 'backups' => array(
'COLUMNS' => array(
'backup_id' => array('UINT', NULL, 'auto_increment'),
'filename' => array('VCHAR', ''),
),
'PRIMARY_KEY' => 'backup_id',
),
),
);
}
public function update_data()
{
return array(
array('config.add', array('storage\\backup\\provider', \phpbb\storage\provider\local::class)),
array('config.add', array('storage\\backup\\config\\path', 'store')),
);
}
}