Hi there. I have an issue with webforms not saving redirect url. I decided to update after cruising the forums. Updated from 5.x-2.0 to 5.x-2.1.1, ran update.php and WHAM form components gone!

I restored the old version of webforms and restored the old webform tables into my database.

In order to supply as much info as possible (as requested in http://drupal.org/node/276979) i repeat the process.

unzipped webforms5.x-2.1.1 to sites/all/modules
run update.php - webform update 5201. This time no errors were displayed (im sure there was one the first time i updated)
AND my components are still there this time
Also, the first time i updated whenever i tried to edit the form i was given messages about the form being submitted. These errors did not occur this time.

Another wierd thing, I was able to save the redirect url in the first update (where the components dissappeared) but now, with the non-errored update, I cannot save the redirect url. Stranger and stranger. I'll lodge that as its own issue...

So, sorry, I was hoping to supply more info and could not. Also I guess this issue of mine is closed. *sigh*

CommentFileSizeAuthor
#9 webform_5x1x_6x2x.patch2.14 KBquicksketch

Comments

UnicornSong’s picture

further to this topic, i moved to my local copy to try to get this all working, had to run updates webform 5.x-2.0 (with email functionality added)
The same thing happened! components disappeared. here is the sql error i received for this one:

user warning: Duplicate entry '33-1-65535-0' for key 1 query: ALTER TABLE webform_submitted_data CHANGE cid cid smallint unsigned NOT NULL default '0' in C:\xampp\htdocs\drupal-5.7\includes\database.mysql.inc on line 172.

Which sounded a lot like the one i got on the live server with the latest update for 5.x-2.1.1. It is important at this point to note that i had added the email functionality to my local webforms as per the issue here http://drupal.org/node/233627 which i believe you have rolled into 5.x-2.1.1?

webform module
Update #13
UPDATE {system} SET weight = -1 WHERE type = 'module' and name = 'webform'
DELETE FROM {webform} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
DELETE FROM {webform_component} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
DELETE FROM {webform_submissions} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
DELETE FROM {webform_submitted_data} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
UPDATE {webform_component} SET cid = 1 WHERE nid = 34 AND cid = 1203462064
UPDATE {webform_component} SET pid = 1 WHERE nid = 34 AND pid = 1203462064
UPDATE {webform_submitted_data} SET cid = 1 WHERE nid = 34 AND cid = 1203462064
UPDATE {webform_component} SET cid = 2 WHERE nid = 34 AND cid = 1203462098
UPDATE {webform_component} SET pid = 2 WHERE nid = 34 AND pid = 1203462098
UPDATE {webform_submitted_data} SET cid = 2 WHERE nid = 34 AND cid = 1203462098
UPDATE {webform_component} SET cid = 3 WHERE nid = 34 AND cid = 1203462130
UPDATE {webform_component} SET pid = 3 WHERE nid = 34 AND pid = 1203462130
UPDATE {webform_submitted_data} SET cid = 3 WHERE nid = 34 AND cid = 1203462130
UPDATE {webform_component} SET cid = 4 WHERE nid = 34 AND cid = 1203462172
UPDATE {webform_component} SET pid = 4 WHERE nid = 34 AND pid = 1203462172
UPDATE {webform_submitted_data} SET cid = 4 WHERE nid = 34 AND cid = 1203462172
UPDATE {webform_component} SET cid = 5 WHERE nid = 34 AND cid = 1203632543
UPDATE {webform_component} SET pid = 5 WHERE nid = 34 AND pid = 1203632543
UPDATE {webform_submitted_data} SET cid = 5 WHERE nid = 34 AND cid = 1203632543
UPDATE {webform_component} SET cid = 6 WHERE nid = 34 AND cid = 1203632654
UPDATE {webform_component} SET pid = 6 WHERE nid = 34 AND pid = 1203632654
UPDATE {webform_submitted_data} SET cid = 6 WHERE nid = 34 AND cid = 1203632654
UPDATE {webform_component} SET cid = 7 WHERE nid = 34 AND cid = 1203632782
UPDATE {webform_component} SET pid = 7 WHERE nid = 34 AND pid = 1203632782
UPDATE {webform_submitted_data} SET cid = 7 WHERE nid = 34 AND cid = 1203632782
UPDATE {webform_component} SET cid = 8 WHERE nid = 34 AND cid = 1203632901
UPDATE {webform_component} SET pid = 8 WHERE nid = 34 AND pid = 1203632901
UPDATE {webform_submitted_data} SET cid = 8 WHERE nid = 34 AND cid = 1203632901
UPDATE {webform_component} SET cid = 9 WHERE nid = 34 AND cid = 1203633036
UPDATE {webform_component} SET pid = 9 WHERE nid = 34 AND pid = 1203633036
UPDATE {webform_submitted_data} SET cid = 9 WHERE nid = 34 AND cid = 1203633036
UPDATE {webform_component} SET cid = 1 WHERE nid = 43 AND cid = 1203634250
UPDATE {webform_component} SET pid = 1 WHERE nid = 43 AND pid = 1203634250
UPDATE {webform_submitted_data} SET cid = 1 WHERE nid = 43 AND cid = 1203634250
UPDATE {webform_component} SET cid = 2 WHERE nid = 43 AND cid = 1203636860
UPDATE {webform_component} SET pid = 2 WHERE nid = 43 AND pid = 1203636860
UPDATE {webform_submitted_data} SET cid = 2 WHERE nid = 43 AND cid = 1203636860
UPDATE {webform_component} SET cid = 3 WHERE nid = 43 AND cid = 1203636924
UPDATE {webform_component} SET pid = 3 WHERE nid = 43 AND pid = 1203636924
UPDATE {webform_submitted_data} SET cid = 3 WHERE nid = 43 AND cid = 1203636924
UPDATE {webform_component} SET cid = 4 WHERE nid = 43 AND cid = 1203636972
UPDATE {webform_component} SET pid = 4 WHERE nid = 43 AND pid = 1203636972
UPDATE {webform_submitted_data} SET cid = 4 WHERE nid = 43 AND cid = 1203636972
UPDATE {webform_component} SET cid = 5 WHERE nid = 43 AND cid = 1203637010
UPDATE {webform_component} SET pid = 5 WHERE nid = 43 AND pid = 1203637010
UPDATE {webform_submitted_data} SET cid = 5 WHERE nid = 43 AND cid = 1203637010
UPDATE {webform_component} SET cid = 6 WHERE nid = 43 AND cid = 1203637064
UPDATE {webform_component} SET pid = 6 WHERE nid = 43 AND pid = 1203637064
UPDATE {webform_submitted_data} SET cid = 6 WHERE nid = 43 AND cid = 1203637064
UPDATE {webform_component} SET cid = 7 WHERE nid = 43 AND cid = 1203637114
UPDATE {webform_component} SET pid = 7 WHERE nid = 43 AND pid = 1203637114
UPDATE {webform_submitted_data} SET cid = 7 WHERE nid = 43 AND cid = 1203637114
UPDATE {webform_component} SET cid = 8 WHERE nid = 43 AND cid = 1203637176
UPDATE {webform_component} SET pid = 8 WHERE nid = 43 AND pid = 1203637176
UPDATE {webform_submitted_data} SET cid = 8 WHERE nid = 43 AND cid = 1203637176
UPDATE {webform_component} SET cid = 9 WHERE nid = 43 AND cid = 1203637223
UPDATE {webform_component} SET pid = 9 WHERE nid = 43 AND pid = 1203637223
UPDATE {webform_submitted_data} SET cid = 9 WHERE nid = 43 AND cid = 1203637223
UPDATE {webform_component} SET cid = 10 WHERE nid = 43 AND cid = 1203637993
UPDATE {webform_component} SET pid = 10 WHERE nid = 43 AND pid = 1203637993
UPDATE {webform_submitted_data} SET cid = 10 WHERE nid = 43 AND cid = 1203637993
ALTER TABLE {webform_component} CHANGE cid cid smallint unsigned NOT NULL default '0'
ALTER TABLE {webform_component} CHANGE pid pid smallint unsigned NOT NULL default '0'
Failed: ALTER TABLE {webform_submitted_data} CHANGE cid cid smallint unsigned NOT NULL default '0'
Update #14
No queries
Update #15
No queries
Update #16
ALTER TABLE {webform} DROP redirect_post
ALTER TABLE {webform} ADD teaser tinyint NOT NULL DEFAULT 0 AFTER confirmation
ALTER TABLE {webform} ADD submit_text varchar(255) NULL DEFAULT NULL AFTER teaser
Update #17
UPDATE {webform} SET submit_interval = -1 WHERE submit_interval = 157784630
Update #18
UPDATE {webform} SET email_from_address = '2' WHERE nid = 34
UPDATE {webform} SET email_subject = '4' WHERE nid = 34
Update #19
No queries
Update #20
ALTER TABLE {webform_submissions} DROP INDEX sid
ALTER TABLE {webform_submissions} DROP PRIMARY KEY
ALTER TABLE {webform_submissions} ADD UNIQUE INDEX sid_nid (sid, nid)
ALTER TABLE {webform_submissions} ADD PRIMARY KEY (sid)
ALTER TABLE {webform_submitted_data} DROP PRIMARY KEY
ALTER TABLE {webform_submitted_data} DROP INDEX sid
ALTER TABLE {webform_submitted_data} CHANGE no no tinyint NOT NULL DEFAULT 0
ALTER TABLE {webform_submitted_data} ADD PRIMARY KEY (sid, cid, no)
ALTER TABLE {webform_submitted_data} ADD INDEX nid (nid)
ALTER TABLE {webform_submitted_data} ADD INDEX sid_nid (sid, nid)
Update #5200
ALTER TABLE {webform_component} CHANGE name name varchar(255) DEFAULT NULL
Update #5201
ALTER TABLE {webform_component} ADD email int(1) UNSIGNED NOT NULL DEFAULT '0'
UPDATE {webform_component} SET email = 1

Hope this all helps pin the problem down?

quicksketch’s picture

Whoa, hang on here! That update you're reporting that does the "ALTER TABLE webform_submitted_data CHANGE cid cid smallint unsigned NOT NULL default '0'" is webform_update_13. Which should have been ran when you updated from Webform 1.9 (or 1.10) to 2.0. There's no reason why that update should be ran between 2.0 and 2.1.1. Now I'm really confused.

So. It sounds like all your components were wiped when webform_update_13 was ran twice, which sounds possible. When the update was ran on your site and it properly started at update 5201, everything ran fine. This indeed is very strange. Please let me know if any more information becomes available.

UnicornSong’s picture

No, we need to start again. I will run through the process again without the patched version. Our live site has lost all its components now (oops left the updated module on the server and this caused errors for our live site, so the boss updated the Db - argh), and that was not using the patch.
Worthwhile to note that when the components dissappear I get watchdog errors like this one:

Warning: Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', 'Unknown column 'email' in 'field list'\nquery: INSERT INTO webform_component (nid, cid, pid, form_key, name, type, value, extra, mandatory, weight, email) VALUES (33, 1203638413, 0, 'organisation', 'Name of Organisation', 'textfield', '', 'a:3:{s:11:\\"description\\";s:0:\\"\\";s:9:\\"maxlength\\";s:3:\\"100\\";s:5:\\"width\\";s:2:\\"50\\";}', 1, -10, 0) in C:\\xampp\\htdocs\\drupal-5.7\\includes\\database.mysql.inc on line 172

Anyway, like I say, Im still working on this problem, and will start again and update....
sorry :)

