cvs: docweb /cron/weekly orphan_notes /include lib_general.inc.php /scripts orphan_notes.php /www .cvsignore
| From: | Nuno Lopes | Date: | Mon, 17 Jan 2005 11:04:41 +0000 |
| Subject: | cvs: docweb /cron/weekly orphan_notes /include lib_general.inc.php /scripts orphan_notes.php /www .cvsignore | ||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-474@lists.php.net to get a copy of this message | ||
nlopess Mon Jan 17 06:04:41 2005 EDT
Added files:
/docweb/cron/weekly orphan_notes
/docweb/scripts orphan_notes.php
Modified files:
/docweb/include lib_general.inc.php
/docweb/www .cvsignore
Log:
add orphan notes script
http://cvs.php.net/diff.php/docweb/include/lib_general.inc.php?r1=1.29&r2=1.30&ty=u
Index: docweb/include/lib_general.inc.php
diff -u docweb/include/lib_general.inc.php:1.29 docweb/include/lib_general.inc.php:1.30
--- docweb/include/lib_general.inc.php:1.29 Fri Oct 29 10:33:04 2004
+++ docweb/include/lib_general.inc.php Mon Jan 17 06:04:40 2005
@@ -18,7 +18,7 @@
| Gabor Hojtsy <goba@php.net> |
| Sean Coates <sean@php.net> |
+----------------------------------------------------------------------+
-$Id: lib_general.inc.php,v 1.29 2004/10/29 14:33:04 vincent Exp $
+$Id: lib_general.inc.php,v 1.30 2005/01/17 11:04:40 nlopess Exp $
*/
function is_translation($project, $language)
@@ -200,6 +200,7 @@
}
if (SITE == 'php') {
$links['doc-howto'] = BASE_URL .'/dochowto/index.php';
+ $links['orphan-notes'] = BASE_URL .'/orphan_notes.php';
}
return DocWeb_Template::get(
'shared/nav_links.tpl.php',
http://cvs.php.net/diff.php/docweb/www/.cvsignore?r1=1.1&r2=1.2&ty=u
Index: docweb/www/.cvsignore
diff -u docweb/www/.cvsignore:1.1 docweb/www/.cvsignore:1.2
--- docweb/www/.cvsignore:1.1 Sat Oct 30 07:00:03 2004
+++ docweb/www/.cvsignore Mon Jan 17 06:04:41 2005
@@ -1 +1,2 @@
-robots.txt
\ No newline at end of file
+robots.txt
+orphan_notes.php
http://cvs.php.net/co.php/docweb/scripts/orphan_notes.php?r=1.1&p=1
Index: docweb/scripts/orphan_notes.php
+++ docweb/scripts/orphan_notes.php
<?php
/**
* +----------------------------------------------------------------------+
* | PHP Documentation Site Source Code |
* +----------------------------------------------------------------------+
* | Copyright (c) 1997-2005 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: Nuno Lopes <nlopess@php.net> |
* +----------------------------------------------------------------------+
*
* $Id: orphan_notes.php,v 1.1 2005/01/17 11:04:41 nlopess Exp $
*/
/*
* This script searches for orphan notes in the phpdoc manual
* You need a rsync'ed phpweb dir
*/
$inCli = true;
include '../include/init.inc.php';
$manual_dir = CVS_DIR .'/phpweb/manual/en';
$notes_dir = CVS_DIR .'/phpweb/backend/notes';
/* Collect manual IDs */
function recurse_manual($dir) {
global $files, $len;
if (!$dh = opendir($dir)) {
exit;
}
while (($file = readdir($dh)) !== false) {
if($file == '.' || $file == '..') {
continue;
}
$path = $dir.'/'.$file;
if(is_dir($path)) {
recurse_manual($path);
} else {
$files[substr(md5(substr($path, $len, -4)), 0, 16)] = 1;
}
}
closedir($dh);
}
/* Search for bogus notes IDs */
function recurse_notes($dir) {
global $array, $files, $n_files, $n_notes;
if (!$dh = opendir($dir)) {
exit;
}
while (($file = readdir($dh)) !== false) {
if($file == '.' || $file == '..' || substr($file, -4) ==
'.bz2' ||
$file == 'last-updated' || $file == 'sections') {
continue;
}
$path = $dir.'/'.$file;
if(is_dir($path)) {
recurse_notes($path);
} else {
if(isset($files[$file])) {
continue;
}
$fp = fopen($path, 'r');
while (!feof($fp)) {
$line = chop(fgets($fp, 12288));
if ($line == '') { continue; }
list($id, $sect) = explode('|', $line);
$array[$sect][] = $id;
++$n_notes;
} // file orphan
++$n_files;
} // file
} // main while
closedir($dh);
}
/* output HTML */
function output_html() {
global $array, $n_notes, $n_files;
echo "<?php include_once '../include/init.inc.php'; echo
site_header('docweb.common.header.orphan-notes');
?><p> </p>";
if(count($array) == 0) {
echo '<p>Currently, there are no orphan notes!</p>';
echo '<?php echo site_footer(); ?>';
return;
}
echo '<table class="Tc"><tr class="blue"><th>Old
ID</th>'.
'<th>Notes IDs</th><th>Move to new ID:</th></tr>';
foreach($array as $id => $notes) {
echo '<tr
class="old"><td>'.$id.'</td><td>' .
preg_replace('/(\d+)/', '<a href="http://master.php.net/manage/user-notes.php?keyword=$1">$1</a>',
implode(', ', $notes)) .
'</td><td><form action="http://master.php.net/manage/user-notes.php?action=mass"
method="post">'.
'<input type="hidden" name="step" value="1"
/><input type="hidden" name="old_sect" value="' . $id .
'" />'.
'<input type="text" name="new_sect" value=""
size="30" maxlength="80" /><input type="submit"
value=">" /></form></td></tr>';
}
echo "</table><p> </p><p><b>Total Notes</b>:
$n_notes<br/><b>Total files</b>: $n_files</p>".
'<?php echo site_footer(); ?>';
}
/* begin main program */
$len = strlen("$manual_dir/");
$n_notes = $n_files = 0;
recurse_manual($manual_dir);
recurse_notes($notes_dir);
output_html();
?>