diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php index da1165f..9726ef8 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleFileImportStatus.php @@ -69,13 +69,14 @@ class LocaleFileImportStatus extends WebTestBase { * @param int $timestamp_difference * (optional) Timestamp offset, used to mock older or newer files. * - * @return \Drupal\entity\EntityInterface + * @return stdClass + * A file object of type stdClass. */ function mockImportedPoFile($langcode, $timestamp_difference = 0) { $dir = variable_get('locale_translate_file_directory', drupal_get_path('module', 'locale') . '/tests'); $testfile_uri = $dir . '/test.' . $langcode . '.po'; - $file = locale_translate_file_entity_create($testfile_uri); + $file = locale_translate_file_create($testfile_uri); $file->original_timestamp = $file->timestamp; $file->timestamp = $file->timestamp + $timestamp_difference; $file->langcode = $langcode; diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index bd4e5e3..acdfdcf 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -327,7 +327,7 @@ function locale_translate_batch_import($filepath, &$context) { // The filename is either {langcode}.po or {prefix}.{langcode}.po, so // we can extract the language code to use for the import from the end. if (preg_match('!(/|\.)([^\./]+)\.po$!', $filepath, $langcode)) { - $file = locale_translate_file_entity_create($filepath, $langcode[2]); + $file = locale_translate_file_create($filepath, $langcode[2]); $success = _locale_import_read_po('db-store', $file, array(), $langcode[2]); if ($success == NULL) { $file->langcode = $langcode[2]; @@ -347,17 +347,19 @@ function locale_translate_batch_finished($success, $results) { } /** - * Wrapper for entity_create(). Populates the timestamp property. + * Creates a file object and populates the timestamp property. * * @param $filepath * The filepath of a file to import. * - * @return Drupal\entity\EntityInterface + * @return stdClass + * A file object of type stdClass. * - * @see entity_create() */ -function locale_translate_file_entity_create($filepath) { - $file = entity_create('file', array('filename' => drupal_basename($filepath), 'uri' => $filepath)); +function locale_translate_file_create($filepath) { + $file = new stdClass(); + $file->filename = drupal_basename($filepath); + $file->uri = $filepath; $file->timestamp = filemtime($file->uri); return $file; }