The owner of any building in the city that has a stairway leading from an adjacent sidewalk to the cellar or basement of the building shall guard such stairway with a substantial railing not less than three feet high. The entrance to such stairway shall be at right angles to the street from which such entry is made. Any person who has any permanent opening in any sidewalk for the purpose of letting light into any basement or cellar or for any other purpose shall guard the same with a substantial cover.