You are here

function file_progress_implementation in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/file.module \file_progress_implementation()
  2. 7 modules/file/file.module \file_progress_implementation()
  3. 9 core/modules/file/file.module \file_progress_implementation()

Determines the preferred upload progress implementation.

Return value

string|false A string indicating which upload progress system is available. Either "apc" or "uploadprogress". If neither are available, returns FALSE.

4 calls to file_progress_implementation()
FileWidget::settingsForm in core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
Returns a form to configure settings for the widget.
FileWidgetAjaxController::progress in core/modules/file/src/Controller/FileWidgetAjaxController.php
Returns the progress status for a file upload process.
file_requirements in core/modules/file/file.install
Implements hook_requirements().
ManagedFile::processManagedFile in core/modules/file/src/Element/ManagedFile.php
Render API callback: Expands the managed_file element type.

File

core/modules/file/file.module, line 723
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_progress_implementation() {
  static $implementation;
  if (!isset($implementation)) {
    $implementation = FALSE;

    // We prefer the PECL extension uploadprogress because it supports multiple
    // simultaneous uploads. APCu only supports one at a time.
    if (extension_loaded('uploadprogress')) {
      $implementation = 'uploadprogress';
    }
  }
  return $implementation;
}