The order forced the city to adopt a six-year-long building moratorium until it fixed its aging infrastructure.