Skip to content

Instantly share code, notes, and snippets.

@chrisns
Created August 8, 2011 15:22
Show Gist options
  • Save chrisns/1131944 to your computer and use it in GitHub Desktop.
Save chrisns/1131944 to your computer and use it in GitHub Desktop.
workflow patch to disable static cache in initial migration
diff --git workflow.module workflow.module
index de9becd..01b7033 100644
--- workflow.module
+++ workflow.module
@@ -753,7 +753,10 @@ function workflow_node_current_state($node) {
* The ID of the workflow.
*/
function _workflow_creation_state($wid) {
- static $cache;
+ global $initial_migration;
+ if (!$initial_migration) {
+ static $cache;
+ }
if (!isset($cache[$wid])) {
$result = db_result(db_query("SELECT sid FROM {workflow_states} WHERE wid = %d AND sysid = %d", $wid, WORKFLOW_CREATION));
$cache[$wid] = $result;
@@ -981,7 +984,10 @@ function workflow_get_name($wid) {
* The ID of the workflow or FALSE if no workflow is mapped to this type.
*/
function workflow_get_workflow_for_type($type) {
- static $cache;
+ global $initial_migration;
+ if (!$initial_migration) {
+ static $cache;
+ }
if(!isset($cache[$type])) {
$wid = db_result(db_query("SELECT wid FROM {workflow_type_map} WHERE type = '%s'", $type));
$cache[$type] = $wid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment