EPrints Technical Mailing List Archive

Message: #07168


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Refresh Abstracts removing Boxes from Summary Page


Hi Liam / Monica,

I have seen this in the past as well, I have assumed but will confirm
with others that this is a rather hacky way of determining if the box
is being requested as part of the preview tab that you would only be
able to access if you were logged in and must be on HTTPS.  In this
case, you would not want boxes here for two reasons:

1. The preview tab is often of restricted width and this may cause
rendering issues when boxes are included.

2. The boxes are generated on the fly which could be quite slow,
particularly for irstats2 in some situations. 

However, as a lot of repositories are now going site-wide HTTPS or have
HSTS setup (or users have browser plugins configured to see if a site
has HTTPS in priority to HTTP), then it is much more likely an abstract
page will be generated by someone requesting over HTTPS.

I agree that these box plugins need to be fixed, I will investigate to
confirm the reason for using get_secure (which is basically an alias
for is_secure) is purely to work out whether a user is logged in.
 Looking at the get_secure/is_secure method it is also checking whether
it is being called online (by web request) or offline (by command line
script) and if it is offline returns false when would mean the
(irstats2/altmetric) box does get generated.  I cannot see any other
reason why if it is being requested securely you would not want this
rendered it is much more likely to be the other way around.

Regards

David Newman

On Fri, 2018-02-23 at 11:39 +0000, Liam Green-Hughes wrote:
> Hi Monica,
> 
> I've had the same problem with statistics boxes disappearing. Looks
> to be the same issue as you had as when I follow what you did here
> the same symptoms occur. I was just wondering how it went with
> removing the return 0 if $self->{session}->get_secure; line. I have
> no idea why it is there! Were there any side effects?
> 
> Thanks
> Liam
> 
> Liam Green-Hughes
> Library Systems Developer
> University of Kent
> 
> From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.
> soton.ac.uk> on behalf of Monica Wood <monica.wood@utas.edu.au>
> Sent: 09 January 2018 01:29
> To: eprints-tech@ecs.soton.ac.uk
> Subject: Re: [EP-tech] Refresh Abstracts removing Boxes from Summary
> Page
>  
> Update on this issue.
>  
> I compared the index.html in /html/en/archive/…. Of a single record,
> both with one that was generated using bin/generate_abstracts and one
> using bin/epadmin refresh_abstracts.
>  
> I noticed the one using generate_abstracts defined the http_root and
> http_cgiroot as http, while the refresh_abstracts was https.
>  
> So I figured that generate_abstracts was run locally, so it wasn’t
> forced through https, while refresh_abstracts was.
>  
> It had to be something that the Screen::EPrint::Box didn’t like about
> being generated through https.
>  
> Well the issue isn’t with Screen::Eprint::Box per say, it was the
> implementations of Irstats and Altmetrics using this plugin 
> (lib/plugins/EPrints/Plugin/Screen/Eprint/Box/[Altmetric.pm|Irstats.p
> m]).
>  
> Both in their can_be_viewed subs have the line:
> return 0 if $self->{session}->get_secure;
>  
> So it just simply won’t show the box on a page generated through
> https.
>  
> I have commented this line out and it’s now showing on pages
> generated through refresh_abstracts.
>  
> I guess my question now is, what is the importance of this line and
> what am I breaking by commenting it out? :/
>  
> Thanks everyone
> Monica
>  
> University of Tasmania
> https://eprints.utas.edu.au/
>  
>  
>  
> From: <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of John Salter
> <J.Salter@leeds.ac.uk>
> Reply-To: Eprints Tech <eprints-tech@ecs.soton.ac.uk>
> Date: Thursday, 4 January 2018 at 9:21 pm
> To: Eprints Tech <eprints-tech@ecs.soton.ac.uk>
> Subject: Re: [EP-tech] Refresh Abstracts removing Boxes from Summary
> Page
>  
> Maybe try this:
> Find an item without the boxes.
> Save the html source of the page
> Run generate_abstracts to make the boxes reappear.
> Save the html source of this.
>  
> Diff the two html sources - what's the difference?
> That might point us toward what's going on…
>  
>  
> From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounc
> es@ecs.soton.ac.uk] On Behalf Of Monica Wood
> Sent: 04 January 2018 09:30
> To: eprints-tech@ecs.soton.ac.uk
> Subject: Re: [EP-tech] Refresh Abstracts removing Boxes from Summary
> Page
>  
> As it renders fine when i run generate_abstracts, but then disappears
> when you edit a record or refresh abstracts, i wouldn't imagine its
> the javascript.
> I haven't changed the templates either.
> 
> It use to serve all pages  (except pages like login) through both
> http and https, but any requests to http is now redirected to https.
> 
> If you look at our repository you will probably see newly created
> items with no boxes and older records have the boxes. If i
> generate_abstracts on the new ones then the boxes will appear.
> 
> I just dont understand what could possibly cause this.
> 
> Monica
> 
> 
> 
> On Thu, Jan 4, 2018 at 8:19 PM +1100, "John Salter" <J.Salter@leeds.a
> c.uk> wrote:
> 
> Hmm, interesting...
> I believe both those boxes use Javascript to render data.
> Is there something amiss with the javascript (e.g. it's not being
> served over https)? 
> 
> I think there used to be two version of the js that could be served -
> one secure, the other not. I don't think this variation is needed in
> modern versions of EPrints - maybe you are referencing the older
> version of the js in your template?
> 
> Cheers,
> John
> From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.
> soton.ac.uk> on behalf of Monica Wood <monica.wood@utas.edu.au>
> Sent: 04 January 2018 08:42:15
> To: eprints-tech@ecs.soton.ac.uk
> Subject: Re: [EP-tech] Refresh Abstracts removing Boxes from Summary
> Page
>  
> Hi John and Adam.
> 
> 
> 
> Id already tried restarting the httpd service multiple times and the
> indexer has been restarted since this problem arose.
> 
> 
> 
> The whole thing has me very confused as it only appeared recently.
> 
> 
> 
> We did move to shibboleth auth around the same time and all traffic
> is now directed through https... not sure if these changes would have
> done anything. 
> 
> 
> 
> Thanks
> Monica
> 
> 
> 
> On Thu, Jan 4, 2018 at 6:54 PM +1100, "John Salter" <J.Salter@leeds.a
> c.uk> wrote:
> 
> Hi Monica,
> It sounds like you might just need to restart Apache...
> When running something from the command-line, the EPrints stack is
> interpreted from the files on disk.
> When you 'expire' the abstracts, they are regenerated on-the-fly by
> the Apache process, using the EPrints stack Apache interpreted when
> it was started.
> 
> Hope that makes some sense.
> If might also be worth restarting the indexer - as this too has an
> interpreted stack that could differ from the on-disk version you get
> from the command-line now!
> 
> Cheers,
> John
> From: eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.
> soton.ac.uk> on behalf of Monica Wood <monica.wood@utas.edu.au>
> Sent: 04 January 2018 01:15:23
> To: Eprints Tech
> Subject: [EP-tech] Refresh Abstracts removing Boxes from Summary Page
>  
> Hi All,
>  
> I’ve got the most bizarre problem happening.
>  
> My staff started noticing that when they edited an item that the
> irstats2 downloads box would disappear from the summary page.
> I had a look and noticed the altmetics box was also disappearing and
> when I did a refresh_abstracts using epadmin or the regenerate
> abstracts button from the admin -> systems tools, then every box
> disappeared from every summary.
>  
> They reappear if I run the script generate_abstracts from the cmdln,
> but apart from refresh_abstracts setting a abstracts.timestamp
> variable to state that a page needs to be regenerated on request, I
> cannot see what these commands are really doing differently.
> Both should be calling the method $eprint->generate_static() when the
> page is generated
>  
> I could solve this by not putting that data into a
> Screen::EPrint::Box,  but it doesn’t actually solve the issue of why
> refresh is removing them.
>  
> Thanks
> Monica Wood
>  
> Library Systems
> University of Tasmania
> https://eprints.utas.edu.au
> 
> 
> University of Tasmania Electronic Communications Policy (December,
> 2014). 
> This email is confidential, and is for the intended recipient only.
> Access, disclosure, copying, distribution, or reliance on any of it
> by anyone outside the intended recipient organisation is prohibited
> and may be a criminal offence. Please delete if obtained in error and
> email confirmation to the sender. The views expressed in this email
> are not necessarily the views of the University of Tasmania, unless
> clearly intended otherwise.
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-
> tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/