export.php 681 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. if (!isset($_GET['template'])) {
  7. throw new \InvalidArgumentException('Argument "template" must be set.');
  8. }
  9. $varDir = '../../../../var/';
  10. $template = urldecode($_GET['template']);
  11. $fileList = scandir($varDir, SCANDIR_SORT_NONE);
  12. $files = [];
  13. foreach ($fileList as $fileName) {
  14. if (preg_match("`$template`", $fileName) === 1) {
  15. $filePath = $varDir . $fileName;
  16. $files[] = [
  17. 'content' => file_get_contents($filePath),
  18. 'name' => $fileName,
  19. 'date' => filectime($filePath),
  20. ];
  21. }
  22. }
  23. echo serialize($files);