San Francisco mayor declares emergency in troubled district