The README.txt is misleading in that it suggests that you need to manually create the forward_log table using the supplied forward.mysql file.

Most modules now use a .install file to automate this process, but this module doesn't have one.

Since I have written a few of these in the past, I quickly knocked one together which I hoped to contribute to this project. However, when I tested it, I found that the forward.module file already defines the forward_install() function.

For consistency, this function should really be moved to a .install file, and the README.txt should be updated to say that table creation is now automatic.

Comments

Gman’s picture

StatusFileSize
new1.21 KB

Here is the install function pealed out of the .module file. I also update a bit of the text. Moving the function to the .install file makes it so that the tables are made during module installation. The 4.7 readme should probably be updated to note that the tables do not need to be installed manually.

Thanks for the cool module, just trying to help in little ways.

-Greg

Gman’s picture

StatusFileSize
new1.11 KB

Arrgh. Attached an old file. Here is the current one. :)

seanr’s picture

Actually, it works with the install function in the .module file. I'm not sure what the advantage to having a whole extra file for a single function is.

budda’s picture

The install file is only loaded on the admin/modules page. Removing it from the main module, reduces the amount of PHP loaded and parsed during normal site usage - i.e. on every page.

As the _install() is short in this case it's probably not a major issue, but it seems to be the "norm" in Drupal modules to include a .install file.

Tobias Maier’s picture

Status: Active » Needs work

replace create table if not exists
with create table
put CREATE index idx_forward_log_nid on forward_log (nid);
into its own db_query() and add braces around forward_log
no other module does this $success = TRUE;
--> remove it or let it do a real check (if db_query !== false, for example http://api.drupal.org/api/4.7/function/db_query)

remove ?>

budda’s picture

The views.module does the $sucess = TRUE

seanr’s picture

I think I'll trust merlinofchaos's judgment on that one. ;)

Gman’s picture

StatusFileSize
new1.08 KB

I have seen the success = TRUE a few times, but more often I have seen the construct

$query = db_query("...

followed by an

if ($query) {

statement. I have updated the file and reattached. I don't have PostgreSQL, so I haven't tested that portion, but the two references I check say the syntax is correct.

Thanks for letting me help out in small ways. I am hoping to learn the Drupal way quickly and make more substantial contributions as I may. -Greg

Tobias Maier’s picture

thanks gman for your work,

since drupal 4.7 we try to make all databases "engine agnostic"
means we removed all TYPE=MyISAM

and we remove all ?>
at the end of a php files

see this http://drupal.org/node/22218#utf8_sql
please add utf8 support to the sql scheme

if you upload a new file set the status to code needs review

cu tobi

Gman’s picture

Assigned: Unassigned » Gman
Status: Needs work » Needs review
StatusFileSize
new1.32 KB

Yes, I noticed I hadn't updated the status until after I hit submit. I have updated the .install file as indicated and also attached a diff patch to the actual module that removes the install function.

Thanks. -Greg

seanr’s picture

Status: Needs review » Fixed

Done in HEAD and DRUPAL-4-7. Thanks.

Tobias Maier’s picture

thank you for commiting this patch
I want to hand you over to http://drupal.org/node/72504
which has update path for the UTF8 db-part
and some other small fixes and corrections (which are a lot in the end)

Anonymous’s picture

Status: Fixed » Closed (fixed)