379939110d070dac56e3dfa1d061921b87e4496b
[yaffs-website] / web / core / modules / system / src / Plugin / migrate / source / Extension.php
1 <?php
2
3 namespace Drupal\system\Plugin\migrate\source;
4
5 use Drupal\migrate\Row;
6 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
7
8 /**
9  * Gets system data for a legacy extension.
10  *
11  * @MigrateSource(
12  *   id = "extension",
13  *   source_module = "system"
14  * )
15  */
16 class Extension extends DrupalSqlBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   public function query() {
22     $query = $this->select('system', 's')
23       ->fields('s');
24
25     if (isset($this->configuration['name'])) {
26       $query->condition('name', (array) $this->configuration['name'], 'IN');
27     }
28     return $query;
29   }
30
31   /**
32    * {@inheritdoc}
33    */
34   public function fields() {
35     $fields = [
36       'filename' => $this->t('Filename'),
37       'name' => $this->t('Name'),
38       'type' => $this->t('Type'),
39       'owner' => $this->t('Owner'),
40       'status' => $this->t('Status'),
41       'throttle' => $this->t('Throttle'),
42       'bootstrap' => $this->t('Bootstrap'),
43       'schema_version' => $this->t('Schema version'),
44       'weight' => $this->t('Weight'),
45       'info' => $this->t('Information array'),
46     ];
47     return $fields;
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function prepareRow(Row $row) {
54     $row->setSourceProperty('info', unserialize($row->getSourceProperty('info')));
55     return parent::prepareRow($row);
56   }
57
58   /**
59    * {@inheritdoc}
60    */
61   public function getIds() {
62     $ids['name']['type'] = 'string';
63     return $ids;
64   }
65
66 }