public function up()
 {
     $this->delete(\app\models\SpamChecker::tableName(), ['name' => 'Yandex']);
     $webFilename = Yii::getAlias('@app/config/web-configurables.php');
     if (true === file_exists($webFilename)) {
         $webConfigurablesArray = (include $webFilename);
         if (ArrayHelper::getValue($webConfigurablesArray, 'modules.core.spamCheckerApiKey', '') == 'app\\behaviors\\spamchecker\\YandexSpamChecker') {
             $webConfigurablesArray['modules']['core']['spamCheckerApiKey'] = AkismetSpamChecker::class;
             $webConfigurables = new ApplicationConfigWriter(['filename' => '@app/config/web-configurables.php', 'loadExistingConfiguration' => false]);
             $webConfigurables->addValues($webConfigurablesArray);
             $webConfigurables->commit();
         }
     }
     $coreFilename = Yii::getAlias('@app/config/configurables-state/core.php');
     if (true === file_exists($coreFilename)) {
         $coreConfigurablesArray = (include $coreFilename);
         if (ArrayHelper::getValue($coreConfigurablesArray, 'spamCheckerApiKey', '') == 'app\\behaviors\\spamchecker\\YandexSpamChecker') {
             $coreConfigurablesArray['spamCheckerApiKey'] = AkismetSpamChecker::class;
             $coreConfigurables = new ApplicationConfigWriter(['filename' => '@app/config/configurables-state/core.php', 'loadExistingConfiguration' => false]);
             $coreConfigurables->addValues($coreConfigurablesArray);
             $coreConfigurables->commit();
         }
     }
 }
 /**
  * Saves state to file
  * @return bool
  */
 public function saveState()
 {
     $filename = Yii::getAlias('@app/config/configurables-state/' . $this->module . '.php');
     $writer = new ApplicationConfigWriter(['filename' => $filename]);
     $writer->configuration = $this->getAttributesForStateSaving();
     $result = $writer->commit();
     if (ini_get('opcache.enable')) {
         // invalidate opcache of this files!
         opcache_invalidate(Yii::getAlias($filename), true);
     }
     return $result;
 }