1 | <?php |
||
21 | class ExportController extends Base |
||
22 | { |
||
23 | /** |
||
24 | * Exports the Craft datamodel. |
||
25 | * |
||
26 | * @return int |
||
27 | * @throws \yii\base\ErrorException |
||
28 | */ |
||
29 | public function actionIndex(): int |
||
30 | { |
||
31 | $this->disableLogging(); |
||
32 | $result = []; |
||
33 | foreach ($this->getDataTypes() as $dataTypeHandle) { |
||
34 | $dataType = $this->module->getDataType($dataTypeHandle); |
||
35 | if (null == $dataType) { |
||
36 | continue; |
||
37 | } |
||
38 | |||
39 | $mapper = $dataType->getMapperHandle(); |
||
40 | if (!$this->module->checkMapper($mapper)) { |
||
41 | continue; |
||
42 | } |
||
43 | |||
44 | $records = $dataType->getRecords(); |
||
45 | $configurations[$dataTypeHandle] = $this->module->$mapper->export($records); |
||
46 | } |
||
47 | |||
48 | // Parse data in the overrideFile if available. |
||
49 | $overrideData = Data::parseYamlFile($this->overrideFile); |
||
50 | |||
51 | // Create export directory if it doesn't exist. |
||
52 | if (!file_exists($this->path)) { |
||
53 | mkdir($this->path, 2775, true); |
||
54 | } |
||
55 | |||
56 | <<<<<<< Updated upstream |
||
|
|||
57 | // Create export directory if it doesn't exist. |
||
58 | if (!file_exists($this->path)) { |
||
59 | mkdir($this->path, 2775, true); |
||
86 |