includes/paths.php
changeset 567 7f196509bf78
parent 555 ac4c6a7f01d8
child 571 66e14e61613e
equal deleted inserted replaced
566:06d241de3151 567:7f196509bf78
   700       if ( $verbose && $debug )
   700       if ( $verbose && $debug )
   701       {
   701       {
   702         echo "Running indexing round $j of $loops (offset $offset)\n" . ( isset($_SERVER['REQUEST_URI']) ? '<br />' : '' );
   702         echo "Running indexing round $j of $loops (offset $offset)\n" . ( isset($_SERVER['REQUEST_URI']) ? '<br />' : '' );
   703       }
   703       }
   704       
   704       
   705       $texts = $db->sql_query('SELECT p.name, t.page_id, t.namespace, t.page_text FROM ' . table_prefix . "page_text AS t\n"
   705       // this is friendly to both MySQL and PostgreSQL.
       
   706       $texts = $db->sql_query('SELECT p.name, p.visible, t.page_id, t.namespace, t.page_text FROM ' . table_prefix . "page_text AS t\n"
   706                             . "  LEFT JOIN " . table_prefix . "pages AS p\n"
   707                             . "  LEFT JOIN " . table_prefix . "pages AS p\n"
   707                             . "    ON ( p.urlname = t.page_id AND p.namespace = t.namespace )\n"
   708                             . "    ON ( p.urlname = t.page_id AND p.namespace = t.namespace )\n"
   708                             . "  WHERE ( p.password = '' OR p.password = '$sha1_blank' )\n"
   709                             . "  WHERE ( p.password = '' OR p.password = '$sha1_blank' )\n"
   709                             . "    AND ( p.visible = 1 )\n"
   710                             . "    AND ( p.visible = 1 )\n"
   710                             . "  LIMIT $pages_in_batch OFFSET $offset;", false);
   711                             . "  LIMIT $pages_in_batch OFFSET $offset;", false);
   723             $mu = memory_get_usage();
   724             $mu = memory_get_usage();
   724             echo "  Indexing page $k of $num_pages: {$row['namespace']}:{$row['page_id']}";
   725             echo "  Indexing page $k of $num_pages: {$row['namespace']}:{$row['page_id']}";
   725             if ( $debug )
   726             if ( $debug )
   726               echo ", mem = $mu...";
   727               echo ", mem = $mu...";
   727             flush();
   728             flush();
       
   729           }
       
   730           
       
   731           // skip this page if it's not supposed to be indexed
       
   732           if ( $row['visible'] == 0 )
       
   733           {
       
   734             if ( $verbose )
       
   735             {
       
   736               echo "skipped";
       
   737               if ( isset($_SERVER['REQUEST_URI']) )
       
   738                 echo '<br />';
       
   739               echo "\n";
       
   740             }
       
   741             continue;
   728           }
   742           }
   729           
   743           
   730           // Indexing identifier for the page in the DB
   744           // Indexing identifier for the page in the DB
   731           $page_uniqid = "ns={$row['namespace']};pid=" . sanitize_page_id($row['page_id']);
   745           $page_uniqid = "ns={$row['namespace']};pid=" . sanitize_page_id($row['page_id']);
   732           $page_uniqid = $db->escape($page_uniqid);
   746           $page_uniqid = $db->escape($page_uniqid);