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

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
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)
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.