mirror of
https://github.com/php/web-doc.git
synced 2025-08-13 14:40:31 +00:00
76 lines
2.5 KiB
PHP
76 lines
2.5 KiB
PHP
<?php
|
|
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
|
|
+----------------------------------------------------------------------+
|
|
| PHP Documentation Site Source Code |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 1997-2009 The PHP Group |
|
|
+----------------------------------------------------------------------+
|
|
| This source file is subject to version 3.0 of the PHP license, |
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
| available at through the world-wide-web at |
|
|
| http://www.php.net/license/3_0.txt. |
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
+----------------------------------------------------------------------+
|
|
| Authors: Vincent Gevers <vincent@php.net> |
|
|
| Sean Coates <sean@php.net> |
|
|
+----------------------------------------------------------------------+
|
|
$Id$
|
|
*/
|
|
|
|
// config comes from notes_stats.php
|
|
|
|
if (@filesize($DBFile) < 3000000) { // require at least 3 MBs
|
|
$out = FALSE;
|
|
return;
|
|
}
|
|
|
|
$sqlite = sqlite_open($DBFile);
|
|
|
|
$info = sqlite_fetch_array(sqlite_query($sqlite, 'SELECT * FROM info'), SQLITE_ASSOC);
|
|
|
|
// fetch/sort data
|
|
$array = sqlite_fetch_all(sqlite_query($sqlite, 'SELECT * FROM notes'), SQLITE_ASSOC);
|
|
sqlite_close($sqlite);
|
|
$time = time() - 60*60*24*365;
|
|
|
|
foreach($array as $row) {
|
|
@++$data[$row['who']][$row['action']];
|
|
@++$total[$row['who']];
|
|
@++$manual[$row['manpage']];
|
|
|
|
if ($row['time'] >= $time) {
|
|
@++$data_new[$row['who']][$row['action']];
|
|
@++$data_new[$row['who']]['total'];
|
|
}
|
|
|
|
}
|
|
unset($data['']);
|
|
ksort($data);
|
|
ksort($data_new);
|
|
arsort($total);
|
|
arsort($manual);
|
|
|
|
$build_date = date('j F Y', $info['build_date']);
|
|
|
|
$notesData = array(
|
|
'last_article' => $info['last_article'],
|
|
'build_date' => $build_date,
|
|
'data' => $data,
|
|
'data_new' => $data_new,
|
|
'total' => $total,
|
|
'manual' => $manual,
|
|
'minact' => $minact,
|
|
);
|
|
|
|
$out = "<?php\n";
|
|
$out .= "// This script generated by scripts/notes_stats_output.php -- DO NOT COMMIT\n";
|
|
$out .= "\$notesData = ". var_export($notesData, true) .";\n";
|
|
$out .= "if (isset(\$_GET['raw_data']) && \$_GET['raw_data']) {\n";
|
|
$out .= " var_export(\$notesData);\n";
|
|
$out .= "}\n";
|
|
$out .= "// EOF\n?>";
|
|
|
|
?>
|