isLocationUnchanged example

    // download plugin.     if (!$this->isLocalUri($source)) {
      return $this->downloadPlugin->transform($value$migrate_executable$row$destination_property);
    }

    // Ensure the source file exists, if it's a local URI or path.     if (!file_exists($source)) {
      throw new MigrateException("File '$source' does not exist");
    }

    // If the start and end file is exactly the same, there is nothing to do.     if ($this->isLocationUnchanged($source$destination)) {
      return $destination;
    }

    // Check if a writable directory exists, and if not try to create it.     $dir = $this->getDirectory($destination);
    // If the directory exists and is writable, avoid     // \Drupal\Core\File\FileSystemInterface::prepareDirectory() call and write     // the file to destination.     if (!is_dir($dir) || !is_writable($dir)) {
      if (!$this->fileSystem->prepareDirectory($dir, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
        throw new MigrateException("Could not create or write to directory '$dir'");
      }
Home | Imprint | This part of the site doesn't use cookies.