Closed (fixed)
Project:
Taxonomy Entity Index
Version:
7.x-1.0-beta4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Jul 2011 at 09:47 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sebastian.haas commentedBump. I would appreciate that too
Comment #2
sebastian.haas commentedI created a basic UI to make a batch call to
taxonomy_entity_index_reindex_entity_type. Since I'm new to Drupal, I don't know much about the Entity API and I don't have much time I left the part where it comes to retrieving a list of all entity types aside and just implemented it fornode.However, the basic structure is designed in a way that shouldn't make it too hard to add this additional functionality.
Comment #3
sebastian.haas commentedI just recognized that there was a dpm() call left in the submitted patch + a form validation issue.
So here's a patch for the patch.
Comment #4
xjmYou'll want to upload a single combined patch so it's easier to review.
Looks like a good, well-factored solution.
Comment #5
matslats commentedJust paste the following at the bottom of the module.
I've improved the above so the entity type to be indexed can be chosen, as indicated.
Comment #6
sebastian.haas commentedYour code seems to works for me. Thank you!
Comment #7
sebastian.haas commentedPush.
I put everything into a patch. Hoping for a commit soon...
Comment #8
sebastian.haas commentedComment #9
mhahndl commentedpatch works for me.
Comment #10
xjmAttached patch removes a stray
print_r()and cleans up the code a bit according to Drupal coding standards. Please mark "reviewed and tested by community" if the patch works properly.Comment #11
xjmOops, missed a couple
@see.Comment #12
xjmComment #13
mhahndl commented#11 works for me! Thanks!
Comment #14
xjmComment #15
dave reidPlease put the menu callbacks in a taxonomy_entity_index.admin.inc file so they are not included in the main .module file.
Anything under admin/* should already be defined as an admin path - this is redundant.
We can just add #required => TRUE to $form['types'] rather than a validation function right?
Comment #16
dave reidAlso, let's name the form 'taxonomy_entity_index_reindex_form' or 'taxonomy_entity_index_batch_form' - the world 'simple' doesn't have any context for me here.
Comment #17
EvanDonovan commentedI think there are some bugs with the actual reindexing batch operation. I could remove, and repost these in a separate issue if you want. Possibly they could even be core bugs with EFQ, but more likely something is wrong with the logic of how these things are getting set.
Here's what I got for terms:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /d7-sfentity2/batch?id=23&op=do StatusText: OK ResponseText: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'vocabulary_machine_name' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {taxonomy_term_data} taxonomy_term_data WHERE (tid > :db_condition_placeholder_0) AND (vocabulary_machine_name IN (:db_condition_placeholder_1, :db_condition_placeholder_2)) ) subquery; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => accounts [:db_condition_placeholder_2] => service_group ) in EntityFieldQuery->execute() (line 1011 of /Applications/MAMP/htdocs/d7-sfentity2/includes/entity.inc)From this debug output it looks like EFQ is presuming that vocabulary_machine_name is a field directly on {taxonomy_term_data}. However, the actual field is just called vid, and machine_name is a field on {taxonomy_vocabulary}.
And here's what I got for users:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /d7-sfentity2/batch?id=24&op=do StatusText: OK ResponseText: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bundle' in 'having clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {users} users WHERE (uid > :db_condition_placeholder_0) HAVING (bundle IN (:db_condition_placeholder_1)) ) subquery; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => user ) in EntityFieldQuery->execute() (line 1011 of /Applications/MAMP/htdocs/d7-sfentity2/includes/entity.inc).I think this second one is because users only have one bundle, so the $query->entityCondition of 'bundle' should be left out for them.
Nodes worked fine.
Comment #18
EvanDonovan commentedThe following code, based on #1054162: Taxonomy bundles not supported by EntityFieldQuery (followup), with the addition of unsetting the bundle for users, when added to the module, solved this issue:
The fact that this was necessary, however, suggests that Drupal core has some deficiencies (bugs?) in the way that it handles bundles on entities other than nodes.
Comment #19
EvanDonovan commentedDo you think something like this should be added to the patch, or is it a separate issue? If the latter, how should it be handled?
Comment #20
EvanDonovan commented@Dave Reid:
I am currently using a hacked version of this module with the patch from #15 + the logic from #18.
In light of #1054162: Taxonomy bundles not supported by EntityFieldQuery (followup) likely not getting committed in the next D7 release, do you think the hook_entity_query_alter() implementation should be in this module, or should I move it to my custom module which depends on this module?
I want to have the most maintainable solution moving forward.
Sounds also like the changes in #15 are necessary for this patch to go in. I don't know if I'll have time to get to that soon, but sounds like they're fairly simple.
Comment #21
xjm@EvanDonovan: Sounds to me that maybe a separate bug report should be opened for #18? Since this issue is a feature request.
Comment #22
neoglez commentedSo, in addition to the recommendations in #15 i did another (little) changes.
@Dave Reid The patch is against the (git) dev 7.x-1.x, ...dont't know why it doesn't appear among the options.
Comment #23
neoglez commentedUpdate status
Comment #24
xjmI notice a couple of minor things with the patch, just some trailing whitespace and a missing newline at the end. I'll reroll #22.
Comment #25
xjmComment #26
xjmOkay, reviewing the patch:
I am not sure we want to move these two functions out of the main .module file. The batch job might be triggered from other than the admin pages. So probably just the admin form and submit handler should live in the .admin.inc file.
Outside of that, it looks like all the feedback from #15 and #16 has been addressed.
Comment #27
xjmI'll fix that as well I guess.
Comment #28
xjmComment #29
xjmComment #30
neoglez commentedWhy the access always granted??
This looks like a major security issue!
I must say i also overlooked this in #22...
Comment #31
neoglez commentedWe should implement hook_permission or use one already defined in core (e.g. 'administer site configuration' or something).
Any opinion...?
Comment #32
xjm@neoglez: Since it is under
adminI believe it's already restricted. Might want to test to make sure. :)Comment #33
neoglez commented@xjm: Don't need to, just look in _menu_check_access ;-)
Comment #34
xjmRight, but since the item is a child of the
adminpath, it inherits that access restriction. Edit: sorry, to clarify, I am saying that the access callback key should just be removed. There is no need to add one.Comment #35
neoglez commentedNot when the access callback is explicit defined.
edit: Ok, now we're right :)
Comment #36
xjmHere; code speaks louder than words. :) I tested and confirmed that with this patch, non-privileged users do not receive access.
Edit: Hah, I am not used to real-time conversations on issue nodes. ;)
Comment #37
xjmOops, except the patch itself dropped a hunk. Fixed here.
Comment #38
neoglez commentedWow, that was almost real time! Thanks a lot!
The patch looks fine to me (i also tested).
I also like this approach.
Comment #39
pcambraHere http://drupal.org/node/109157 says:
"From Drupal 6.2 on, access callback and access arguments are no longer inherited from parent items"
When applying this patch, no menu appears in the admin interface (Configuration > System) as it thinks is access callback false by default (from _menu_check_access)
I think we should choose a permission or create one for this case. As it is under system (it could be also under search & metadata imho) we could reuse "Administer site configuration"
Patch attached with this change.
Comment #40
xjmAh, thanks re: #39. Good catch. Clearly I'm out of touch. ;)
Looks good to me.
Comment #41
neoglez commentedwell, it's not actually like that.
Note, for example:
from hook_menu
Comment #42
pcambraYes, but this is a MENU_NORMAL_ITEM (default) and this kind of menus, afaik, no longer inherit access properties from their parents, that's what patch in #39 fixes, if you omit the access properties, the menu is never displayed in the admin page (Configuration > System) in this case.
Comment #43
xjmHmm, I thought it was displayed when I tested #37. Perhaps I failed to properly clear my menu cache or something. In either case, though, #39 is RTBC.
Comment #44
bancarddata commentedI installed the patch from #39 but do not see any kind of administrative menu. The patch installed successfully with no warnings and I flushed my caches. Also, I am using the Administrator account and have double-checked that the "Administer site configuration" permission is enabled. Is there something I am missing?
Comment #45
pcambraI've just tested it in a fresh install and patch in #39 works fine, but maybe it the url should use dashes instead of underscores.
Comment #46
xjmNR again based on #44 and #45.
Comment #47
bancarddata commentedThank you! That worked perfectly.
Comment #48
webflo commentedHi,
i wrote drush integration during the views code sprint in hamburg. I removed the bundle condition from the rebuild query, because it will fail for taxonomy terms and comments. I think we can solve this issue in a follow up.
Cheers,
Florian
Comment #49
webflo commentedComment #50
xjmwebflo: can you submit that patch in a separate issue, since the patch here is RTBC and just waiting on commit? Thanks!
Comment #51
bigjim commentedcreated an issue for @webflow's drush commands from #48 #1504654: Add Drush command for re-indexing
Comment #52
kaizerking commented@xjm please consider this issue here about indexing Views integration Entity indexing
Comment #53
saltednut#45 tested, considered RTBC
Comment #54
saltednutCommitted to 7.x-1.x: 9b0abb3