forked from GithubBackups/vichan
pages.php: add copy fallback in case of already existing file when moving thread.
This commit is contained in:
parent
5ee48c5865
commit
1191dfb193
@ -10,6 +10,14 @@ use Vichan\Functions\Net;
|
|||||||
defined('TINYBOARD') or exit;
|
defined('TINYBOARD') or exit;
|
||||||
|
|
||||||
|
|
||||||
|
function _link_or_copy(string $target, string $link): bool {
|
||||||
|
if (!link($target, $link)) {
|
||||||
|
error_log("Failed to link() $target to $link. Falling back to copy()");
|
||||||
|
return copy($target, $link);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function mod_page($title, $template, $args, $subtitle = false) {
|
function mod_page($title, $template, $args, $subtitle = false) {
|
||||||
global $config, $mod;
|
global $config, $mod;
|
||||||
|
|
||||||
@ -1348,7 +1356,7 @@ function mod_move(Context $ctx, $originBoard, $postID) {
|
|||||||
error(_('Target and source board are the same.'));
|
error(_('Target and source board are the same.'));
|
||||||
|
|
||||||
// link() if leaving a shadow thread behind; else, rename().
|
// link() if leaving a shadow thread behind; else, rename().
|
||||||
$clone = $shadow ? 'link' : 'rename';
|
$clone = $shadow ? '_link_or_copy' : 'rename';
|
||||||
|
|
||||||
// indicate that the post is a thread
|
// indicate that the post is a thread
|
||||||
$post['op'] = true;
|
$post['op'] = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user