svn: /web/doc-editor/trunk/php/ ToolsCheckEntities.php

From: Date: Fri, 22 Jul 2011 22:31:16 +0000
Subject: svn: /web/doc-editor/trunk/php/ ToolsCheckEntities.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-2142@lists.php.net to get a copy of this message
yannick Fri, 22 Jul 2011 22:31:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=313611 Log: Add an array to exclude some entities to be checked as there are always wrong, like url.pecl.package.get Changed paths: U web/doc-editor/trunk/php/ToolsCheckEntities.php Modified: web/doc-editor/trunk/php/ToolsCheckEntities.php =================================================================== --- web/doc-editor/trunk/php/ToolsCheckEntities.php 2011-07-22 20:58:35 UTC (rev 313610) +++ web/doc-editor/trunk/php/ToolsCheckEntities.php 2011-07-22 22:31:16 UTC (rev 313611) @@ -27,6 +27,8 @@ private $conn; + private $EntitiesNotChecked; + /** * Initialise * @@ -37,6 +39,11 @@ $appConf = $am->appConf; $project = $am->project; + // This entities will not be checked as there are always wrong. We use it into the manual like this : "&url.foo;bar" + $this->EntitiesNotChecked = Array( + "url.pecl.package.get" // without & and ; + ); + $this->urlConnectTimeout = 10; $this->userAgent = 'DocWeb Link Crawler (http://doc.php.net)'; @@ -169,18 +176,22 @@ } else { // child - $r = $this->checkUrl($num, $url); + if( !in_array($name, $this->EntitiesNotChecked) ) + { - $query = 'INSERT INTO checkEntities (project, entities, url, result, date) - VALUES ("%s", "%s", "%s", "%s", now())'; - $params = array( - $project, - $name, - $url, - $r[0] - ); - $this->conn->query($query, $params); + $r = $this->checkUrl($num, $url); + $query = 'INSERT INTO checkEntities (project, entities, url, result, date) + VALUES ("%s", "%s", "%s", "%s", now())'; + $params = array( + $project, + $name, + $url, + $r[0] + ); + $this->conn->query($query, $params); + + } exit(); } } else { @@ -202,17 +213,21 @@ // walk through entities found foreach ($this->entityUrls as $num => $entityUrl) { - $r = $this->checkUrl($num, $entityUrl); + if( !in_array($this->entityNames[$num], $this->EntitiesNotChecked) ) + { + $r = $this->checkUrl($num, $entityUrl); - $query = 'INSERT INTO checkEntities (project, entities, url, result, date) - VALUES ("%s", "%s", "%s", "%s", now())'; - $params = array( - $project, - $this->entityNames[$num], - $entityUrl, - $r[0] - ); - $this->conn->query($query, $params); + $query = 'INSERT INTO checkEntities (project, entities, url, result, date) + VALUES ("%s", "%s", "%s", "%s", now())'; + $params = array( + $project, + $this->entityNames[$num], + $entityUrl, + $r[0] + ); + $this->conn->query($query, $params); + } + } ++$num; // (for the count) }

« previous php.doc.web (#2142) next »