after playing around with my previous mod i decided to take it to the next level. i had originally wanted to do it this way but i ended up hacking it and getting it working. anyhow, this mod has a bit more code, though still not a ton. it gives the mt user a lot of additional control over how their indexes are being rebuilt. i could also envision adding this rebuild type to other templates as well if people thought it would be useful.
first and foremost i must tell people that these changes are not supported by six apart and i don’t take responsibility for their effect on your installation.
now i guess your wondering what this mod even is. i added the ability to specify the rebuild type of a index template. in the typical installation when you create a new index template you can specify whether or not you want an index to rebuild when other indexes are rebuilt. you don’t have any additional control over when this rebuild may occur. it usually occurs when you rebuild your site, when you rebuild that template, when you add a new entry, or when someone adds a new comment. what if that template has nothing to do with comments or entries? what if you want it to rebuild when a trackback occurs? in short, you can’t … until now.
i’ve changed the list template and edit template screens to now allow the site editor to specify exactly when a template should be rebuilt. here are the new “rebuild types” that i’ve created:
- never — excluding a forced rebuild do not ever rebuild this template.
- entry — only rebuild this template when a new entry is entered or an entry is edited.
- comment — only rebuild this template when a new comment is submitted.
- trackback — only rebuild this template when a trackback occurs.
- entry, comment * — rebuild this template when a new entry or a new comment is submitted. this is the typical rebuild type that ships with movable type and is the default rebuild type for all new templates.
- entry, trackback — rebuild this template when a new entry or a new trackback occurs.
- comment, trackback — rebuild this template when a new comment or a new trackback occurs.
- all — whenever any change (new comment, new trackback, new or edited entry) occurs then rebuild this template.
important note : i recommend you backup the original files before placing my mod files in your mt installation.
what version of mt is supported? — 2.63, 2.65
what was changed? — quite a few things behind the scenes and in the user interface.
- the list templates screen now no longer has a rebuild? column. it has been replaced by a rebuild type column that specifies the type of rebuild for the associated index template.
- the edit screen for index templates no longer has a checkbox for rebuild. it now has a selector that allows you to select one of the rebuild types defined above.
- the default behaviour of trackbacks now rebuilds the associated entry, if it is an entry. in the past it never would rebuild an entry after it received a ping.
- all of the calls to the rebuild_indexes method take a rebuild type now. this enables me to determine whether or not a given template should be rebuilt based on it’s specified rebuild type. because i needed to add a new attribute type to the mt::template object a database change will be needed for those of you not using dbm files.
- as i said above, mt::template objects now have a rebuild_type attribute.
what did you do to integrate with mt blacklist? — i made the changes that they mentioned on their incompatibilities page and made those a part of my release. i don’t claim any credit for mt blacklist or the awesome job they have done with it. this is merely a convenience change for my users. any questions about mt blacklist should be directed to their website.
how do i install this mod? — it’s rather simple actually. first thing you need to do is backup the following files in your mt install:
- /mt/lib/mt.pm
- /mt/lib/mt/template.pm
- /mt/lib/mt/app/cms.pm
- /mt/lib/mt/app/comments.pm
- /mt/lib/mt/app/trackback.pm
- /mt/tmpl/cms/edit_template.tmpl
- /mt/tmpl/cms/list_template.tmpl
if your using mt blacklist you should back these files up:
- /mt/extlib/jayallen/mtblping.pm
- /mt/extlib/jayallen/mtblpost.pm
then just copy the files from the zip file (bottom of this entry) into the same location as the files you just backed up.
if you are using dbm files for your mt storage then your done installing the changes. if you aren’t using dbm and are instead using mysql or some other database your going to need to update your database scheme. i’ve added a new attribute to all mt::template objects so your going to need to add a rebuild_type column to the mt_template table. the sql update would look something like this:
alter table mt_template add column template_rebuild_type text
are patch files available? — you can download a patch for each file here:
what should the changes looks like? — i made 2 simple screen shots of what the user interface should look like. you can see the changes to the list templates and edit template views.
how do i test the changes? — if you goto the list templates view you should see a rebuild type column for each index template. if you select a template and goto the edit template view you should see a selector in place of the original checkbox in the user interface. from this selector you can choose the rebuild type for this template. once selected, save the change like you would any other change to a template. when you return to the list templates view you should now see the rebuild type you selected reflected in the interface.
how can i see what you changed — do a search on “sean willson” in the files, there are copious comments. you can also look at the patch files specified above.
are there any caveats to making these changes? — there are a few things i should caution you to. the first would be that these changes are not supported, but i already said that didn’t i? the second would be that you need to realize that any time anyone pings your entries they will get rebuilt. so, if you get those annoying 4-5 pings to one posting like some people do, it will update each time. you’ll likely then want to go back and remove those excess pings and then rebuild the entry. since most people don’t do that though, it’s not a big deal to me. i thought it appropriate to warn you ahead of time though.
finally, download the changes
release history:
recent comments