Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5

This commit is contained in:
Pantheon Automation 2016-07-07 09:44:38 -07:00 committed by Greg Anderson
parent 13b6ca7cc2
commit 38ba7c357d
342 changed files with 7814 additions and 1534 deletions

View file

@ -185,8 +185,6 @@ function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_E
/**
* Moves a file to a new location and update the file's database entry.
*
* Moving a file is performed by copying the file to the new location and then
* deleting the original.
* - Checks if $source and $destination are valid and readable/writable.
* - Performs a file move if $source is not equal to $destination.
* - If file already exists in $destination either the call will error out,
@ -1177,7 +1175,7 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state)
$destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL;
if (isset($destination) && !file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
\Drupal::logger('file')->notice('The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $destination, '!name' => $element['#field_name']));
\Drupal::logger('file')->notice('The upload directory %directory for the file field %name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $destination, '%name' => $element['#field_name']));
$form_state->setError($element, t('The file could not be uploaded.'));
return FALSE;
}

View file

@ -8,7 +8,8 @@ use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
/**
* @MigrateCckField(
* id = "filefield"
* id = "filefield",
* core = {6}
* )
*/
class FileField extends CckFieldPluginBase {

View file

@ -9,6 +9,7 @@ use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
/**
* @MigrateCckField(
* id = "file",
* core = {7}
* )
*/
class FileField extends CckFieldPluginBase {

View file

@ -7,7 +7,8 @@ use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
/**
* @MigrateCckField(
* id = "image"
* id = "image",
* core = {7}
* )
*/
class ImageField extends CckFieldPluginBase {

View file

@ -147,7 +147,7 @@ class EntityFile extends EntityContentBase {
* (optional) FILE_EXISTS_REPLACE (default) or FILE_EXISTS_RENAME.
*
* @return bool
* TRUE on success, FALSE on failure.
* TRUE on success, FALSE on failure.
*/
protected function writeFile($source, $destination, $replace = FILE_EXISTS_REPLACE) {
if ($this->configuration['move']) {
@ -190,8 +190,8 @@ class EntityFile extends EntityContentBase {
* The URI or path.
*
* @return string|false
* The directory component of the path or URI, or FALSE if it could not
* be determined.
* The directory component of the path or URI, or FALSE if it could not
* be determined.
*/
protected function getDirectory($uri) {
$dir = $this->fileSystem->dirname($uri);
@ -213,8 +213,8 @@ class EntityFile extends EntityContentBase {
* The destination URI.
*
* @return bool
* TRUE if the source and destination URIs refer to the same physical path,
* otherwise FALSE.
* TRUE if the source and destination URIs refer to the same physical path,
* otherwise FALSE.
*/
protected function isLocationUnchanged($source, $destination) {
if ($this->isLocalUri($source) && $this->isLocalUri($destination)) {

View file

@ -45,7 +45,7 @@ class File extends DrupalSqlBase {
// If two or more files have the same timestamp, they'll end up in a
// non-deterministic order. Ordering by fid (or any other unique field)
// will prevent this.
->orderBy('fid');
->orderBy('f.fid');
}
/**

View file

@ -33,7 +33,7 @@ class UploadInstance extends DrupalSqlBase {
$return = array();
$values = $this->select('variable', 'v')
->fields('v', ['name', 'value'])
->condition('name', $variables, 'IN')
->condition('v.name', $variables, 'IN')
->execute()
->fetchAllKeyed();
foreach ($node_types as $node_type) {

View file

@ -42,7 +42,7 @@ class File extends DrupalSqlBase {
public function query() {
$query = $this->select('file_managed', 'f')
->fields('f')
->orderBy('timestamp');
->orderBy('f.timestamp');
// Filter by scheme(s), if configured.
if (isset($this->configuration['scheme'])) {

View file

@ -4,6 +4,7 @@ namespace Drupal\file\Tests;
use Drupal\node\Entity\Node;
use Drupal\file\Entity\File;
use Drupal\entity_test\Entity\EntityTestConstraints;
/**
* Tests file listing page functionality.
@ -17,7 +18,7 @@ class FileListingTest extends FileFieldTestBase {
*
* @var array
*/
public static $modules = array('views', 'file', 'image');
public static $modules = array('views', 'file', 'image', 'entity_test');
/**
* An authenticated user.
@ -144,11 +145,60 @@ class FileListingTest extends FileFieldTestBase {
}
}
/**
* Tests file listing usage page for entities with no canonical link template.
*/
function testFileListingUsageNoLink() {
// Login with user with right permissions and test listing.
$this->drupalLogin($this->adminUser);
// Create a bundle and attach a File field to the bundle.
$bundle = $this->randomMachineName();
entity_test_create_bundle($bundle, NULL, 'entity_test_constraints');
$this->createFileField('field_test_file', 'entity_test_constraints', $bundle, array(), array('file_extensions' => 'txt png'));
// Create file to attach to entity.
$file = File::create([
'filename' => 'druplicon.txt',
'uri' => 'public://druplicon.txt',
'filemime' => 'text/plain',
]);
$file->setPermanent();
file_put_contents($file->getFileUri(), 'hello world');
$file->save();
// Create entity and attach the created file.
$entity_name = $this->randomMachineName();
$entity = EntityTestConstraints::create(array(
'uid' => 1,
'name' => $entity_name,
'type' => $bundle,
'field_test_file' => array(
'target_id' => $file->id(),
),
));
$entity->save();
// Create node entity and attach the created file.
$node = $this->drupalCreateNode(array('type' => 'article', 'file' => $file));
$node->save();
// Load the file usage page for the created and attached file.
$this->drupalGet('admin/content/files/usage/' . $file->id());
$this->assertResponse(200);
// Entity name should be displayed, but not linked if Entity::toUrl
// throws an exception
$this->assertText($entity_name, 'Entity name is added to file usage listing.');
$this->assertNoLink($entity_name, 'Linked entity name not added to file usage listing.');
$this->assertLink($node->getTitle());
}
/**
* Creates and saves a test file.
*
* @return \Drupal\Core\Entity\EntityInterface
* A file entity.
* A file entity.
*/
protected function createFile() {
// Create a new file entity.