From e0b164146419d90b9fc258af504ad87dc1ae7627 Mon Sep 17 00:00:00 2001
From: Jakob Perry <japerry@45640.no-reply.drupal.org>
Date: Thu, 3 Dec 2015 15:55:30 -0800
Subject: [PATCH] 1637304

---
 panelizer.install                               | 14 ++++++++++++++
 plugins/entity/PanelizerEntityDefault.class.php |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/panelizer.install b/panelizer.install
index 2d7506d..8874753 100644
--- a/panelizer.install
+++ b/panelizer.install
@@ -255,6 +255,13 @@ function panelizer_schema_4() {
   return $schema;
 }
 
+function panelizer_schema_5() {
+  $schema = panelizer_schema_4();
+  $schema['panelizer_entity']['indexes']['revision_id'] = array('revision_id');
+
+  return $schema;
+}
+
 /**
  * Implements hook_install().
  */
@@ -1172,3 +1179,10 @@ function panelizer_update_7122() {
   }
 }
 
+/**
+ * Add an index to panelizer entity revision ids.
+ */
+function panelizer_update_7123() {
+  $schema = panelizer_schema_5();
+  db_add_index('panelizer_entity', 'revision_id', $schema['panelizer_entity']['indexes']['revision_id']);
+}
diff --git a/plugins/entity/PanelizerEntityDefault.class.php b/plugins/entity/PanelizerEntityDefault.class.php
index 921f7cc..4b4938e 100644
--- a/plugins/entity/PanelizerEntityDefault.class.php
+++ b/plugins/entity/PanelizerEntityDefault.class.php
@@ -1430,7 +1430,7 @@ abstract class PanelizerEntityDefault implements PanelizerEntityInterface {
 
     // Load all the panelizers associated with the list of entities.
     if ($this->supports_revisions) {
-      $result = db_query("SELECT * FROM {panelizer_entity} WHERE entity_type = :entity_type AND entity_id IN (:ids) AND revision_id IN (:vids)", array(':entity_type' => $this->entity_type, ':ids' => $ids, ':vids' => $vids));
+      $result = db_query("SELECT * FROM {panelizer_entity} WHERE entity_type = :entity_type AND revision_id IN (:vids)", array(':entity_type' => $this->entity_type, ':vids' => $vids));
     }
     else {
       $result = db_query("SELECT * FROM {panelizer_entity} WHERE entity_type = :entity_type AND entity_id IN (:ids)", array(':entity_type' => $this->entity_type, ':ids' => $ids));
-- 
2.4.9 (Apple Git-60)

