|  | <?php | 
|  | /******************************************************************************* | 
|  | * Copyright (c) 2010 Eclipse Foundation and others. | 
|  | * All rights reserved. This program and the accompanying materials | 
|  | * are made available under the terms of the Eclipse Public License v1.0 | 
|  | * which accompanies this distribution, and is available at | 
|  | * http://www.eclipse.org/legal/epl-v10.html | 
|  | * | 
|  | * Contributors: | 
|  | *    Wayne Beaton (Eclipse Foundation)- initial API and implementation | 
|  | *******************************************************************************/ | 
|  |  | 
|  | require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); | 
|  | require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/projectInfoData.class.php"); // use the project info system | 
|  |  | 
|  | require_once '../common/project.class.php'; | 
|  |  | 
|  | $App = new App(); | 
|  |  | 
|  | $repeat = 10; | 
|  | $iterations = 100; | 
|  |  | 
|  | while ($repeat-- > 0) { | 
|  | $start = microtime(); | 
|  | $count = $iterations; | 
|  | while ($count-- > 0) get_project("technology.dash"); | 
|  | $end = microtime(); | 
|  |  | 
|  | $new = $end - $start; | 
|  |  | 
|  | $start = microtime(); | 
|  | $count = $iterations; | 
|  | while ($count-- > 0) new ProjectInfoData("technology.dash"); | 
|  | $end = microtime(); | 
|  |  | 
|  | $old = $end - $start; | 
|  |  | 
|  | $diff = $old - $new; | 
|  |  | 
|  | $report = "New: $new; Old: $old; Difference: $diff"; | 
|  | if ($diff > 0) $report = "<font color=\"Green\">$report</font>"; | 
|  |  | 
|  | echo "$report<br/>"; | 
|  |  | 
|  | echo "<br/>"; | 
|  | } | 
|  | //echo "1 " . determineForum("http://www.eclipse.org/newsportal/thread.php?group=eclipse.technology.mat"); | 
|  | //echo "<br><br>"; | 
|  | //echo "2 " . determineForum("news://news.eclipse.org/eclipse.technology.ofmp"); | 
|  | //echo "<br><br>"; | 
|  | //echo "3 " . determineForum("news://news.eclipse.org:119/eclipse.technology.imp"); | 
|  | //echo "<br><br>"; | 
|  | //echo "4 " . determineForum("news:eclipse.technology.tigerstripe"); | 
|  | //echo "<br><br>"; | 
|  | //echo "5 " . determineForum("http://dev.eclipse.org/newslists/news.eclipse.tools.hibachi/maillist.html"); | 
|  | //echo "<br><br>"; | 
|  | //echo "6 " . determineForum("technology.babel"); | 
|  | //echo "<br><br>"; | 
|  | //echo "7 " . isNewsgroupUrl("news://junk"); | 
|  | //echo "<br><br>"; | 
|  | //echo "7 " . isNewsgroupUrl("news.junk"); | 
|  | // | 
|  | //function determineForum($url) { | 
|  | //	// http://www.eclipse.org/newsportal/thread.php?group=eclipse.technology.mat | 
|  | //	// news://news.eclipse.org/eclipse.technology.ofmp | 
|  | //	// news://news.eclipse.org:119/eclipse.technology.imp | 
|  | //	// news:eclipse.technology.tigerstripe | 
|  | //	// http://dev.eclipse.org/newslists/news.eclipse.tools.hibachi/maillist.html | 
|  | //	// technology.babel | 
|  | // | 
|  | //	$projectPattern = "[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+){0,2}"; | 
|  | //	$patterns = array( | 
|  | //		"/^http:\\/\\/www.eclipse.org\\/newsportal\\/thread.php\\?group=($projectPattern)$/", | 
|  | //		"/^news:\\/\\/news.eclipse.org\\/($projectPattern)$/", | 
|  | //		"/^news:\\/\\/news.eclipse.org:119\\/($projectPattern)$/", | 
|  | //		"/^news:($projectPattern)$/", | 
|  | //		"/^http:\\/\\/dev.eclipse.org\\/newslists\\/news.($projectPattern)\\/maillist.html$/", | 
|  | //		"/^($projectPattern)$/" | 
|  | //	); | 
|  | // | 
|  | //	foreach ($patterns as $pattern) { | 
|  | //		$matches = array(); | 
|  | //		if (preg_match($pattern, $url, $matches)) { | 
|  | //			return $matches[1]; | 
|  | //		} | 
|  | //	} | 
|  | // | 
|  | //	return $null; | 
|  | //} | 
|  |  | 
|  | ?> |