You are here

function file_progress_implementation in Drupal 7

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

Determines the preferred upload progress implementation.

Return value

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()
file_ajax_progress in modules/file/file.module
Menu callback for upload progress.
file_field_widget_settings_form in modules/file/file.field.inc
Implements hook_field_widget_settings_form().
file_managed_file_process in modules/file/file.module
Process function to expand the managed_file element type.
file_requirements in modules/file/file.install
Implements hook_requirements().

File

modules/file/file.module, line 335
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. APC only supports one at a time.
    if (extension_loaded('uploadprogress')) {
      $implementation = 'uploadprogress';
    }
    elseif (extension_loaded('apc') && ini_get('apc.rfc1867')) {
      $implementation = 'apc';
    }
  }
  return $implementation;
}