Disable view counts?

nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-07-17 00:01

Is it easy to disable view counts? I know how to keep them from displaying, at least I'm pretty sure about that. But I'd like to know how to disable view counts from even being counted in the DB.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-17 00:09

you'd have to remove a few lines (5 or so) in modules/core/ShowItem.inc)

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-07-17 00:20

These?

	/* Increment the view count */
	$ret = GalleryCoreApi::incrementItemViewCount($item->getId());
	if ($ret->isError()) {
	    return array($ret->wrap(__FILE__, __LINE__), null);
	}

hmmmm, looks like it would be easy to add a UI option for this. If someone were to create an option for this in the UI, where do you think would be a good place for it? Site Admin > General Settings or should it be at the album level?

One more question, though I think I know the answer, the performance increase from a change like this probably would be very noticable would it?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-07-17 00:32

yes, i think the performance increas could be noticable, given that for Showitem pages, this is the only data modification. everything else could be cached 100%.

we plan to add further caching (maybe even html level) later. once we cache on html level for guests etc., the view count increment call would be the only expensive thing in such HTTP requests. if you then disable this view count feature, we could probably sustain heavy /. attacks :)
there are also other alternatives to prevent expensive db interactions for the view counts.

where's the right place for such a option switch?
maybe site admin -> general. maybe we will have to change the admin UI if there is more and more site admin -> general stuff.

 
mika

Joined: 2005-07-09
Posts: 71
Posted: Sun, 2005-07-17 02:55

for what it's worth, I have also been wanting to remove view counts as they have no importance to me.

In the meantime, I would like to at least prevent them from being displayed on the album, if any of you can point me in the right direction.

I would vote for a switch to turn them on/off.

To all those implicated in the coding of G2, I'm impressed, me likes!

Cheers,
Marc

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-07-17 03:00

This is just a custom template or modifying an existing one in a 'local' directory.

Edit album.tpl change showViewCount=true to showViewCount=false, or possibly just remove the line altogether.

 
mika

Joined: 2005-07-09
Posts: 71
Posted: Sun, 2005-07-17 03:24
nivekiam wrote:
This is just a custom template or modifying an existing one in a 'local' directory.

Edit album.tpl change showViewCount=true to showViewCount=false, or possibly just remove the line altogether.

That was too easy, merci! :)

On a different tangent, where would I look to change the displayed date format?

Cheers,
Marc

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-07-17 04:05

Just created and RFE for this: http://sourceforge.net/tracker/index.php?func=detail&aid=1239624&group_id=7130&atid=357130

I tried making the change myself, but like several times before get so far then get stuck. I can add the option to the UI, but I can't figure out how to save the data or retrieve it, say in ShowItem.inc