OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Column 'views' in OJS 2.4.4-1

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Column 'views' in OJS 2.4.4-1

Postby marchitelli » Thu Jul 31, 2014 5:46 am

Hi,
we have just installed a new OJS using 2.4.4-1

I got an error in article page, because the system didn't find "views" column in published_article relation, so I add it via sql and now it works.

Why the install process didn't create this column correctly?

Regards,
andrea
marchitelli
 
Posts: 125
Joined: Tue May 22, 2007 12:44 am

Re: Column 'views' in OJS 2.4.4-1

Postby bbeghelli » Thu Jul 31, 2014 10:15 am

Hi Andrea,

Can you post here more details about the error you have?

The 'views' column is not used anymore now. The system uses a new structure to store statistics. All core functionalities were adapted, but maybe you have an old plugin that tries to use the views column?

Thanks,
Bruno
bbeghelli
 
Posts: 189
Joined: Tue Jun 25, 2013 2:22 pm

Re: Column 'views' in OJS 2.4.4-1

Postby marchitelli » Mon Aug 04, 2014 3:33 am

Hi Bruno,
this is the error that I have
[Mon Aug 04 12:17:53 2014] [error] [client 193.206.99.193] ojs2: DB Error: ERROR: column "views" does not exist\nLINE 1: UPDATE published_articles SET views = views + 1 WHERE articl...\n ^, referer: http://xxx.yyy.zz/index.php/test/issue/view/2


I guess that the problem is in file ojs-2_4_4-1/classes/article/PublishedArticleDAO.inc.php where I find
Code: Select all
   /**
    * Increment the views count for a galley.
    * @param $articleId int
    */
   function incrementViewsByArticleId($articleId) {
      return $this->update(
         'UPDATE published_articles SET views = views + 1 WHERE article_id = ?',
         (int) $articleId
      );
   }


I solved the problem adding a column "views" in published_articles table.
Is it correct?

Andrea
marchitelli
 
Posts: 125
Joined: Tue May 22, 2007 12:44 am

Re: Column 'views' in OJS 2.4.4-1

Postby bbeghelli » Mon Aug 11, 2014 7:10 am

Hi Andrea,

Your solution is not good. You are introducing back the views column in a system that will not use it anymore. The best solution is to adapt the code that's using those leftovers (the DAO method is a left over that it will be removed next release) to use the new stats structure (MetricDAO, metric type, etc). See more here: http://pkp.sfu.ca/wiki/index.php?title= ... _Framework

As I said, maybe you have old plugins that still use this DAO method? The OJS core doesn't use it anymore.

Cheers,
Bruno
bbeghelli
 
Posts: 189
Joined: Tue Jun 25, 2013 2:22 pm

Re: Column 'views' in OJS 2.4.4-1

Postby marchitelli » Mon Aug 18, 2014 2:52 am

Hi Bruno,
I found the error (in a custom piece of code)!

Thank you very much.
Cheers,
Andrea
marchitelli
 
Posts: 125
Joined: Tue May 22, 2007 12:44 am


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests