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.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | forward.patch.zip | 1.32 KB | Gman |
| #8 | forward_2.install.txt | 1.08 KB | Gman |
| #2 | forward_1.install | 1.11 KB | Gman |
| #1 | forward_0.install | 1.21 KB | Gman |
Comments
Comment #1
Gman commentedHere 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
Comment #2
Gman commentedArrgh. Attached an old file. Here is the current one. :)
Comment #3
seanrActually, 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.
Comment #4
buddaThe 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.
Comment #5
Tobias Maier commentedreplace
create table if not existswith
create tableput
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
?>Comment #6
buddaThe views.module does the
$sucess = TRUEComment #7
seanrI think I'll trust merlinofchaos's judgment on that one. ;)
Comment #8
Gman commentedI 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
Comment #9
Tobias Maier commentedthanks gman for your work,
since drupal 4.7 we try to make all databases "engine agnostic"
means we removed all
TYPE=MyISAMand 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
Comment #10
Gman commentedYes, 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
Comment #11
seanrDone in HEAD and DRUPAL-4-7. Thanks.
Comment #12
Tobias Maier commentedthank 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)
Comment #13
(not verified) commented