svn: /web/php-master/trunk/ entry/user-note.php include/functions.inc include/spam-lib.inc manage/mirrors.php scripts/mirror-test

From: Date: Mon, 16 May 2011 15:52:27 +0000
Subject: svn: /web/php-master/trunk/ entry/user-note.php include/functions.inc include/spam-lib.inc manage/mirrors.php scripts/mirror-test
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-11015@lists.php.net to get a copy of this message
danbrown Mon, 16 May 2011 15:52:27 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=311095 Log: Add our little friend to the list of losers who aren't allowed to post. Changed paths: U web/php-master/trunk/entry/user-note.php U web/php-master/trunk/include/functions.inc U web/php-master/trunk/include/spam-lib.inc U web/php-master/trunk/manage/mirrors.php U web/php-master/trunk/scripts/mirror-test Modified: web/php-master/trunk/entry/user-note.php =================================================================== --- web/php-master/trunk/entry/user-note.php 2011-05-16 15:50:22 UTC (rev 311094) +++ web/php-master/trunk/entry/user-note.php 2011-05-16 15:52:27 UTC (rev 311095) @@ -9,7 +9,7 @@ include_once 'spam-lib.inc'; $mailto = 'php-notes@lists.php.net'; -$failto = 'jimw@php.net, alindeman@php.net'; +$failto = 'jimw@php.net, alindeman@php.net, danbrown@php.net'; function validateUser($user) { $ret = filter_var($user, FILTER_VALIDATE_EMAIL); Modified: web/php-master/trunk/include/functions.inc =================================================================== --- web/php-master/trunk/include/functions.inc 2011-05-16 15:50:22 UTC (rev 311094) +++ web/php-master/trunk/include/functions.inc 2011-05-16 15:52:27 UTC (rev 311095) @@ -33,6 +33,9 @@ <li><a href="/manage/user-notes.php">Notes</a></li> <li><a href="http://wiki.php.net/">Wiki</a></li> <li><a href="http://bugs.php.net/">Bugsweb</a></li> + <?php if (isset($_SESSION['user'])) { ?> + <li><a href="/manage/users.php?username=<?php echo $_SESSION['user']; ?>">My php.net Profile</a></li> + <?php } ?> </ul> <?php warn("Have you changed your password yet?"); ?> <?php Modified: web/php-master/trunk/include/spam-lib.inc =================================================================== --- web/php-master/trunk/include/spam-lib.inc 2011-05-16 15:50:22 UTC (rev 311094) +++ web/php-master/trunk/include/spam-lib.inc 2011-05-16 15:52:27 UTC (rev 311095) @@ -6,6 +6,7 @@ // List of usual SPAM words $words_blacklist = array( + '000webhost', 'adipex', 'alprazolam', 'arimidex', Modified: web/php-master/trunk/manage/mirrors.php =================================================================== --- web/php-master/trunk/manage/mirrors.php 2011-05-16 15:50:22 UTC (rev 311094) +++ web/php-master/trunk/manage/mirrors.php 2011-05-16 15:52:27 UTC (rev 311095) @@ -529,6 +529,9 @@ get notices of the deactivation weekly. Manually-deactivated mirrors are not checked by the bot, so they need some time after reactivation to get listed again. Mirror checks are done automatically every hour, and there is no direct manual way to start a check (at this time). +</p> + +<p> <strong>NOTE</strong>: Manual deactivation of a mirror will now also disable its DNS. </p> Modified: web/php-master/trunk/scripts/mirror-test =================================================================== --- web/php-master/trunk/scripts/mirror-test 2011-05-16 15:50:22 UTC (rev 311094) +++ web/php-master/trunk/scripts/mirror-test 2011-05-16 15:52:27 UTC (rev 311095) @@ -1,4 +1,4 @@ -#!/local/php5/bin/php -q +#!/usr/bin/php -q <?php # vim: ft=php et // This script is executed on master @@ -19,25 +19,46 @@ set_time_limit(30 * 60); // Connect to local MySQL database -mysql_connect("localhost", "nobody", "") or die("unable to connect to database"); +mysql_connect("localhost", "root", "") or die("unable to connect to database"); mysql_select_db("phpmasterdb"); -// Get mirror information for all active mirrors (regardless of their type!) -$query = "SELECT maintainer, hostname, id, has_search, has_stats, lang, - UNIX_TIMESTAMP(lastchecked) as lastchecked, - UNIX_TIMESTAMP(lastupdated) AS lastupdated - FROM mirrors WHERE active = 1"; -$result = mysql_query($query) or die("unable to get from the database: " . mysql_error()); +// Allow for single-mirror testing so that we can manually test mirrors. +if (!isset($argv[1])) { -// Get all mirror site data to the $hosts array -$hosts = array(); -while ($row = mysql_fetch_array($result)) { - $hosts[] = $row; + // Get mirror information for all active mirrors (regardless of their type!) + $query = "SELECT maintainer, hostname, id, has_search, has_stats, lang, + UNIX_TIMESTAMP(lastchecked) as lastchecked, + UNIX_TIMESTAMP(lastupdated) AS lastupdated + FROM mirrors WHERE active = 1"; + $result = mysql_query($query) or die("unable to get from the database: " . mysql_error()); + + // Get all mirror site data to the $hosts array + $hosts = array(); + while ($row = mysql_fetch_array($result)) { + $hosts[] = $row; + } + + // Free up the result to get more memory + mysql_free_result($result); + +} else { + + // Get the data for just a single mirror, by request. + $query = "SELECT maintainer, hostname, id, has_search, has_stats, lang, + UNIX_TIMESTAMP(lastchecked) as lastchecked, + UNIX_TIMESTAMP(lastupdated) AS lastupdated + FROM mirrors WHERE hostname='".mysql_real_escape_string($argv[1])."' LIMIT 0,1"; + + $result = mysql_query($query) or die("Unable to access mirror record. Perhaps '".$argv[1]."' does not exist. Error: ".mysql_error().PHP_EOL."SQL Query: ".$query.PHP_EOL); + + // Get the data and populate the $hosts array, which will interface with the rest of the legacy code. + $hosts[] = mysql_fetch_array($result); + + // And, again like above, free up the memory by killing the MySQL connection. + mysql_free_result($result); + } -// Free up the result to get more memory -mysql_free_result($result); - // Check host for errors, inject data into $data and $problem function host_has_error($hostname, $filename, &$data, &$problem) { @@ -105,6 +126,8 @@ // Get all mirror sites, and count the index of them foreach ($hosts as $index => $host) { + echo 'Testing '.$host['hostname'].'.'.PHP_EOL; + // Request the exact file on www.php.net as it redirects // shortcut requests to a mirror site, and we would not handle // that properly. Otherwise on a mirror site we need to check @@ -145,7 +168,7 @@ $hosts[$index]['disable'] = true; $hosts[$index]['problem'] = "Invalid last update time."; } - + // If new search information is available, override previous one /*if (in_array($info[3], array('0', '1', '2'))) { $hosts[$index]['has_search'] = $info[3]; @@ -308,8 +331,8 @@ "lang = '" . $host['lang'] . "', " . "ocmt = '' " . "WHERE hostname = '" . $host['hostname'] . "'"; - - $result = mysql_query($query) or die("unable to update the database: $query: " . mysql_error()); + + $result = mysql_query($query) or die("Unable to update the database: $query: " . mysql_error().PHP_EOL); if ($result) { $mirrorsupdated++; } else { $problems .= $host['hostname'] . "\t- cannot be updated in database\n"; } } @@ -327,7 +350,7 @@ "lastupdated = FROM_UNIXTIME(" . $host['lastupdated'] . ") " . "WHERE hostname = '" . $host['hostname'] . "'"; } - $result = mysql_query($query) or die("unable to update the database: $query: " . mysql_error()); + $result = mysql_query($query) or die("Unable to update the database: $query: " . mysql_error()); $problems .= $host['hostname'] . "\t- " . $host['problem'] . "\n"; } @@ -336,7 +359,7 @@ // Send a debug mail at midnight with current details if (intval(date("H")) == 0) { @mail( - "bjori@php.net", + "bjori@php.net,danbrown@php.net", "Mirror site updates done", "$mirrorsupdated mirror sites properly updated (out of " . count($hosts) . ")\n\nProblematic mirrors:\n\n" . $problems ); @@ -344,9 +367,8 @@ // If less then 70 mirrors updated there is something severly wrong. mail it. if ($mirrorsupdated < 70) { @mail( - "php-webmaster@lists.php.net", + "php-webmaster@lists.php.net,danbrown@php.net", "[CRITICAL] Mirror site updates failure", "$mirrorsupdated mirror sites properly updated (out of " . count($hosts) . ")\n\nProblematic mirrors:\n\n" . $problems ); } -

« previous php.webmaster (#11015) next »