mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/15342] Track current uploaded files
PHPBB3-15342
This commit is contained in:
parent
cc7178a6e0
commit
b823ae85cf
1 changed files with 40 additions and 1 deletions
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v330;
|
namespace phpbb\db\migration\data\v330;
|
||||||
|
|
||||||
|
use phpbb\storage\storage;
|
||||||
|
|
||||||
class storage_track extends \phpbb\db\migration\migration
|
class storage_track extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
|
@ -28,7 +30,7 @@ class storage_track extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'add_tables' => array(
|
'add_tables' => array(
|
||||||
$this->table_prefix . 'storage' => array(
|
STORAGE_TABLE => array(
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'file_id' => array('UINT', null, 'auto_increment'),
|
'file_id' => array('UINT', null, 'auto_increment'),
|
||||||
'file_path' => array('VCHAR', ''),
|
'file_path' => array('VCHAR', ''),
|
||||||
|
@ -61,16 +63,53 @@ class storage_track extends \phpbb\db\migration\migration
|
||||||
|
|
||||||
public function track_avatars()
|
public function track_avatars()
|
||||||
{
|
{
|
||||||
|
/** @var storage $storage */
|
||||||
|
$storage = $this->container->get('storage.avatar');
|
||||||
|
|
||||||
|
$sql = 'SELECT user_avatar
|
||||||
|
FROM ' . USERS_TABLE . "
|
||||||
|
WHERE user_avatar_type = 'avatar.driver.upload'";
|
||||||
|
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$storage->track_file($row['user_avatar']);
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function track_attachments()
|
public function track_attachments()
|
||||||
{
|
{
|
||||||
|
/** @var storage $storage */
|
||||||
|
$storage = $this->container->get('storage.attachment');
|
||||||
|
|
||||||
|
$sql = 'SELECT physical_filename
|
||||||
|
FROM ' . ATTACHMENTS_TABLE;
|
||||||
|
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$storage->track_file($row['physical_filename']);
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function track_backups()
|
public function track_backups()
|
||||||
{
|
{
|
||||||
|
/** @var storage $storage */
|
||||||
|
$storage = $this->container->get('storage.backup');
|
||||||
|
|
||||||
|
$sql = 'SELECT filename
|
||||||
|
FROM ' . BACKUPS_TABLE;
|
||||||
|
|
||||||
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$storage->track_file($row['filename']);
|
||||||
|
}
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue