Another great package! Very, very useful. I have a site that has been live for over four years and the database size was getting out of hand, so this package is perfect to stop it re-occurring.
One issue I had was that it worked perfectly locally but not on the live site. I eventually tracked this down to some entries in the cmsContentVersion table which had NULL values for both published and newest columns. This was causing exceptions to be thrown:
Data is Null. This method or property cannot be called on Null values.
Don't ask me how that happened to the data, but I updated your code slightly to make it work for me. Something like this (updated lines 76 and 77 of ApplicationBase.cs to check for null values and default to false):
var published = reader.IsNull("published")? false : reader.GetBoolean("published"); var newest = reader.IsNull("newest")? false : reader.GetBoolean("newest");
(May not be exactly what you need as I was using a different data access method so I'd adapted your code slightly).
That is bizarr, as I'm pretty sure there should always be at least one item flagged as published on one as newest. If the fix works though, I'd be happy for it to be included. You are more than welcome to have comit rights to the repo. Just ping me your codeplex username. Can add you as a contributor too if you like. Release cycle should be pretty easy as there is a script to build the package file. Just need to increase the version number.
Sorry I've run out of time for this, I'm off to Ireland for a week tomorrow. But I'll get around to it when I get back - promise ;)
Just to clarify, each item had one item flagged as latest and one as published, but there was also an entry where both flags were null - this is where the code fell over for me.
I'll get in touch when I'm back and get that fix added.
Suggested null check
Hey Matt,
Another great package! Very, very useful. I have a site that has been live for over four years and the database size was getting out of hand, so this package is perfect to stop it re-occurring.
One issue I had was that it worked perfectly locally but not on the live site. I eventually tracked this down to some entries in the cmsContentVersion table which had NULL values for both published and newest columns. This was causing exceptions to be thrown:
Don't ask me how that happened to the data, but I updated your code slightly to make it work for me. Something like this (updated lines 76 and 77 of ApplicationBase.cs to check for null values and default to false):
(May not be exactly what you need as I was using a different data access method so I'd adapted your code slightly).
Cheers!
David
Hi David,
You could always fork and submit a pull request? http://unversion.codeplex.com/SourceControl/network
Not speaking for Matt, (of course), but I'm sure he'd be happy to give you commit/collab rights; given that his hands are full with v5 dev. :-)
Cheers, Lee.
Good idea Lee - I'll get in touch with Matt directly and see what he thinks.
Hey David,
That is bizarr, as I'm pretty sure there should always be at least one item flagged as published on one as newest. If the fix works though, I'd be happy for it to be included. You are more than welcome to have comit rights to the repo. Just ping me your codeplex username. Can add you as a contributor too if you like. Release cycle should be pretty easy as there is a script to build the package file. Just need to increase the version number.
Matt
Hey Matt,
Sorry I've run out of time for this, I'm off to Ireland for a week tomorrow. But I'll get around to it when I get back - promise ;)
Just to clarify, each item had one item flagged as latest and one as published, but there was also an entry where both flags were null - this is where the code fell over for me.
I'll get in touch when I'm back and get that fix added.
Cheers,
David
is working on a reply...