openwebwork/webwork2 — pull request #491 by goehle (2014-10-03 21:10:23+00:00)
Title: Gateway Bug (master)

This is an annoying bug that breaks gateways for anybody on newer perl versions. The issue is that in URLPath.pm both the `quiz_mode` and `proctored_quiz_mode` path types use the `GatewayQuiz` module so when someone does `newFromModule` it could get either of them. In the past it has always gotten the `quiz_mode` path and there were hacks to make `proctored_quiz_mode` work (like line 388 of Problem.pm) for proctored quizzes. Now that modules are loaded in more random orders newer systems are returning `proctored_quiz_mode` for all of the url paths, even regular gateway quizzes.

This is a bit of a bandaid fix in that I've replaced all of the `newFromModule` calls with `newFromPath` calls that explicitly state which type of path is needed. I'm not sure how to fix `newFromModule` for gateways. It needs to be able to distinguish between proctored gateways and gateways. However, both of those use the same perl module and `getModuleType` in URLPath isn't at all set up to query the database when given a gateway set to figure out which type to return. I'm not fond of any of the following fixes, but they could all be made to work
- Remove proctored_quiz_mode from the URLPath listing and modify GatewayQuiz.pm to deal with everything internally.
- Add a separate module (like GatewayQuizProctor.pm) as a wrapper for GatewayQuiz.pm for proctored gateways so that the different paths can have different modules.
- Hack URLPath so that if it is being asked for a gateway page, it actually checks the database to see which type of gateway and returns the right thing.

I think the current fix is the right one for master, since it has a minimal footprint. I'm open to suggestions on a more permanent fix. (In particular until it gets fixed anyone who does anything with newFromPath making a link to a gateway will be asking for trouble.)