コード例 #1
0
	public static function loadExitNodes() {
		wfProfileIn( __METHOD__ );

		global $wgTorIPs, $wgMemc;

		// Set loading key, to prevent DoS of server.

		$wgMemc->set( 'mw-tor-list-status', 'loading', 300 );

		$nodes = array();
		foreach( $wgTorIPs as $ip ) {
			$nodes = array_unique( array_merge( $nodes, self::loadNodesForIP( $ip ) ) );
		}

		// Save to cache.
		$wgMemc->set( 'mw-tor-exit-nodes', $nodes, 1800 ); // Store for half an hour.
		$wgMemc->set( 'mw-tor-list-status', 'loaded', 1800 );

		wfProfileOut( __METHOD__ );

		return self::$mExitNodes = $nodes;
	}
コード例 #2
0
ファイル: TorBlock.class.php プロジェクト: Tjorriemorrie/app
 public static function loadExitNodes()
 {
     wfProfileIn(__METHOD__);
     global $wgTorIPs, $wgMemc;
     // we want to trace when the memcache entry expires and we generate new
     if (class_exists('Wikia\\Logger\\WikiaLogger')) {
         \Wikia\Logger\WikiaLogger::instance()->debug('TorBlock::loadExitNodes');
     }
     // Set loading key, to prevent DoS of server.
     $wgMemc->set('mw-tor-list-status', 'loading', 300);
     $nodes = array();
     foreach ($wgTorIPs as $ip) {
         $nodes = array_unique(array_merge($nodes, self::loadNodesForIP($ip)));
     }
     // Save to cache.
     $wgMemc->set('mw-tor-exit-nodes', $nodes, 1800);
     // Store for half an hour.
     $wgMemc->set('mw-tor-list-status', 'loaded', 1800);
     wfProfileOut(__METHOD__);
     return self::$mExitNodes = $nodes;
 }