No person shall construct, install or maintain any cellar door or entrance to a basement or cellar of a building which extends into and occupies more than the innermost 1/4 of the width of a sidewalk or more than three feet into an alley. Entrances to cellars and basements, where the steps extend at right angles to the building line, shall be covered with metal doors, closing flush with the surface of the sidewalk or alley. Such doors shall be kept closed at all times except when goods, wares or merchandise are being taken into or removed from the cellar or basement to which such cellarway leads, and under no circumstances may any such door be open between sunset and sunrise unless a person is present at all times on the adjacent sidewalk to warn passersby of the danger. Entrances to cellars and basements, where the steps extend parallel to the building line, shall be surrounded on two sides by a metal barrier or railing, at least three feet in height. No person shall construct any step, porch or portico extending into any sidewalk, which step, porch or portico occupies more than the innermost 2/5 of the width of the sidewalk. However, any entrance to a cellar or basement, step, porch or portico heretofore constructed and occupying a greater part of the sidewalk than herein permitted may continue to be maintained but, in the case of entrances to cellars and basements, all requirements of this section as to safety measures and precautions shall apply to such entrances as well as to all others heretofore or hereafter constructed.