Commit 2ed333d7 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Un message d'erreur est affiché si oscar.text.custom.json n'est pas accessible en écriture

parent caf7841a
Loading
Loading
Loading
Loading
+8 −1
Changes for module/Oscar/src/Oscar/Service/administration/AdminCustomTextAPIService.php: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,8 +28,15 @@ class AdminCustomTextAPIService extends AbstractAPIService
                $custom[$key] = $value;
            }
        }
        if( !is_writable(OscarText::fileCustom()) ){
            $err = "Le fichier '" .OscarText::fileCustom(). "' n'est pas accessible en écriture";
            $this->getlogger()->error($err);
            throw new OscarException($err);
        }
        $this->getlogger()->info("Enregistrement dans " . OscarText::fileCustom());
        file_put_contents(OscarText::fileCustom(), json_encode($custom, JSON_PRETTY_PRINT));
        if( !file_put_contents(OscarText::fileCustom(), json_encode($custom, JSON_PRETTY_PRINT)) ){
            throw new OscarException("Impossible de enregistrer le fichier");
        }
        return OscarText::getMerged(true);
    }
}
 No newline at end of file