cvs: pearweb /cron find-documentation.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sat, 22 Mar 2008 22:08:30 +0000 |
| Subject: | cvs: pearweb /cron find-documentation.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7367@lists.php.net to get a copy of this message | ||
dufuz Sat Mar 22 22:08:30 2008 UTC
Modified files:
/pearweb/cron find-documentation.php
Log:
Bug #13453 Broken cron job - find-documentation.php
http://cvs.php.net/viewvc.cgi/pearweb/cron/find-documentation.php?r1=1.9&r2=1.10&diff_format=u
Index: pearweb/cron/find-documentation.php
diff -u pearweb/cron/find-documentation.php:1.9 pearweb/cron/find-documentation.php:1.10
--- pearweb/cron/find-documentation.php:1.9 Tue Jun 26 21:30:06 2007
+++ pearweb/cron/find-documentation.php Sat Mar 22 22:08:30 2008
@@ -16,49 +16,56 @@
* | Authors: Martin Jansen <mj@php.net> |
* +----------------------------------------------------------------------+
*
- * $Id: find-documentation.php,v 1.9 2007/06/26 21:30:06 dufuz Exp $
+ * $Id: find-documentation.php,v 1.10 2008/03/22 22:08:30 dufuz Exp $
*/
/**
* Trying to find documentation URLs for PEAR packages in the peardoc Docbook sources
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
-require_once "PEAR.php";
-require_once "VFS.php";
-require_once "VFS/file.php";
-require_once "HTTP/Request.php";
+require_once 'PEAR.php';
+require_once 'VFS.php';
+require_once 'VFS/file.php';
+require_once 'HTTP/Request.php';
-require_once "DB.php";
+require_once 'DB.php';
$basepath = "/home/mj/cvs/peardoc/en/package/";
-$vfs = new VFS_file(array("vfsroot" => $basepath));
+$vfs = new VFS_file(array('vfsroot' => $basepath));
$options = array(
'persistent' => false,
'portability' => DB_PORTABILITY_ALL,
);
-$dbh =& DB::connect("mysql://pear:pear@localhost/pear", $options);
+$dbh =& DB::connect(PEAR_DATABASE_DSN, $options);
if (DB::isError($dbh)) {
exit(1);
}
-$update = $dbh->prepare("UPDATE packages SET doc_link = ?
- WHERE name = ? AND (doc_link IS NULL OR doc_link NOT LIKE 'http://%' OR doc_link LIKE 'http://pear.php.net/%')");
+$host = 'http://' . PEAR_CHANNELNAME;
+
+$sql = "
+ UPDATE packages SET
+ doc_link = ?
+ WHERE name = ? AND
+ (doc_link IS NULL OR doc_link NOT LIKE 'http://%' OR
doc_link LIKE '" . $host . "/%')";
+$update = $dbh->prepare($sql);
// {{{ readFolder()
-function readFolder($folder) {
- global $vfs, $basepath, $dbh, $update;
+function readFolder($folder)
+{
+ global $vfs, $basepath, $dbh, $update, $host;
static $level;
$level++;
$result = $vfs->listFolder($folder);
- if ($folder == ".") {
- $folder = "";
+ if ($folder == '.') {
+ $folder = '';
}
foreach ($result as $file) {
@@ -79,20 +86,20 @@
preg_match("/<title>(.*)<\/title>/", $content, $matches1);
preg_match("/<sect1 id\=\"(.*)\">/", $content,
$matches2);
- $url = "/manual/en/" . $matches2[1] . ".php";
+ $url = '/manual/en/' . $matches2[1] . '.php';
- $a = &new HTTP_Request("http://pear.php.net" . $url);
+ $a = &new HTTP_Request($host . $url);
$a->sendRequest();
if ($a->getResponseCode() == 404) {
$new_url = preg_replace("=\.([^\.]+)\.php$=", ".php",
$url);
- $a->reset("http://pear.php.net/" . $new_url);
+ $a->reset($host . $new_url);
if ($a->getResponseCode() != 404) {
$url = $new_url;
} else {
- $url = "";
+ $url = '';
}
}
@@ -104,5 +111,4 @@
// }}}
-readFolder(".");
-?>
+readFolder('.');
\ No newline at end of file