Ejemplo n.º 1
0
 protected function fixMissingFlag()
 {
     // Be sure that a lang have a flag, otherwise copy the
     // "unknown" flag
     $adminTemplate = TemplateHelper::getInstance()->getActiveAdminTemplate();
     $unknownFlag = ConfigQuery::getUnknownFlagPath();
     $unknownFlagPath = $adminTemplate->getAbsolutePath() . DS . $unknownFlag;
     if (!file_exists($unknownFlagPath)) {
         throw new \RuntimeException(Translator::getInstance()->trans("The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.", array("%file" => $unknownFlag)));
     }
     // Check if the country flag exists
     $countryFlag = rtrim(dirname($unknownFlagPath), DS) . DS . $this->getCode() . '.png';
     if (!file_exists($countryFlag)) {
         $fs = new Filesystem();
         $fs->copy($unknownFlagPath, $countryFlag);
     }
 }