Well, I added to my project this quick-fix task
[code]public class UpdateThemeDateTask extends AbstractTask {
/**
* @param taskName
* @param taskDescription
*/
public UpdateThemeDateTask() {
super("Update themes date", "All css, JS and images files need new date
for cache.");
}
/*
* (non-Javadoc)
* @see
info.magnolia.module.delta.Task#execute(info.magnolia.module.InstallContext)
*/
@Override
public void execute(final InstallContext ctx)
throws TaskExecutionException {
final String themeName = getThemeName(ctx);
try {
final Node baseNode =
ctx.getJCRSession("resources").getNode("/templating-kit/themes/" + themeName);
updateDate(baseNode);
} catch (final RepositoryException e) {
ctx.error("Can't set new date", e);
}
}
/**
* @param node
* @throws RepositoryException
*/
private void updateDate(final Node node)
throws RepositoryException {
if (node.hasNodes()) {
final Iterable<Node> nodes = NodeUtil.getNodes(node);
for (final Node childNode : nodes) {
updateDate(childNode);
}
}
final MetaData metaData = MetaDataUtil.getMetaData(node);
if (metaData.getCreationDate() == null) {
metaData.setCreationDate();
} else {
metaData.setModificationDate();
}
}
/**
*
* @param ctx
* @return
*/
protected String getThemeName(final InstallContext ctx) {
return ctx.getCurrentModuleDefinition().getProperty("themeName");
}[/code]
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=da35a197-f050-421b-86aa-a71bbe68c28a
You are invited to Magnolia Conference. Less than a month to go! Register now:
http://www.magnolia-cms.com/conference/register.html
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------