Hi,

I moved rules from sites/all/modules/ to sites/all/modules/contrib and got this error:

PHP Fatal error:  Class 'RulesEventHandlerEntityBundle' not found in /path/to/drupal/sites/all/modules/contrib/rules/modules/node.rules.inc on line 147

It seems that the module registry is confused, and even when running Registry Rebuild, the problem remains.

It couldn't hurt to specifically load the parent class, no?

Files: 
CommentFileSizeAuthor
#1 2109281-1-rules-load-parent-class.patch377 bytesalberto56
PASSED: [[SimpleTest]]: [MySQL] 351 pass(es).
[ View ]

Comments

alberto56’s picture

Status:Active» Needs review
StatusFileSize
new377 bytes
PASSED: [[SimpleTest]]: [MySQL] 351 pass(es).
[ View ]

Here is a patch

decibel.places’s picture

unfortunately, when I add module_load_include('inc', 'rules', 'includes/rules.event'); to node.rules.inc manually as in

@@ -140,6 +140,7 @@ function rules_node_admin_access() {
   return user_access('administer nodes');
}

+module_load_include('inc', 'rules', 'includes/rules.event');

/**
  * Event handler support node bundle event settings.

I get all kinds of new errors

on the screen:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.owner' in 'where clause': SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.access_exposed AS access_exposed, base.data AS data FROM {rules_config} base WHERE (base.plugin = :db_condition_placeholder_0) AND (base.active = :db_condition_placeholder_1) AND (base.owner = :db_condition_placeholder_2) ; Array ( [:db_condition_placeholder_0] => reaction rule [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2] => rules ) in EntityAPIController->query() (line 187 of /var/www/site_name/sites/all/modules/contrib/entity/includes/entity.controller.inc).

decibelplaces@littlewing:/var/www/site_name$ drush cc all
call_user_func_array() expects parameter 1 to be a valid callback,   [warning]
function 'rules_condition_node_is_of_type_assertions' not found or
invalid function name faces.inc:123
call_user_func_array() expects parameter 1 to be a valid callback,   [warning]
function 'rules_condition_node_is_of_type_assertions' not found or
invalid function name faces.inc:123
call_user_func_array() expects parameter 1 to be a valid callback,   [warning]
function 'rules_condition_node_is_of_type_assertions' not found or
invalid function name faces.inc:123
'all' cache was cleared in self                                      [success]
decibelplaces@littlewing:/var/www/site_name$ drush cc all
WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown[error]
column 'base.owner' in 'field list': SELECT base.id AS id, base.name
AS name, base.label AS label, base.plugin AS plugin, base.active AS
active, base.weight AS weight, base.status AS status, base.dirty AS
dirty, base.module AS module, base.owner AS owner,
base.access_exposed AS access_exposed, base.data AS data
FROM
{rules_config} base
WHERE  (base.status IN  (:db_condition_placeholder_0,
:db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array
(
    [:db_condition_placeholder_0] => 3
    [:db_condition_placeholder_1] => 2
    [:db_condition_placeholder_2] => 6
)
in EntityAPIController->query() (line 187 of
/var/www/site_name/sites/all/modules/contrib/entity/includes/entity.controller.inc).
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.owner' in 'field list': SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.owner AS owner, base.access_exposed AS access_exposed, base.data AS data
FROM
{rules_config} base
WHERE  (base.status IN  (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array
(
    [:db_condition_placeholder_0] => 3
    [:db_condition_placeholder_1] => 2
    [:db_condition_placeholder_2] => 6
)
in EntityAPIController->query() (line 187 of /var/www/site_name/sites/all/modules/contrib/entity/includes/entity.controller.inc).
Drush command terminated abnormally due to an unrecoverable error.   [error]
decibelplaces@littlewing:/var/www/site_name$ drush pmi rules
WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown[error]
column 'base.owner' in 'field list': SELECT base.id AS id, base.name
AS name, base.label AS label, base.plugin AS plugin, base.active AS
active, base.weight AS weight, base.status AS status, base.dirty AS
dirty, base.module AS module, base.owner AS owner,
base.access_exposed AS access_exposed, base.data AS data
FROM
{rules_config} base
WHERE  (base.plugin IN  (:db_condition_placeholder_0,
:db_condition_placeholder_1, :db_condition_placeholder_2,
:db_condition_placeholder_3, :db_condition_placeholder_4)) AND
(base.access_exposed = :db_condition_placeholder_5) ; Array
(
    [:db_condition_placeholder_0] => or
    [:db_condition_placeholder_1] => and
    [:db_condition_placeholder_2] => action set
    [:db_condition_placeholder_3] => rule
    [:db_condition_placeholder_4] => rule set
    [:db_condition_placeholder_5] => 1
)
in EntityAPIController->query() (line 187 of
/var/www/site_name/sites/all/modules/contrib/entity/includes/entity.controller.inc).
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.owner' in 'field list': SELECT base.id AS id, base.name AS name, base.label AS label, base.plugin AS plugin, base.active AS active, base.weight AS weight, base.status AS status, base.dirty AS dirty, base.module AS module, base.owner AS owner, base.access_exposed AS access_exposed, base.data AS data
FROM
{rules_config} base
WHERE  (base.plugin IN  (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, :db_condition_placeholder_3, :db_condition_placeholder_4)) AND (base.access_exposed = :db_condition_placeholder_5) ; Array
(
    [:db_condition_placeholder_0] => or
    [:db_condition_placeholder_1] => and
    [:db_condition_placeholder_2] => action set
    [:db_condition_placeholder_3] => rule
    [:db_condition_placeholder_4] => rule set
    [:db_condition_placeholder_5] => 1
)
in EntityAPIController->query() (line 187 of /var/www/site_name/sites/all/modules/contrib/entity/includes/entity.controller.inc).
Drush command terminated abnormally due to an unrecoverable error.   [error]

I have had to revert rules to 7.x-2.3

AND the errors do not go away until rules modules are disabled, AND rules_admin is only enabled after rules

decibelplaces@littlewing:/var/www/site_name$ drush  en rules, logintoboggan_rules, rules_admin, rules_scheduler -y
The following extensions will be enabled: rules, logintoboggan_rules, rules_admin, rules_scheduler
Do you really want to continue? (y/n): y

WD php: DatabaseSchemaObjectExistsException: Table rules_config      [error]
already exists. in DatabaseSchema->createTable() (line 657 of
/var/www/site_name/includes/database/schema.inc).
Cannot modify header information - headers already sent by (output   [warning]
started at /usr/share/php/drush/includes/output.inc:38)
bootstrap.inc:1216
DatabaseSchemaObjectExistsException: Table <em class="placeholder">rules_config</em> already exists. in DatabaseSchema->createTable() (line 657 of /var/www/site_name/includes/database/schema.inc).
Drush command terminated abnormally due to an unrecoverable error.   [error]
decibelplaces@littlewing:/var/www/site_name$ drush en rules_admin -y
The following extensions will be enabled: rules_admin
Do you really want to continue? (y/n): y
rules_admin was enabled successfully.                                [ok]

the errors suggest that hook_install or some other function tries to create a table on enabling the module, even if it already exists...

fago’s picture

Status:Needs review» Closed (works as designed)

I see the problem, but imo it's a general problem of d7'registry. Following that pattern, we'd not use it anymore - which I think isn't reasonable. Stuff like registry rebuild should help you while moving.

decibel.places’s picture

@fago no I don't think it's a registry issue - it's some dependency among the separate modules, that was broken by the patch and only fixed by er-enabling them in a specific order.