wasn't it based on a painting of the massacre?
This is a film full of massacres. The one you are thinking of, Shearer 9, comes later in the film, after Villega has betrayed his entier revolutionary cell, and John watches the firing squads at work, at night in the rain.
The scene is lit by the lamps of some trucks, and was inspired by Goya's painting from a scene he witnessed in the Napolionic wars in Spain and Portugal: THE THIRD OF MAY, 1808.
(Leone returns to this vision in ONCE UPON A TIME IN AMERICA, when Noodles thinks he sees Max dead in the rain with his friends).
The scene in the cave is based on a real SS massacre, just ouside Rome in 1944.
The more I think about it, the more I wonder if this entire sequence was shot on a Cinecitta set, and the image of the boarded up cave on the DVD was the actual scene of the Nazi atrocity? As I have posted earlier, in terms of focus pulling it is an extremely sophisticated shot. Also, the perfect way Coburn is lit as he exits the scene yet again suggests a studio set.