mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-15 14:16:28 +02:00
[ticket/15342] Use track_rename when renaming files
PHPBB3-15342
This commit is contained in:
@ -163,8 +163,7 @@ class storage
|
|||||||
public function rename($path_orig, $path_dest)
|
public function rename($path_orig, $path_dest)
|
||||||
{
|
{
|
||||||
$this->get_adapter()->rename($path_orig, $path_dest);
|
$this->get_adapter()->rename($path_orig, $path_dest);
|
||||||
$this->untrack_file($path_orig);
|
$this->track_rename($path_orig, $path_dest);
|
||||||
$this->track_file($path_dest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -296,6 +295,20 @@ class storage
|
|||||||
$this->cache->destroy('_storage_' . $this->get_name() . '_numfiles');
|
$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.
|
* Get file info.
|
||||||
*
|
*
|
||||||
@ -345,7 +358,7 @@ class storage
|
|||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $total_size;
|
return (int) $total_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user