UnicornSong’s picture

Status: Active » Closed (fixed)

OMG. well I've spent 4 hours trying to track this. Funnily today I cant get any of my local sites to have this error.

Strangely my other issue seems to be overcome today also, must have had something to do with all the restores I did yesterday. today update.php told me i had updates 1-20 and 5200 to run on 5.x-2.0 so i ran them, received errors but now the webform is saving my redirect url. Sweet.

I suspect you may be right, where this issue may be caused by other updates running at the same time?

Closing this issue and running away fast... (still using 5.x-2.0 though!)

quicksketch’s picture

Ha, okay. Please open a new issue if this occurs though. I don't want the guilt of wiping people's databases on my conscious. :)

shusheer’s picture

Category: task » bug
Priority: Critical » Normal

Hi Guys,

I'm doing a Drupal 5.7 / Webform 5.x-1.10 upgrade to Drupal 6.4 / Webform 6.x-2.1.3, and am experiencing what appears to be exactly this problem (lost components). I've been battling with it for a few hours, but as I am quite new to Drupal, I'm hoping one of you has found the solution to this in the last couple of months.

The relevant line from the system table in each is (note that table structure changed between versions):

Drupal 5:
INSERT INTO `system` (`filename`, `name`, `type`, `description`, `status`, `throttle`, `bootstrap`, `schema_version`, `weight`) VALUES
('sites/all/modules/webform/webform.module', 'webform', 'module', 'Enables the creation of forms and questionnaires.', 1, 0, 0, 12, 0);

