cvs: pearweb /cron pepr.php
| From: | Daniel Convissor | Date: | Thu, 08 Jul 2004 20:45:07 +0000 |
| Subject: | cvs: pearweb /cron pepr.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-21659@lists.php.net to get a copy of this message | ||
danielc Thu Jul 8 16:45:07 2004 EDT
Modified files:
/pearweb/cron pepr.php
Log:
* Add docblocks.
* Coding standards.
* Assign by reference where appropriate.
* Use PEAR_DATABASE_DSN for DSN.
* Add require_once 'pear-database.php' to eliminate fatal error of
"Class 'user' not found." That class is needed inside sendActionEmail().
http://cvs.php.net/diff.php/pearweb/cron/pepr.php?r1=1.8&r2=1.9&ty=u
Index: pearweb/cron/pepr.php
diff -u pearweb/cron/pepr.php:1.8 pearweb/cron/pepr.php:1.9
--- pearweb/cron/pepr.php:1.8 Mon Apr 19 06:39:40 2004
+++ pearweb/cron/pepr.php Thu Jul 8 16:45:07 2004
@@ -1,44 +1,61 @@
-<?PHP
-/*
- +----------------------------------------------------------------------+
- | PEAR Web site version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 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/2_02.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: Tobias Schlitt <toby@php.net> |
- +----------------------------------------------------------------------+
- $Id: pepr.php,v 1.8 2004/04/19 10:39:40 mj Exp $
-*/
+<?php
+/**
+ * Automated tasks for the package proposal system (PEPr).
+ *
+ * 1) Checks if a proposal should automatically be finished.
+ *
+ * NOTE: Proposal constants are defined in pearweb/include/pear-config.php.
+ *
+ * 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 through the world-wide-web at the following URI:
+ * 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.
+ *
+ * @category pearweb
+ * @package PEPr
+ * @author Tobias Schlitt <toby@php.net>
+ * @copyright Copyright (c) 1997-2004 The PHP Group
+ * @license http://www.php.net/license/3_0.txt
PHP License
+ * @version $Id: pepr.php,v 1.9 2004/07/08 20:45:07 danielc Exp $
+ */
+
+
+ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR
+ . '/usr/local/www/pearweb/include');
-ini_set("include_path",
ini_get("include_path").PATH_SEPARATOR."/usr/local/www/pearweb/include");
+/**
+ * Get common settings.
+ */
+require_once 'pear-config.php';
-require_once('DB.php');
-
/**
- * DSN for pear packages database
+ * Obtain the system's common functions and classes.
*/
-$dsn = "mysql://pear:pear@localhost/pear";
-$dbh = DB::connect($dsn);
+require_once 'pear-database.php';
+
+/**
+ * Get the database class.
+ */
+require_once 'DB.php';
+$dbh =& DB::connect(PEAR_DATABASE_DSN);
if (DB::isError($dbh)) {
die ("Failed to connect: $dsn\n");
}
-require_once 'pear-config.php';
+
+/**
+ * Obtain PEPr's common functions and classes.
+ */
require_once 'pepr/pepr.php';
+$proposals =& proposal::getAll($dbh, 'vote');
+
// This checks if a proposal should automatically be finished
-
-$proposals = proposal::getAll($dbh, "vote");
foreach ($proposals AS $id => $proposal) {
if ($proposal->getStatus() == "vote") {
@@ -61,4 +78,5 @@
}
}
}
+
?>