Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Media.php
Go to the documentation of this file.
1 <?php
7 
13 class Media extends Snapshot
14 {
21  public function rollback()
22  {
23  $this->_prepareIgnoreList();
24  return parent::rollback();
25  }
26 
33  public function create()
34  {
35  $this->_prepareIgnoreList();
36  return parent::create();
37  }
38 
45  public function getType()
46  {
47  return 'media';
48  }
49 
55  protected function _prepareIgnoreList()
56  {
57  $rootDir = $this->getRootDir();
58  $map = [
59  $rootDir => ['var', 'pub'],
60  $rootDir . '/pub' => ['media'],
61  $rootDir . '/var' => [$this->getDbBackupFilename()],
62  ];
63 
64  foreach ($map as $path => $whiteList) {
65  foreach (new \DirectoryIterator($path) as $item) {
66  $filename = $item->getFilename();
67  if (!$item->isDot() && !in_array($filename, $whiteList)) {
68  $this->addIgnorePaths(str_replace('\\', '/', $item->getPathname()));
69  }
70  }
71  }
72 
73  return $this;
74  }
75 }
$rootDir
Definition: website.php:12