In the process of building a general workflow import/export I found that it is difficult to interact with the workflow_types_save function because it requires you to call it with the current map of all content types and the associated workflow ID.

The attached patch performs the delete query on a per content type basis which is slightly slower but allows the function to be called with a single type -> wid pair and only adds/updates that single pair.

Consider the current steps to call this function:
1) Get the list of content types
2) Query to get the currently associated workflow if there is any for those content types
3) Massage that data into the format expected by workflow_types_save
4) Merge in the new data
5) call workflow_types_save($array)

And the new steps:
1) call workflow_types_save(array('your_type' => $your_workflow_id)

Comments

greggles’s picture

Status: Active » Needs review
StatusFileSize
new836 bytes

and the patch...

I think that the small performance/scalability drawback is offset by the improved ease of use of this function.

greggles’s picture

Status: Needs review » Needs work

jvandyk mentioned in irc that this seemed to him like it could leave the table in an inconsistent state.

I'd be happy to provide this as a separate function so that the form submission still guarantees a clean table, but in order for #216731: workflow import/export to work I think we'll need something like this.

Any feedback on this alternate solution?

Bastlynn’s picture

Status: Needs work » Closed (won't fix)

Hi,

With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.

- Bastlynn