Commit a227db18 authored by catch's avatar catch
Browse files

Issue #3021833 by pavnish, andypost, munish.kumar, kim.pepper, googletorp,...

Issue #3021833 by pavnish, andypost, munish.kumar, kim.pepper, googletorp, swatichouhan012, daffie, Berdir, alexpott, xjm: Move FILE_STATUS_PERMANENT to \Drupal\file\FileInterface
parent 4b4895c0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,12 @@
 * configuration value will be, if clean-up not disabled, removed during cron
 * runs, but permanent files will not be removed during the file garbage
 * collection process.
 *
 * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
 *   \Drupal\file\FileInterface::STATUS_PERMANENT or
 *   \Drupal\file\FileInterface::setPermanent() instead.
 *
 * @see https://www.drupal.org/node/3022147
 */
const FILE_STATUS_PERMANENT = 1;

+1 −1
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@
 * Here is an example, using the core File entity:
 * @code
 * $fids = Drupal::entityQuery('file')
 *   ->condition('status', FILE_STATUS_PERMANENT, '<>')
 *   ->condition('status', \Drupal\file\FileInterface::STATUS_PERMANENT, '<>')
 *   ->condition('changed', REQUEST_TIME - $age, '<')
 *   ->range(0, 100)
 *   ->execute();
+1 −1
Original line number Diff line number Diff line
@@ -152,9 +152,9 @@ public function testImageFieldSync() {
      $field_values = [
        'uri' => $this->files[$index]->uri,
        'uid' => \Drupal::currentUser()->id(),
        'status' => FILE_STATUS_PERMANENT,
      ];
      $file = File::create($field_values);
      $file->setPermanent();
      $file->save();
      $fid = $file->id();
      $this->files[$index]->fid = $fid;
+1 −2
Original line number Diff line number Diff line
@@ -444,8 +444,7 @@ function editor_entity_revision_delete(EntityInterface $entity) {
/**
 * Records file usage of files referenced by formatted text fields.
 *
 * Every referenced file that does not yet have the FILE_STATUS_PERMANENT state,
 * will be given that state.
 * Every referenced file that is temporally saved will be resaved as permanent.
 *
 * @param array $uuids
 *   An array of file entity UUIDs.
+3 −3
Original line number Diff line number Diff line
@@ -560,8 +560,8 @@ function file_save_data($data, $destination = NULL, $replace = FileSystemInterfa
    $file = File::create([
      'uri' => $uri,
      'uid' => $user->id(),
      'status' => FILE_STATUS_PERMANENT,
    ]);
    $file->setPermanent();
    // If we are replacing an existing file re-use its database record.
    // @todo Do not create a new entity in order to update it. See
    //   https://www.drupal.org/node/2241865.
@@ -709,7 +709,7 @@ function file_cron() {
  if ($age) {
    $fids = Drupal::entityQuery('file')
      ->accessCheck(FALSE)
      ->condition('status', FILE_STATUS_PERMANENT, '<>')
      ->condition('status', FileInterface::STATUS_PERMANENT, '<>')
      ->condition('changed', REQUEST_TIME - $age, '<')
      ->range(0, 100)
      ->execute();
@@ -1782,7 +1782,7 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
function _views_file_status($choice = NULL) {
  $status = [
    0 => t('Temporary'),
    FILE_STATUS_PERMANENT => t('Permanent'),
    FileInterface::STATUS_PERMANENT => t('Permanent'),
  ];

  if (isset($choice)) {
Loading