Commit e6fd7b29 authored by catch's avatar catch
Browse files

Issue #3093563 by longwave, NigelCunningham, Dinesh18, kim.pepper: Remove all...

Issue #3093563 by longwave, NigelCunningham, Dinesh18, kim.pepper: Remove all @deprecated code in the file module
parent c85e3f77
Loading
Loading
Loading
Loading
+0 −51
Changes for core/modules/file/file.module: 0 added lines, 51 removed lines.
Original line number Diff line number Diff line
@@ -68,57 +68,6 @@ function file_field_widget_info_alter(array &$info) {
  $info['uri']['field_types'][] = 'file_uri';
}

/**
 * Loads file entities from the database.
 *
 * @param array|null $fids
 *   (optional) An array of entity IDs. If omitted or NULL, all entities are
 *   loaded.
 * @param bool $reset
 *   (optional) Whether to reset the internal file_load_multiple() cache.
 *   Defaults to FALSE.
 *
 * @return array
 *   An array of file entities, indexed by fid.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
 *   \Drupal\file\Entity\File::loadMultiple().
 *
 * @see https://www.drupal.org/node/2266845
 */
function file_load_multiple(array $fids = NULL, $reset = FALSE) {
  @trigger_error('file_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityTypeManager()->getStorage('file')->resetCache($fids);
  }
  return File::loadMultiple($fids);
}

/**
 * Loads a single file entity from the database.
 *
 * @param int $fid
 *   A file ID.
 * @param bool $reset
 *   (optional) Whether to reset the internal file_load_multiple() cache.
 *   Defaults to FALSE.
 *
 * @return \Drupal\file\FileInterface|null
 *   A file entity or NULL if the file was not found.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
 *   \Drupal\file\Entity\File::load().
 *
 * @see https://www.drupal.org/node/2266845
 */
function file_load($fid, $reset = FALSE) {
  @trigger_error('file_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityTypeManager()->getStorage('file')->resetCache([$fid]);
  }
  return File::load($fid);
}

/**
 * Copies a file to a new location and adds a file record to the database.
 *
+0 −10
Changes for core/modules/file/src/Entity/File.php: 0 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -86,16 +86,6 @@ public function createFileUrl($relative = TRUE) {
    return $url;
  }

  /**
   * {@inheritdoc}
   *
   * @see file_url_transform_relative()
   */
  public function url($rel = 'canonical', $options = []) {
    @trigger_error('File entities returning the URL to the physical file in File::url() is deprecated, use $file->createFileUrl() instead. See https://www.drupal.org/node/3019830', E_USER_DEPRECATED);
    return $this->createFileUrl(FALSE);
  }

  /**
   * {@inheritdoc}
   */
+1 −23
Changes for core/modules/file/src/FileUsage/DatabaseFileUsageBackend.php: 1 added line, 23 removed lines.
Original line number Diff line number Diff line
@@ -35,30 +35,8 @@ class DatabaseFileUsageBackend extends FileUsageBase {
   *   information.
   * @param string $table
   *   (optional) The table to store file usage info. Defaults to 'file_usage'.
   *
   * @todo Properly type-hint the constructor arguments in
   *   https://www.drupal.org/project/drupal/issues/3070114 when the
   *   drupal:9.0.x branch is opened.
   */
  // @codingStandardsIgnoreLine
  public function __construct($config_factory, $connection = NULL, $table = 'file_usage') {

    // @todo Remove below conditional when the drupal:9.0.x branch is opened.
    // @see https://www.drupal.org/project/drupal/issues/3070114
    if (!$config_factory instanceof ConfigFactoryInterface) {
      @trigger_error('Passing the database connection as the first argument to ' . __METHOD__ . ' is deprecated in drupal:8.8.0 and will throw a fatal error in drupal:9.0.0. Pass the config factory first. See https://www.drupal.org/node/3070148', E_USER_DEPRECATED);
      if (!$config_factory instanceof Connection) {
        throw new \InvalidArgumentException("The first argument to " . __METHOD__ . " should be an instance of \Drupal\Core\Config\ConfigFactoryInterface, " . gettype($config_factory) . " given.");
      }
      list($connection, $table, $config_factory) = array_pad(func_get_args(), 3, NULL);
      if (NULL === $table) {
        $table = 'file_usage';
      }
      if (!$config_factory instanceof ConfigFactoryInterface) {
        $config_factory = \Drupal::configFactory();
      }
    }

  public function __construct(ConfigFactoryInterface $config_factory, Connection $connection, $table = 'file_usage') {
    parent::__construct($config_factory);
    $this->connection = $connection;
    $this->tableName = $table;
+2 −14
Changes for core/modules/file/src/FileUsage/FileUsageBase.php: 2 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -21,21 +21,9 @@ abstract class FileUsageBase implements FileUsageInterface {
   * Creates a FileUsageBase object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory. This parameter is required as of drupal:8.4.0 and
   *   trigger a fatal error if not passed in drupal:9.0.0.
   *
   * @todo Update the docblock and make $config_factory required in
   *   https://www.drupal.org/project/drupal/issues/3070114 when the
   *   drupal:9.0.x branch is opened.
   *   The config factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory = NULL) {
    // @todo Remove below conditional when the drupal:9.0.x branch is opened.
    // @see https://www.drupal.org/project/drupal/issues/3070114
    if (empty($config_factory)) {
      @trigger_error('Not passing the $config_factory parameter to ' . __METHOD__ . ' is deprecated in drupal:8.4.0 and will trigger a fatal error in drupal:9.0.0. See https://www.drupal.org/project/drupal/issues/2801777', E_USER_DEPRECATED);
      $config_factory = \Drupal::configFactory();
    }

  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

+0 −17
Changes for core/modules/file/src/Plugin/migrate/field/d6/ImageField.php: 0 added lines, 17 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\file\Plugin\migrate\field\d6;

@trigger_error('ImageField is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\image\Plugin\migrate\field\d6\ImageField instead. See https://www.drupal.org/node/2936061.', E_USER_DEPRECATED);

use Drupal\image\Plugin\migrate\field\d6\ImageField as NonLegacyImageField;

/**
 * Field plugin for image fields.
 *
 * @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use
 * \Drupal\image\Plugin\migrate\field\d6\ImageField instead.
 *
 * @see https://www.drupal.org/node/2936061
 */
class ImageField extends NonLegacyImageField {}
Loading