--- FileWidgetAjaxController-2615678-18.patch 2022-11-18 11:36:50.000000000 +0530 +++ 2615678-34.patch 2022-11-18 11:57:48.000000000 +0530 @@ -1,8 +1,8 @@ diff --git a/core/modules/file/src/Controller/FileWidgetAjaxController.php b/core/modules/file/src/Controller/FileWidgetAjaxController.php -index ef09a79..3e45c80 100644 +index 474beb0dda..154a5fe73a 100644 --- a/core/modules/file/src/Controller/FileWidgetAjaxController.php +++ b/core/modules/file/src/Controller/FileWidgetAjaxController.php -@@ -15,34 +15,70 @@ +@@ -10,27 +10,69 @@ class FileWidgetAjaxController { /** @@ -39,7 +39,6 @@ + * + * @param string $key + * The unique key for this upload process. -+ * + */ + protected function progressApc($key) { + $this->sendResponse(apc_fetch('upload_' . $key)); @@ -61,31 +60,24 @@ * A JsonResponse object. */ - public function progress($key) { -+ protected function sendResponse($status = [], $current = 'current', $total = 'total') { - $progress = array( ++ protected function sendResponse(array $status = [], $current = 'current', $total = 'total') { + $progress = [ 'message' => t('Starting upload...'), 'percentage' => -1, - ); + ]; - - $implementation = file_progress_implementation(); - if ($implementation == 'uploadprogress') { - $status = uploadprogress_get_info($key); - if (isset($status['bytes_uploaded']) && !empty($status['bytes_total'])) { -- $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total']))); +- $progress['message'] = t('Uploading... (@current of @total)', ['@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total'])]); - $progress['percentage'] = round(100 * $status['bytes_uploaded'] / $status['bytes_total']); - } -- } -- elseif ($implementation == 'apc') { -- $status = apcu_fetch('upload_' . $key); -- if (isset($status['current']) && !empty($status['total'])) { -- $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['current']), '@total' => format_size($status['total']))); -- $progress['percentage'] = round(100 * $status['current'] / $status['total']); -- } + if (isset($status[$current]) && !empty($status[$total])) { -+ $progress['message'] = t('Uploading... (@current of @total)', array( -+ '@current' => format_size($status[$current]), -+ '@total' => format_size($status[$total]) -+ )); ++ $progress['message'] = t('Uploading... (@current of @total)', [ ++ '@current' => format_size($status[$current]), ++ '@total' => format_size($status[$total]), ++ ]); + $progress['percentage'] = round(100 * $status[$current] / $status[$total]); }