Better way to check links

Author Message

Bruce Morrison

Sunday 02 November 2003 9:53:00 pm

Fantastic to see the link checker as part of ezPublish 3.2

The method of checking links is pretty inefficient as entire body of link to be checked is returned (using the fopen).

A better way to handle this is to use the HTTP HEAD method. This tells the server being checked only to return the HTTP headers.

The PEAR HTTP package contains a head function
http://pear.php.net/manual/en/package.http.http.head.php

http://cvs.php.net/co.php/pear/HTTP/HTTP.php?r=1.18

Cheers
Bruce
http://www.designit.com.au/

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Bård Farstad

Monday 03 November 2003 12:17:30 am

Hi Bruce,

thanks for the notice. More efficient methods are welcome.

--bård

Documentation: http://ez.no/doc

Marco Zinn

Monday 03 November 2003 1:37:19 pm

Hi Bard, :)

and please, when someone works on the linkchecker: Don't forget to introduce proxy support or it will be useless for intranet servers.

Marco
http://www.hyperroad-design.com

Paul Borgermans

Monday 03 November 2003 2:03:05 pm

I agree, why not use libcurl for all http outside connections (like for the SOPA module)? It is compatible with the commercial version of ez publish!

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Bruce Morrison

Monday 03 November 2003 2:12:49 pm

I did a quick drop in of the PEAR function and saw considerable speed improvements. Quite important when you have 700+ links to check!

This function allows you to capture the response code which means that you could automatically replace URLs that return a "301 Moved Permanently". Other response codes could be used have a more informative status attached to each link. i.e. a response of 500 is quite different from not being able to connect to the server at all.

In all cases the "Objects which use this link:" drop-down contained "No Object Available" - Is anyone else seeing this?

Proxy support could be added quite easily if the CURL library is used (if installed).

Cheers
Bruce
http://www.designit.com.au/

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:11:59
Script start
Timing: Jan 18 2025 15:11:59
Module start 'layout'
Timing: Jan 18 2025 15:11:59
Module start 'content'
Timing: Jan 18 2025 15:12:01
Module end 'content'
Timing: Jan 18 2025 15:12:01
Script end

Main resources:

Total runtime1.1823 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 587.9141152.6250
Module start 'layout' 0.00570.0021 740.539139.4453
Module start 'content' 0.00781.1728 779.9844651.3516
Module end 'content' 1.18060.0016 1,431.335916.1641
Script end 1.1823  1,447.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2742160.0002
Check MTime0.00140.1149160.0001
Mysql Total
Database connection0.00070.062710.0007
Mysqli_queries1.116994.4688670.0167
Looping result0.00070.0570650.0000
Template Total1.141896.620.5709
Template load0.00230.192420.0011
Template processing1.139596.383620.5698
Template load and register function0.00010.006210.0001
states
state_id_array0.00190.158610.0019
state_identifier_array0.00290.245020.0014
Override
Cache load0.00200.1663350.0001
Sytem overhead
Fetch class attribute can translate value0.00080.066840.0002
Fetch class attribute name0.00150.125790.0002
XML
Image XML parsing0.00160.135240.0004
class_abstraction
Instantiating content class attribute0.00000.0017100.0000
General
dbfile0.00110.0927360.0000
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs