vendor/pimcore/pimcore/bundles/CoreBundle/Migrations/Version20210323110055.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Pimcore
  5.  *
  6.  * This source file is available under two different licenses:
  7.  * - GNU General Public License version 3 (GPLv3)
  8.  * - Pimcore Commercial License (PCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  13.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  14.  */
  15. namespace Pimcore\Bundle\CoreBundle\Migrations;
  16. use Doctrine\DBAL\Schema\Schema;
  17. use Doctrine\Migrations\AbstractMigration;
  18. use Pimcore\Config;
  19. use Pimcore\Model\Tool\SettingsStore;
  20. /**
  21.  * Auto-generated Migration: Please modify to your needs!
  22.  */
  23. final class Version20210323110055 extends AbstractMigration
  24. {
  25.     public function getDescription(): string
  26.     {
  27.         return '';
  28.     }
  29.     public function up(Schema $schema): void
  30.     {
  31.         $file Config::locateConfigFile('robots.php');
  32.         if (!file_exists($file)) {
  33.             return;
  34.         }
  35.         $config Config::getConfigInstance($file);
  36.         $config $config->toArray();
  37.         foreach ($config as $siteId => $robotsContent) {
  38.             SettingsStore::set('robots.txt-' $siteId$robotsContent'string''robots.txt');
  39.         }
  40.     }
  41.     public function down(Schema $schema): void
  42.     {
  43.         $robotsSettingsIds SettingsStore::getIdsByScope('robots.txt');
  44.         foreach ($robotsSettingsIds as $id) {
  45.             SettingsStore::delete($id'robots.txt');
  46.         }
  47.     }
  48. }