Drupal 6:
INSERT INTO `system` (`filename`, `name`, `type`, `status`, `throttle`, `bootstrap`, `schema_version`, `weight`, `info`, `owner`) VALUES
('sites/all/modules/webform/webform.module', 'webform', 'module', 1, 0, 0, 6204, -1, 'a:9:{s:4:"name";s:7:"Webform";s:11:"description";s:49:"Enables the creation of forms and questionnaires.";s:4:"core";s:3:"6.x";s:7:"version";s:9:"6.x-2.1.3";s:7:"project";s:7:"webform";s:9:"datestamp";s:10:"1218174017";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}', '');

When running update.php I also get the update #13 discussed above, but I _AM_ upgrading from 5.10 all the way, so this makes sense:

Update #13

# UPDATE {system} SET weight = -1 WHERE type = 'module' and name = 'webform'
# DELETE FROM {webform} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
# DELETE FROM {webform_component} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
# DELETE FROM {webform_submissions} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
# DELETE FROM {webform_submitted_data} WHERE nid NOT IN (SELECT nid FROM {node} WHERE type = 'webform')
# UPDATE {webform_component} SET cid = 1 WHERE nid = 495 AND cid = 1204928757
# UPDATE {webform_component} SET pid = 1 WHERE nid = 495 AND pid = 1204928757
# UPDATE {webform_submitted_data} SET cid = 1 WHERE nid = 495 AND cid = 1204928757
... lots of similar lines to the above 3 cut out ...
# ALTER TABLE {webform_component} CHANGE cid cid smallint unsigned NOT NULL default '0'
# ALTER TABLE {webform_component} CHANGE pid pid smallint unsigned NOT NULL default '0'
# ALTER TABLE {webform_submitted_data} CHANGE cid cid smallint unsigned NOT NULL default '0'

