mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15342] Use track_rename when renaming files
PHPBB3-15342
This commit is contained in:
parent
db9daf1dea
commit
3ed63388b4
1 changed files with 16 additions and 3 deletions
|
@ -163,8 +163,7 @@ class storage
|
|||
public function rename($path_orig, $path_dest)
|
||||
{
|
||||
$this->get_adapter()->rename($path_orig, $path_dest);
|
||||
$this->untrack_file($path_orig);
|
||||
$this->track_file($path_dest);
|
||||
$this->track_rename($path_orig, $path_dest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,6 +295,20 @@ class storage
|
|||
$this->cache->destroy('_storage_' . $this->get_name() . '_numfiles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename tracked file.
|
||||
*
|
||||
* @param string $path_orig The original file/direcotry
|
||||
* @param string $path_dest The target file/directory
|
||||
*/
|
||||
protected function track_rename($path_orig, $path_dest)
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->storage_table . "
|
||||
SET file_path = '" . $path_dest . "'
|
||||
WHERE file_path = '" . $path_orig . "'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file info.
|
||||
*
|
||||
|
@ -345,7 +358,7 @@ class storage
|
|||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
return $total_size;
|
||||
return (int) $total_size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue