Issue #2074475 by benjy, Gábor Hojtsy: Rename {file_managed}.timestamp to 'changed' and add a created timestamp.
							parent
							
								
									261fb6483f
								
							
						
					
					
						commit
						e948f79c4c
					
				| 
						 | 
				
			
			@ -71,7 +71,8 @@ display:
 | 
			
		|||
            filemime: filemime
 | 
			
		||||
            filesize: filesize
 | 
			
		||||
            status: status
 | 
			
		||||
            timestamp: timestamp
 | 
			
		||||
            created: created
 | 
			
		||||
            changed: changed
 | 
			
		||||
            count: count
 | 
			
		||||
          info:
 | 
			
		||||
            fid:
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +110,14 @@ display:
 | 
			
		|||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: priority-low
 | 
			
		||||
            timestamp:
 | 
			
		||||
            created:
 | 
			
		||||
              sortable: true
 | 
			
		||||
              default_sort_order: desc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            changed:
 | 
			
		||||
              sortable: true
 | 
			
		||||
              default_sort_order: desc
 | 
			
		||||
              align: ''
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +131,7 @@ display:
 | 
			
		|||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: priority-medium
 | 
			
		||||
          default: timestamp
 | 
			
		||||
          default: changed
 | 
			
		||||
          empty_table: true
 | 
			
		||||
      row:
 | 
			
		||||
        type: fields
 | 
			
		||||
| 
						 | 
				
			
			@ -340,10 +348,10 @@ display:
 | 
			
		|||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          plugin_id: file_status
 | 
			
		||||
        timestamp:
 | 
			
		||||
          id: timestamp
 | 
			
		||||
        created:
 | 
			
		||||
          id: created
 | 
			
		||||
          table: file_managed
 | 
			
		||||
          field: timestamp
 | 
			
		||||
          field: created
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
| 
						 | 
				
			
			@ -392,6 +400,58 @@ display:
 | 
			
		|||
          custom_date_format: ''
 | 
			
		||||
          timezone: ''
 | 
			
		||||
          plugin_id: date
 | 
			
		||||
        changed:
 | 
			
		||||
          id: changed
 | 
			
		||||
          table: file_managed
 | 
			
		||||
          field: changed
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Changed date'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: ''
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          date_format: medium
 | 
			
		||||
          custom_date_format: ''
 | 
			
		||||
          timezone: ''
 | 
			
		||||
          plugin_id: date
 | 
			
		||||
        count:
 | 
			
		||||
          id: count
 | 
			
		||||
          table: file_usage
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,8 +81,8 @@ function hook_file_validate(Drupal\file\FileInterface $file) {
 | 
			
		|||
 *   The file entity that is about to be created or updated.
 | 
			
		||||
 */
 | 
			
		||||
function hook_file_presave(Drupal\file\FileInterface $file) {
 | 
			
		||||
  // Change the file timestamp to an hour prior.
 | 
			
		||||
  $file->timestamp -= 3600;
 | 
			
		||||
  // Change the owner of the file.
 | 
			
		||||
  $file->uid->value = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,8 +78,15 @@ function file_schema() {
 | 
			
		|||
        'default' => 0,
 | 
			
		||||
        'size' => 'tiny',
 | 
			
		||||
      ),
 | 
			
		||||
      'timestamp' => array(
 | 
			
		||||
        'description' => 'UNIX timestamp for when the file was added.',
 | 
			
		||||
      'created' => array(
 | 
			
		||||
        'description' => 'UNIX timestamp for when the file added.',
 | 
			
		||||
        'type' => 'int',
 | 
			
		||||
        'unsigned' => TRUE,
 | 
			
		||||
        'not null' => TRUE,
 | 
			
		||||
        'default' => 0,
 | 
			
		||||
      ),
 | 
			
		||||
      'changed' => array(
 | 
			
		||||
        'description' => 'UNIX timestamp for when the file was last changed.',
 | 
			
		||||
        'type' => 'int',
 | 
			
		||||
        'unsigned' => TRUE,
 | 
			
		||||
        'not null' => TRUE,
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +96,7 @@ function file_schema() {
 | 
			
		|||
    'indexes' => array(
 | 
			
		||||
      'uid' => array('uid'),
 | 
			
		||||
      'status' => array('status'),
 | 
			
		||||
      'timestamp' => array('timestamp'),
 | 
			
		||||
      'changed' => array('changed'),
 | 
			
		||||
    ),
 | 
			
		||||
    'unique keys' => array(
 | 
			
		||||
      'uuid' => array('uuid'),
 | 
			
		||||
| 
						 | 
				
			
			@ -320,4 +327,3 @@ function file_update_8004() {
 | 
			
		|||
  );
 | 
			
		||||
  db_change_field('file_managed', 'filesize', 'filesize', $spec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1036,7 +1036,11 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
 | 
			
		|||
          break;
 | 
			
		||||
 | 
			
		||||
        // These tokens are default variations on the chained tokens handled below.
 | 
			
		||||
        case 'timestamp':
 | 
			
		||||
        case 'created':
 | 
			
		||||
          $replacements[$original] = format_date($file->getCreatedTime(), 'medium', '', NULL, $langcode);
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
        case 'changed':
 | 
			
		||||
          $replacements[$original] = format_date($file->getChangedTime(), 'medium', '', NULL, $langcode);
 | 
			
		||||
          break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1047,7 +1051,11 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
 | 
			
		|||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($date_tokens = $token_service->findWithPrefix($tokens, 'timestamp')) {
 | 
			
		||||
    if ($date_tokens = $token_service->findWithPrefix($tokens, 'created')) {
 | 
			
		||||
      $replacements += $token_service->generate('date', $date_tokens, array('date' => $file->getCreatedTime()), $options);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($date_tokens = $token_service->findWithPrefix($tokens, 'changed')) {
 | 
			
		||||
      $replacements += $token_service->generate('date', $date_tokens, array('date' => $file->getChangedTime()), $options);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1094,8 +1102,13 @@ function file_token_info() {
 | 
			
		|||
    'name' => t("URL"),
 | 
			
		||||
    'description' => t("The web-accessible URL for the file."),
 | 
			
		||||
  );
 | 
			
		||||
  $file['timestamp'] = array(
 | 
			
		||||
    'name' => t("Timestamp"),
 | 
			
		||||
  $file['created'] = array(
 | 
			
		||||
    'name' => t("Created"),
 | 
			
		||||
    'description' => t("The date the file created."),
 | 
			
		||||
    'type' => 'date',
 | 
			
		||||
  );
 | 
			
		||||
  $file['changed'] = array(
 | 
			
		||||
    'name' => t("Changed"),
 | 
			
		||||
    'description' => t("The date the file was most recently changed."),
 | 
			
		||||
    'type' => 'date',
 | 
			
		||||
  );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -154,15 +154,30 @@ function file_views_data() {
 | 
			
		|||
    ),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  // timestamp field
 | 
			
		||||
  $data['file_managed']['timestamp'] = array(
 | 
			
		||||
  // The created field.
 | 
			
		||||
  $data['file_managed']['created'] = array(
 | 
			
		||||
    'title' => t('Upload date'),
 | 
			
		||||
    'help' => t('The date the file was uploaded.'),
 | 
			
		||||
    'field' => array(
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
    ),
 | 
			
		||||
    'sort' => array(
 | 
			
		||||
      'id' => 'date'
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
    ),
 | 
			
		||||
    'filter' => array(
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
    ),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  // The changed field.
 | 
			
		||||
  $data['file_managed']['changed'] = array(
 | 
			
		||||
    'title' => t('Modified date'),
 | 
			
		||||
    'help' => t('The date the file was last changed.'),
 | 
			
		||||
    'field' => array(
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
    ),
 | 
			
		||||
    'sort' => array(
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
    ),
 | 
			
		||||
    'filter' => array(
 | 
			
		||||
      'id' => 'date',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,11 +108,18 @@ class File extends ContentEntityBase implements FileInterface {
 | 
			
		|||
    $this->get('filesize')->value = $size;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime() {
 | 
			
		||||
    return $this->get('created')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getChangedTime() {
 | 
			
		||||
    return $this->get('timestamp')->value;
 | 
			
		||||
    return $this->get('changed')->value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
| 
						 | 
				
			
			@ -178,7 +185,11 @@ class File extends ContentEntityBase implements FileInterface {
 | 
			
		|||
  public function preSave(EntityStorageControllerInterface $storage_controller) {
 | 
			
		||||
    parent::preSave($storage_controller);
 | 
			
		||||
 | 
			
		||||
    $this->timestamp = REQUEST_TIME;
 | 
			
		||||
    $this->changed->value = REQUEST_TIME;
 | 
			
		||||
    if (empty($this->created->value)) {
 | 
			
		||||
      $this->created->value = REQUEST_TIME;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $this->setSize(filesize($this->getFileUri()));
 | 
			
		||||
    if (!isset($this->langcode->value)) {
 | 
			
		||||
      // Default the file's language code to none, because files are language
 | 
			
		||||
| 
						 | 
				
			
			@ -253,9 +264,13 @@ class File extends ContentEntityBase implements FileInterface {
 | 
			
		|||
      ->setLabel(t('Status'))
 | 
			
		||||
      ->setDescription(t('The status of the file, temporary (0) and permanent (1).'));
 | 
			
		||||
 | 
			
		||||
    $fields['timestamp'] = FieldDefinition::create('integer')
 | 
			
		||||
    $fields['created'] = FieldDefinition::create('integer')
 | 
			
		||||
      ->setLabel(t('Created'))
 | 
			
		||||
      ->setDescription(t('The time that the node was created.'));
 | 
			
		||||
      ->setDescription(t('The timestamp that the file was created.'));
 | 
			
		||||
 | 
			
		||||
    $fields['changed'] = FieldDefinition::create('integer')
 | 
			
		||||
      ->setLabel(t('Changed'))
 | 
			
		||||
      ->setDescription(t('The timestamp that the file was last changed.'));
 | 
			
		||||
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,4 +127,11 @@ interface FileInterface extends ContentEntityInterface, EntityChangedInterface {
 | 
			
		|||
   */
 | 
			
		||||
  public function setOwner(UserInterface $user);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Returns the node creation timestamp.
 | 
			
		||||
   *
 | 
			
		||||
   * @return int
 | 
			
		||||
   *   Creation timestamp of the node.
 | 
			
		||||
   */
 | 
			
		||||
  public function getCreatedTime();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,9 +33,9 @@ class FileStorageController extends FieldableDatabaseStorageController implement
 | 
			
		|||
  public function retrieveTemporaryFiles() {
 | 
			
		||||
    // Use separate placeholders for the status to avoid a bug in some versions
 | 
			
		||||
    // of PHP. See http://drupal.org/node/352956.
 | 
			
		||||
    return $this->database->query('SELECT fid FROM {' . $this->entityInfo->getBaseTable() . '} WHERE status <> :permanent AND timestamp < :timestamp', array(
 | 
			
		||||
    return $this->database->query('SELECT fid FROM {' . $this->entityInfo->getBaseTable() . '} WHERE status <> :permanent AND changed < :changed', array(
 | 
			
		||||
      ':permanent' => FILE_STATUS_PERMANENT,
 | 
			
		||||
      ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
 | 
			
		||||
      ':changed' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
 | 
			
		||||
    ));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ class File extends WizardPluginBase {
 | 
			
		|||
  /**
 | 
			
		||||
   * Set the created column.
 | 
			
		||||
   */
 | 
			
		||||
  protected $createdColumn = 'timestamp';
 | 
			
		||||
  protected $createdColumn = 'created';
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Set default values for the path field options.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ class DeleteTest extends FileManagedTestBase {
 | 
			
		|||
    // of the file is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
 | 
			
		||||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array(
 | 
			
		||||
        'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
        'changed' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
      ))
 | 
			
		||||
      ->condition('fid', $file->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -119,7 +119,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
 | 
			
		|||
    // of the file is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
 | 
			
		||||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array(
 | 
			
		||||
        'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
        'changed' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
      ))
 | 
			
		||||
      ->condition('fid', $node_file_r3->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
| 
						 | 
				
			
			@ -134,7 +134,7 @@ class FileFieldRevisionTest extends FileFieldTestBase {
 | 
			
		|||
    // of the file is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
 | 
			
		||||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array(
 | 
			
		||||
        'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
        'changed' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
      ))
 | 
			
		||||
      ->condition('fid', $node_file_r1->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,7 +158,8 @@ class FileListingTest extends FileFieldTestBase {
 | 
			
		|||
      'filename' => 'druplicon.txt',
 | 
			
		||||
      'uri' => 'public://druplicon.txt',
 | 
			
		||||
      'filemime' => 'text/plain',
 | 
			
		||||
      'timestamp' => 1,
 | 
			
		||||
      'created' => 1,
 | 
			
		||||
      'changed' => 1,
 | 
			
		||||
      'status' => FILE_STATUS_PERMANENT,
 | 
			
		||||
    ));
 | 
			
		||||
    file_put_contents($file->getFileUri(), 'hello world');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,7 +111,8 @@ abstract class FileManagedTestBase extends FileTestBase {
 | 
			
		|||
    $file->filename = drupal_basename($file->uri);
 | 
			
		||||
    $file->filemime = 'text/plain';
 | 
			
		||||
    $file->uid = 1;
 | 
			
		||||
    $file->timestamp = REQUEST_TIME;
 | 
			
		||||
    $file->created = REQUEST_TIME;
 | 
			
		||||
    $file->changed = REQUEST_TIME;
 | 
			
		||||
    $file->filesize = filesize($file->uri);
 | 
			
		||||
    $file->status = 0;
 | 
			
		||||
    // Write the record directly rather than using the API so we don't invoke
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,8 +53,10 @@ class FileTokenReplaceTest extends FileFieldTestBase {
 | 
			
		|||
    $tests['[file:mime]'] = check_plain($file->getMimeType());
 | 
			
		||||
    $tests['[file:size]'] = format_size($file->getSize());
 | 
			
		||||
    $tests['[file:url]'] = check_plain(file_create_url($file->getFileUri()));
 | 
			
		||||
    $tests['[file:timestamp]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:timestamp:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:created]'] = format_date($file->getCreatedTime(), 'medium', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:created:short]'] = format_date($file->getCreatedTime(), 'short', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:changed]'] = format_date($file->getChangedTime(), 'medium', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:changed:short]'] = format_date($file->getChangedTime(), 'short', '', NULL, $language_interface->id);
 | 
			
		||||
    $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
 | 
			
		||||
    $tests['[file:owner:uid]'] = $file->getOwner()->id();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,8 @@ class SaveTest extends FileManagedTestBase {
 | 
			
		|||
      'filename' => 'druplicon.txt',
 | 
			
		||||
      'uri' => 'public://druplicon.txt',
 | 
			
		||||
      'filemime' => 'text/plain',
 | 
			
		||||
      'timestamp' => 1,
 | 
			
		||||
      'created' => 1,
 | 
			
		||||
      'changed' => 1,
 | 
			
		||||
      'status' => FILE_STATUS_PERMANENT,
 | 
			
		||||
    ));
 | 
			
		||||
    file_put_contents($file->getFileUri(), 'hello world');
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +71,8 @@ class SaveTest extends FileManagedTestBase {
 | 
			
		|||
      'filename' => 'DRUPLICON.txt',
 | 
			
		||||
      'uri' => 'public://DRUPLICON.txt',
 | 
			
		||||
      'filemime' => 'text/plain',
 | 
			
		||||
      'timestamp' => 1,
 | 
			
		||||
      'created' => 1,
 | 
			
		||||
      'changed' => 1,
 | 
			
		||||
      'status' => FILE_STATUS_PERMANENT,
 | 
			
		||||
    ));
 | 
			
		||||
    file_put_contents($file->getFileUri(), 'hello world');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,7 @@ class UsageTest extends FileManagedTestBase {
 | 
			
		|||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array(
 | 
			
		||||
        'status' => 0,
 | 
			
		||||
        'timestamp' => 1,
 | 
			
		||||
        'changed' => 1,
 | 
			
		||||
      ))
 | 
			
		||||
      ->condition('fid', $temp_old->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +151,7 @@ class UsageTest extends FileManagedTestBase {
 | 
			
		|||
    // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
 | 
			
		||||
    $perm_old = file_save_data('');
 | 
			
		||||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array('timestamp' => 1))
 | 
			
		||||
      ->fields(array('changed' => 1))
 | 
			
		||||
      ->condition('fid', $temp_old->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
    $this->assertTrue(file_exists($perm_old->getFileUri()), 'Old permanent file was created correctly.');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -224,7 +224,8 @@ class EntityCrudHookTest extends EntityUnitTestBase {
 | 
			
		|||
      'filemime' => 'text/plain',
 | 
			
		||||
      'filesize' => filesize($url),
 | 
			
		||||
      'status' => 1,
 | 
			
		||||
      'timestamp' => REQUEST_TIME,
 | 
			
		||||
      'created' => REQUEST_TIME,
 | 
			
		||||
      'changed' => REQUEST_TIME,
 | 
			
		||||
    ));
 | 
			
		||||
 | 
			
		||||
    $this->assertHookMessageOrder(array(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -776,7 +776,8 @@ db_insert('file_managed')->fields(array(
 | 
			
		|||
  'filemime',
 | 
			
		||||
  'filesize',
 | 
			
		||||
  'status',
 | 
			
		||||
  'timestamp'
 | 
			
		||||
  'created',
 | 
			
		||||
  'changed',
 | 
			
		||||
))
 | 
			
		||||
->values(array(
 | 
			
		||||
  'fid' => '1',
 | 
			
		||||
| 
						 | 
				
			
			@ -786,6 +787,7 @@ db_insert('file_managed')->fields(array(
 | 
			
		|||
  'filemime' => 'text/plain',
 | 
			
		||||
  'filesize' => 0,
 | 
			
		||||
  'status' => 1,
 | 
			
		||||
  'timestamp' => '1314997642',
 | 
			
		||||
  'created' => '1314997642',
 | 
			
		||||
  'changed' => '1314997642',
 | 
			
		||||
))
 | 
			
		||||
->execute();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,8 @@ $fid = db_insert('file_managed')
 | 
			
		|||
    'filename' => 'faked_image.png',
 | 
			
		||||
    'filesize' => 1000,
 | 
			
		||||
    'filemime' => 'image/png',
 | 
			
		||||
    'timestamp' => 1353542634,
 | 
			
		||||
    'created' => 1353542634,
 | 
			
		||||
    'changed' => 1353542634,
 | 
			
		||||
  ))
 | 
			
		||||
  ->execute();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ class UserPictureTest extends WebTestBase {
 | 
			
		|||
    // of the file is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
 | 
			
		||||
    db_update('file_managed')
 | 
			
		||||
      ->fields(array(
 | 
			
		||||
        'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
        'changed' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
 | 
			
		||||
      ))
 | 
			
		||||
      ->condition('fid', $file->id())
 | 
			
		||||
      ->execute();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -555,7 +555,8 @@ function user_update_8011() {
 | 
			
		|||
        'langcode' => Language::LANGCODE_NOT_SPECIFIED,
 | 
			
		||||
        'filesize' => filesize($destination),
 | 
			
		||||
        'filemime' => file_get_mimetype($destination),
 | 
			
		||||
        'timestamp' => REQUEST_TIME,
 | 
			
		||||
        'created' => REQUEST_TIME,
 | 
			
		||||
        'changed' => REQUEST_TIME,
 | 
			
		||||
      ))
 | 
			
		||||
      ->execute();
 | 
			
		||||
    $default_image_fid = db_query('SELECT fid FROM {file_managed} WHERE uri = :uri', array(':uri' => $destination))->fetchField();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue