Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
export.php
Go to the documentation of this file.
1 <?php
7 if (!isset($_GET['template'])) {
8  throw new \InvalidArgumentException('Argument "template" must be set.');
9 }
10 
11 $varDir = '../../../../var/';
12 $template = urldecode($_GET['template']);
13 $fileList = scandir($varDir, SCANDIR_SORT_NONE);
14 $files = [];
15 
16 foreach ($fileList as $fileName) {
17  if (preg_match("`$template`", $fileName) === 1) {
18  $filePath = $varDir . $fileName;
19  $files[] = [
20  'content' => file_get_contents($filePath),
21  'name' => $fileName,
22  'date' => filectime($filePath),
23  ];
24  }
25 }
26 
27 echo serialize($files);
$files
Definition: export.php:14
$fileList
Definition: export.php:13
$fileName
Definition: translate.phtml:15
if(!isset($_GET['template'])) $varDir
Definition: export.php:11
$template
Definition: export.php:12