Update indexes site
This commit is contained in:
parent
1137a34f9a
commit
f7d288849f
2 changed files with 131 additions and 123 deletions
|
@ -331,7 +331,8 @@ public class WikiIndexer {
|
||||||
|
|
||||||
private void analyzeTextForGeoInfo() throws XMLStreamException {
|
private void analyzeTextForGeoInfo() throws XMLStreamException {
|
||||||
// fast precheck
|
// 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
|
// Looks as template article no information in it
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ function updateGoogleCodeIndexes($update=false) {
|
||||||
}
|
}
|
||||||
/// 2. append local indexes
|
/// 2. append local indexes
|
||||||
$local = new DomDocument();
|
$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/';
|
$dir='indexes/';
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
if ($dh = opendir($dir)) {
|
if ($dh = opendir($dir)) {
|
||||||
|
@ -105,26 +105,33 @@ function updateGoogleCodeIndexes($update=false) {
|
||||||
$filename = $dir . $file ; //"./test112.zip";
|
$filename = $dir . $file ; //"./test112.zip";
|
||||||
//print("processing file:" . $filename . "\n");
|
//print("processing file:" . $filename . "\n");
|
||||||
if ($zip->open($filename,ZIPARCHIVE::CHECKCONS)!==TRUE) {
|
if ($zip->open($filename,ZIPARCHIVE::CHECKCONS)!==TRUE) {
|
||||||
//echo exit("cannot open <$filename>\n");
|
// echo exit("cannot open <$filename>\n");
|
||||||
//print($filename . " cannot open as zip\n");
|
// print($filename . " cannot open as zip\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$indexName=$file;
|
$indexName=$file;
|
||||||
if (isset($mapNodes[$indexName])) {
|
|
||||||
//print($indexName . " is listed already, skipping\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$description = $zip->getCommentIndex(0);
|
$description = $zip->getCommentIndex(0);
|
||||||
$stat = $zip->statIndex( 0 );
|
$stat = $zip->statIndex( 0 );
|
||||||
$date= date('d.m.Y',$stat['mtime']);
|
$date= date('d.m.Y',$stat['mtime']);
|
||||||
$size= number_format((filesize($filename) / (1024.0*1024.0)), 1, '.', '');
|
$size= number_format((filesize($filename) / (1024.0*1024.0)), 1, '.', '');
|
||||||
$zip->close();
|
$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" );
|
$out = $output->createElement( "region" );
|
||||||
|
$outputIndexes->appendChild($out);
|
||||||
|
}
|
||||||
|
|
||||||
$out -> setAttribute("date", $date);
|
$out -> setAttribute("date", $date);
|
||||||
|
$out -> setAttribute("local", "true");
|
||||||
$out -> setAttribute("size", $size);
|
$out -> setAttribute("size", $size);
|
||||||
$out -> setAttribute("name", $indexName);
|
$out -> setAttribute("name", $indexName);
|
||||||
$out -> setAttribute("description", $description);
|
$out -> setAttribute("description", $description);
|
||||||
$outputIndexes->appendChild($out);
|
|
||||||
//$mapNodes[$indexName] = $out;
|
//$mapNodes[$indexName] = $out;
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
|
|
Loading…
Reference in a new issue