mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 22:14:33 +00:00
Move WebDAV derivative test source to Piwigo upload area
This commit is contained in:
@@ -54,7 +54,7 @@ function bratonien_tools_webdav_derivative_test_source_info($image_id, array $im
|
|||||||
$resolved = realpath($absolute);
|
$resolved = realpath($absolute);
|
||||||
if ($resolved === false) return null;
|
if ($resolved === false) return null;
|
||||||
|
|
||||||
$normalized = str_replace('\\\\', '/', $resolved);
|
$normalized = str_replace('\\', '/', $resolved);
|
||||||
if (!preg_match('#/nc-webdav-source/connection-([0-9]+)/root-([0-9]+)/(.*)$#', $normalized, $match))
|
if (!preg_match('#/nc-webdav-source/connection-([0-9]+)/root-([0-9]+)/(.*)$#', $normalized, $match))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -300,7 +300,8 @@ if (!$source)
|
|||||||
bratonien_tools_webdav_derivative_test_abort(404, 'Keine WebDAV-Quelle fuer dieses Bild gefunden.');
|
bratonien_tools_webdav_derivative_test_abort(404, 'Keine WebDAV-Quelle fuer dieses Bild gefunden.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$test_rel_dir = trim(PWG_DERIVATIVE_DIR, '/').'/bratonien-webdav-test';
|
$upload_dir = rtrim((string)($GLOBALS['conf']['upload_dir'] ?? './upload'), '/');
|
||||||
|
$test_rel_dir = $upload_dir.'/bratonien-webdav-test';
|
||||||
$test_root = PHPWG_ROOT_PATH.$test_rel_dir;
|
$test_root = PHPWG_ROOT_PATH.$test_rel_dir;
|
||||||
if (!is_dir($test_root) && !@mkdir($test_root, 0755, true))
|
if (!is_dir($test_root) && !@mkdir($test_root, 0755, true))
|
||||||
{
|
{
|
||||||
@@ -328,7 +329,7 @@ if (!in_array($extension, array('jpg', 'jpeg', 'png', 'gif', 'webp'), true))
|
|||||||
$token = getmypid().'-'.bin2hex(random_bytes(6));
|
$token = getmypid().'-'.bin2hex(random_bytes(6));
|
||||||
$source_filename = 'source-'.$image_id.'-'.$token.'.'.$extension;
|
$source_filename = 'source-'.$image_id.'-'.$token.'.'.$extension;
|
||||||
$source_path = $test_root.'/'.$source_filename;
|
$source_path = $test_root.'/'.$source_filename;
|
||||||
$source_rel = './'.$test_rel_dir.'/'.$source_filename;
|
$source_rel = $test_rel_dir.'/'.$source_filename;
|
||||||
$temp_image_id = 0;
|
$temp_image_id = 0;
|
||||||
$derivative_path = '';
|
$derivative_path = '';
|
||||||
$cleaned = false;
|
$cleaned = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user