I'm working on porting this module to Drupal 6 though this is a first for me. I have attached the module as far as I've been able to complete is. Hopefully I haven't messed anything up.
I believe I have everything updated for drupal 6 except for the following (I'm not super familiar with SQL and haven't had time to study into this further):
role_help.module
Line 327: In SQL strings, Use db_query() placeholders in place of variables. This is a potential source of SQL injection attacks when the variable can come from user data. (http://drupal.org/writing-secure-code)
$result = db_query("SELECT name, description FROM {role} r INNER JOIN {role_help} h ON r.rid = h.rid WHERE r.rid IN ($placeholders) ORDER BY r.rid", $user_rids );
Line 329: db_num_rows() has been deprecated (http://drupal.org/node/114774#db-num-rows)
if (db_num_rows($result) == 0) {
role_help.install
Line 42: A new schema API has been added in 6.x (http://drupal.org/node/146843)
switch ($GLOBALS['db_type']) {
Line 45: Use the new Schema API to create and drop tables rather than db_query() (http://drupal.org/node/146862)
db_query("CREATE TABLE {role_help} (
Line 53: Use the new Schema API to create and drop tables rather than db_query() (http://drupal.org/node/146862)
db_query("CREATE TABLE {role_help} (
| Comment | File | Size | Author |
|---|---|---|---|
| role_help.zip | 11.98 KB | deggertsen |
Comments
Comment #1
joachim commentedWell it trashed my test site to a WSOD .... lol!
But it's a start :)
BTW, looking at the comments in the file it seems you used an automatic system to convert stuff. If so, it got hook_schema wrong: descriptions there aren't put through t() -- at least, core doesn't do that. You might want to file a but on that. Is it coder module?
I've started a 6 branch and committed your changes to it, plus a more changes of my own.
It now appears to work normally, though there are a few TODO items left.
I'll close this issue and if you want to give the dev version a whirl, report any problems as new issues.
Thanks for submitting this, it's been a huge help! :D
Comment #2
deggertsen commentedInteresting that it trashed your test site. It definitely wasn't working as expected for me but it wasn't breaking anything else.
I did use Deadwood to do an automatic conversion of a lot but then I used coder for the rest. Maybe I should have just used coder for the whole thing... I'm new to this whole thing and am a novice programmer but I didn't want to put in a request for porting this without giving it a try...
Thanks for your work! I'll let you know how my trial of the dev goes.
Comment #3
joachim commentedYeha dunno what the WSOD was about... I wiped the cache tables in the DB and it was okay again.
I really do appreciate your efforts here. And congratulations on getting your start at programming :)
Comment #4
deggertsen commentedEverything looks good! I don't see any errors and it looks like everything is working fine.
I do have feature requests but I'll post in another issue.