X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffile%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FUpload.php;fp=web%2Fcore%2Fmodules%2Ffile%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FUpload.php;h=4e07a236b5f7bab2bccd3d2e0d4bdff36ad29e5a;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/file/src/Plugin/migrate/source/d6/Upload.php b/web/core/modules/file/src/Plugin/migrate/source/d6/Upload.php new file mode 100644 index 000000000..4e07a236b --- /dev/null +++ b/web/core/modules/file/src/Plugin/migrate/source/d6/Upload.php @@ -0,0 +1,72 @@ +select('upload', 'u') + ->distinct() + ->fields('u', ['nid', 'vid']); + $query->innerJoin('node', 'n', static::JOIN); + $query->addField('n', 'type'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $query = $this->select('upload', 'u') + ->fields('u', ['fid', 'description', 'list']) + ->condition('u.nid', $row->getSourceProperty('nid')) + ->orderBy('u.weight'); + $query->innerJoin('node', 'n', static::JOIN); + $row->setSourceProperty('upload', $query->execute()->fetchAll()); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'fid' => $this->t('The file Id.'), + 'nid' => $this->t('The node Id.'), + 'vid' => $this->t('The version Id.'), + 'type' => $this->t('The node type'), + 'description' => $this->t('The file description.'), + 'list' => $this->t('Whether the list should be visible on the node page.'), + 'weight' => $this->t('The file weight.'), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'u'; + return $ids; + } + +}