cvs: pearweb /cron package-stats.php

From: Date: Mon, 03 Jun 2002 17:38:34 +0000
Subject: cvs: pearweb /cron package-stats.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4393@lists.php.net to get a copy of this message
richard Mon Jun 3 13:38:34 2002 EDT Added files: /pearweb/cron package-stats.php Log: * Beginnings of a cron script to gather stats Index: pearweb/cron/package-stats.php +++ pearweb/cron/package-stats.php #!/usr/bin/php -Cq <?php /* * +----------------------------------------------------------------------+ * | PEAR Web site version 1.0 | * +----------------------------------------------------------------------+ * | Copyright (c) 2001 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: Richard Heyes <richard@php.net> | * +----------------------------------------------------------------------+ * $Id: package-stats.php,v 1.1 2002/06/03 17:38:34 richard Exp $ * * This short script populates the package_stats table and should be run * via cron. */ require_once('DB.php'); /** * DSN for pear packages database */ $dsn = "mysql://pear:pear@localhost/pear"; $dbh = DB::connect($dsn); if (DB::isError($db = DB::connect($dsn))) { die ("Failed to connect: $dsn\n"); } /** * Query the packages info and insert the results into * the package_stats page */ $sql = 'INSERT INTO package_stats SELECT COUNT(d.id) AS dl_number, p.name AS package, r.version AS release, p.id AS pid, r.id AS rid, p.category AS cid FROM downloads d, packages p, releases r WHERE d.package = p.id AND d.release = r.id GROUP BY d.package, d.release ORDER BY dl_number DESC'; if (DB::isError($db->query($sql))) { die('Query failed'); } ?>

« previous php.pear.cvs (#4393) next »