2009/7/9 Kyle Hall <kyle.m.hall@gmail.com>
Is there any way to limit access to Context->dbh to only the C4
Modules? Being able to enforce coding guidelines would be nice.

Kyle

http://www.kylehall.info
Information Technology
Crawford County Federated Library System ( http://www.ccfls.org )

This might, in theory, be possible. It might be easier to simply excise the offending statements, however.

The following quickly written shell command brings up a list of all CGI scripts that reference C4::Context->dbh:

$ find -name '*.pl' | xargs grep -l 'new CGI' | grep -v sms | xargs grep -l 'C4::Context->dbh'

Some of these entries are due to older, crustier parts of the API that still require passing $dbh, which is fairly easy to fix.

The admin/ scripts are the worst offenders, but there is plenty else to keep us busy. (Creating a module like C4::Admin to house the necessary SQL from the admin scripts would be a worthwhile separate discussion.)

A quick search on Bugzilla didn't find anything related to this, but I could easily have missed it. If not, we should create a tracking bug for this purpose.

--
Jesse Weaver