Update indexes site

This commit is contained in:
Victor Shcherb 2012-01-08 13:05:05 +01:00
parent 1137a34f9a
commit f7d288849f
2 changed files with 131 additions and 123 deletions

View file

@ -331,7 +331,8 @@ public class WikiIndexer {
private void analyzeTextForGeoInfo() throws XMLStreamException {
// fast precheck
if(title.toString().endsWith("/doc") || title.toString().startsWith("Шаблон:")) {
if(title.toString().endsWith("/doc") || title.toString().startsWith("Шаблон:") ||
title.toString().startsWith("Template:")) {
// Looks as template article no information in it
return;
}

View file

@ -96,7 +96,7 @@ function updateGoogleCodeIndexes($update=false) {
}
/// 2. append local indexes
$local = new DomDocument();
// Open a known directory, and proceed to read its contents
// Open a known directory, and proceed to read its contents
$dir='indexes/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
@ -105,26 +105,33 @@ function updateGoogleCodeIndexes($update=false) {
$filename = $dir . $file ; //"./test112.zip";
//print("processing file:" . $filename . "\n");
if ($zip->open($filename,ZIPARCHIVE::CHECKCONS)!==TRUE) {
//echo exit("cannot open <$filename>\n");
//print($filename . " cannot open as zip\n");
// echo exit("cannot open <$filename>\n");
// print($filename . " cannot open as zip\n");
continue;
}
$indexName=$file;
if (isset($mapNodes[$indexName])) {
//print($indexName . " is listed already, skipping\n");
continue;
}
$description = $zip->getCommentIndex(0);
$stat = $zip->statIndex( 0 );
$date= date('d.m.Y',$stat['mtime']);
$size= number_format((filesize($filename) / (1024.0*1024.0)), 1, '.', '');
$zip->close();
if (isset($mapNodes[$indexName])) {
$exdate = DateTime::createFromFormat('d.m.Y', $mapNodes[$indexName]->getAttribute("date"));
if($stat['mtime'] < $exdate->getTimestamp()) {
continue;
}
$out = $mapNodes[$indexName];
} else {
$out = $output->createElement( "region" );
$outputIndexes->appendChild($out);
}
$out -> setAttribute("date", $date);
$out -> setAttribute("local", "true");
$out -> setAttribute("size", $size);
$out -> setAttribute("name", $indexName);
$out -> setAttribute("description", $description);
$outputIndexes->appendChild($out);
//$mapNodes[$indexName] = $out;
}
closedir($dh);