Although I can see the results of forms, when I now go to view a webform as a user I get the following displayed:
"Submissions for this form are closed."
From a quick search I see that this is probably because no permissions have been given. So I edit the form, and add permissions for both anon and auth users. Then on clicking save I get a very similar error to the next one described above (actually, depending on which form I edit, I get several similar ones at a time):

Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:619:\"Unknown column 'email' in 'field list'\nquery: INSERT INTO webform_component (nid, cid, pid, form_key, name, type, value, extra, mandatory, weight, email) VALUES (776, 2, 0, 'what_do_you_think_of_the_new_site_in_general', 'What do you think of the new site in general', 'select', '', 'a:4:{s:5:\\"items\\";s:59:\\"I love it!\\r\\nI like it\\r\\nIt\\'s OK\\r\\nI don\\'t like it\\r\\nI hate it!\\";s:11:\\"description\\";s:0:\\"\\";s:6:\\"a in /thesite/public/includes/database.mysql.inc on line 128

Any suggestions most appreciated (and my apologies for re-opening the issue - but this seemed the most comprehensive threat to open it under).

zipho’s picture

Has anybody found a solution or a patch for this issue yet?

Thanks;

UnicornSong’s picture

Status: Closed (fixed) » Active

Well it might help to re-open the issue so Quicksketch can see it. Doing so now. I was unable to replicate the issue myself, hopefully you two can give him more info....

quicksketch’s picture

StatusFileSize
new2.14 KB

Thanks zipho for the reports (and UnicornSong for reopening the issue). It looks like the update is failing in 2 places: setting permissions (webform_update_6202) and adding the "email" column to the webform_components table (webform_update_6201). Did you see these two updates run when you did the upgrade?

You might try updating in the following order:
- Webform 5.x-1.10
- Webform 5.x-2.1.3
- Webform 6.x-2.1.3

I think what's happening here is that many of the 62xx updates are being skipped, since Webform has protections in place to prevent the same update from being run twice when upgrading from Drupal 5 2.x to Drupal 6 2.x. However it looks like they're a little aggressive in skipping updates, and they don't get run at all when moving direct from a 1.x version in Drupal 5 to the 2.x version in Drupal 6.

I think this patch will fix the problem (you'll need to run the upgrade again after restoring a database backup). Please let me know if it works for you.

quicksketch’s picture

Status: Active » Needs review
quicksketch’s picture

After a few hours of testing, I've found this patch definitely does *not* work. :/

I thought it had been possible to selectively run update functions depending on the user's previous version of Webform, but in actually, this seems to be impossible in Drupal 6 (or at least very difficult and untypical). I think the very best you can do is be sure to upgrade your Drupal 5 site to the latest Drupal 5 2.x version first, then run the update to Drupal 6.

On the Webform end, I can provide an informational hook to Drupal's updater telling the user that they need to update to a newer version of Webform before upgrading to Drupal 6, preventing the updates from being run at all.

quicksketch’s picture

Status: Needs review » Fixed

Okay, I took a completely different approach that seems to work much better. Rather than trying to check the existing schema versions, this change makes it so that Webform simply checks directly if an update has already been run by looking for the existence of columns or tables. I tested all of the following upgrades and seems to work perfect:

- Webform 1.10 (D5) to 2.1.3 (D6)
- Webform 2.0 (D5) to 2.1.3 (D6)
- Webform 2.1.3 (D5) to 2.1.3 (D6)

I'll get out a 2.2 version of Webform that includes these changes so hopefully we can save other users the same trouble.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

wwwna’s picture

Is there any way to use webforms on an updated drupal 6?

webform module can not be updated. Its schema version is 12. Updates up to and including 20 have been removed in this release. In order to update webform module, you will first need to upgrade to the last version in which these updates were available.

I don't care if my oldest forms are erased I just think is not a good idea to update my whole site to version 7 just to get this module work.