Warning on term deletion

thePanz - March 25, 2009 - 10:46
Project:Taxonomy Image
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:thePanz
Status:needs work
Description

Deleting a term, that don't have any image associated, caused some errors.
I'll investigate further..

#1

thePanz - April 5, 2009 - 20:19
Priority:normal» critical
Assigned to:Anonymous» thePanz
Status:active» reviewed & tested by the community

My patch fixes this issue, and the missing deletion of IMG.

I also cleanup the deletion function.

AttachmentSize
rewritten_deleting.patch 4.5 KB

#2

NancyDru - April 8, 2009 - 14:33
Status:reviewed & tested by the community» needs review

@thePanz: Some module maintainers get very upset when someone marks their own patch as RTBC. It's not a big deal for me.

I will get to this shortly.

#3

thePanz - April 8, 2009 - 15:02

Sorry NancyDru, I saw some maintainers following that way.. so I followed them :)

What I mean setting my patch to RTBC is that I used it on a production site without bugs or errors... sorry for my misunderstanding..

Regards

ps: do you think that migrating from custom path to Drupal {files} could improve TI? I mean: we store the imagename in DB, why can't we rely on {files} and save only (TID, FID) in our table? :)

#4

NancyDru - April 8, 2009 - 15:59

I have at least twice started on converting to tid/fid and have gotten thrown off each time. It is not a trivial change (think about the update code), but I think it is the right thing to do. In the past it did make the external image impossible, but I think now that I just copy it to the site, it may work now.

If you are interested in issue status meanings, take a look at http://drupal.org/node/156119. You can set your own issue to RTBC if it is trivial, but this one is not.

#5

NancyDru - April 16, 2009 - 18:10
Status:needs review» needs work

I get Error deleting term image; it seems that this image doesn't exists. when there is an image.

#6

NancyDru - April 16, 2009 - 23:43
Priority:critical» normal

$full_path = $taxonomy_image_path . $old_path; but there is no "$old_path".

#7

thePanz - April 17, 2009 - 12:04

Sorry, I've got some other working project right now.. I'll give you feedback (or an updated patch) in next days..

[EDIT] I've put some edits on _delete() function. My idea is to delete Drupal messages from it and let the code that calls _delete() to act on true/false results. So external modules can handle TaxonomyImage better. What do you think?

Cheers,
thePanz

#8

NancyDru - April 17, 2009 - 15:56
Status:needs work» fixed

I nearly rewrote the function to be more straightforward. I also added a setting to show/not-show all the messages.

#9

thePanz - April 18, 2009 - 09:43
Status:fixed» active

Hi NancyDru, I ported my patch with your latest commit in -dev snapshot.
I essentially removed the _verbose_ setting, and cleaned the _delete() function: it returns TRUE or FALSE as a result so caller function can (if needed) provide an error message.

My intention is to provide _delete($tid) and _add($tid, $filename) like an API (for the letter I noticed a patch that goes in that direction).

What do you think? Sould we port all this "features" into a 2.x version cause it's a major module change (I also think about moving from custom table with filenames to drupal {files} FID)?

#10

thePanz - April 18, 2009 - 09:44
AttachmentSize
rewritten_deleting.patch 7.56 KB

#11

NancyDru - April 18, 2009 - 14:04
Status:active» needs work

I don't have a problem with returning TRUE or FALSE.

I like the verbose setting, and here's why: The most important part of the function is to break the term-image association and clear the cache. If, for some reason, the files table or the disk cannot be deleted, it is not the end of the world; there would be junk left, but the image no longer displays. I can live with that, but it would be nice if there was a way to find out where the function failed. But I suspect most people probably don't care as long as the image goes away.

Also, I cleaned up some of the comments and your new patch puts them back.

Yes, I would like to get this to only saving the fid, which is normalizing the database. I just need to get back to it. The hardest part of doing this will be the hook_update_N code. That would justify a version change.

#12

NancyDru - April 19, 2009 - 12:49
 
 

Drupal is a registered trademark of Dries Buytaert.