Commit cd44cc17 authored by APolitsin's avatar APolitsin
Browse files

git commit -m 'Issue #3152379 by Raunak.singh: Remove deprecated code and...

git commit -m 'Issue #3152379 by Raunak.singh: Remove deprecated code and issues for drupal 9 readiness' --author="raunaksingh9 <raunaksingh9@3578090.no-reply.drupal.org>"
parent 6115c68c
......@@ -14,7 +14,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Core\Command\Shared\CommandTrait;
use Drupal\Console\Command\Shared\CommandTrait;
use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Annotations\DrupalCommand;
use Drupal\synhelper\Service\ContentExporter;
......@@ -33,8 +33,6 @@ use Symfony\Component\Console\Question\ChoiceQuestion;
*/
class ExportCommand extends Command {
use CommandTrait;
/**
* The content exporter.
*
......
......@@ -2,6 +2,8 @@
namespace Drupal\synhelper\Hook;
use Drupal\Core\File\FileSystem;
/**
* FileValidate.
*/
......@@ -12,9 +14,9 @@ class FileValidate {
*/
public static function hook($file) {
$destination = self::transliteration($file->destination);
$basename = drupal_basename($destination);
$directory = drupal_dirname($destination);
$file->destination = file_create_filename($basename, $directory);
$basename = FileSystem::basename($destination);
$directory = FileSystem::dirname($destination);
$file->destination = \Drupal::service('file_system')->createFilename($basename, $directory);
}
/**
......
......@@ -316,8 +316,8 @@ class ContentImporter {
$files = $file_storage->loadByProperties(['filename' => $filename]);
$file = reset($files);
if (!$file) {
$path = $this->contentPath . '/files/' . $filename;
$uri = file_unmanaged_copy($path, 'public://' . $filename, FileSystemInterface::EXISTS_REPLACE);
$path = $this->contentPath . "/files/$filename";
$uri = \Drupal::service('file_system')->copy($path, "public://{$filename}", FileSystemInterface::EXISTS_REPLACE);
$file = $file_storage->create([
'filename' => $filename,
'uri' => $uri,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment