public function execute() {
		$params = $this->extractRequestParams();
		$result = OnlineStatusBar::getUserInfoFromString( $params['user'] );
		// if user is IP and we track them
		if ( User::isIP( $params['user'] ) && $result === false ) {
			$result = OnlineStatusBar::getAnonFromString( $params['user'] );
		}
		if ( $result === false ) {
			$ret = 'unknown';
		} else {
			$ret = $result[0];
		}

		$this->getResult()->addValue(
			null, $this->getModuleName(), array( 'result' => $ret ) );
	}
 /**
  * @param $parser Parser
  * @param $varCache ??
  * @param $index ??
  * @param $ret string?
  * @return bool
  */
 public static function parserGetVariable(&$parser, &$varCache, &$index, &$ret)
 {
     global $wgOnlineStatusBarCacheTime;
     if ($index != 'ISONLINE') {
         return true;
     }
     // get a status of user parsed from title
     $result = OnlineStatusBar::getUserInfoFromString($parser->getTitle()->getBaseText());
     // if user is IP and we track them
     if (User::isIP($parser->getTitle()->getBaseText()) && $result === false) {
         $result = OnlineStatusBar::getAnonFromString($parser->getTitle()->getBaseText());
     }
     if ($result === false) {
         $ret = 'unknown';
         return true;
     }
     // if user is tracked we need to remove parser cache so that page update when status change
     if ($result !== false) {
         $parser->getOutput()->updateCacheExpiry($wgOnlineStatusBarCacheTime[$result[0]] * 60);
     }
     $ret = $result[0];
     return true;
 }
	/**
	 * Delete old records from the table, this function is called frequently to keep the table as small as possible
	 * it's also possible to disable this function to set automatic job in cron to do that
	 * @return int
	 */
	public static function deleteOld() {
		global $wgOnlineStatusBarAutoDelete;
		if ( !$wgOnlineStatusBarAutoDelete ) {
			return 0;
		}
		if ( self::getCache( 'null', 'delete' ) == 'true' ) {
			return 0;
		}
		// Check if we actually need to delete something before we write to master
		$dbr = wfGetDB( DB_SLAVE );
		$time = OnlineStatusBar::getTimeoutDate();
		$result = $dbr->selectField( 'online_status', 'timestamp', array( 'timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $time ) ) ),
			__METHOD__, array( 'LIMIT 1' ) );
		if ( $result === false ) {
			// no need for delete
			return 0;
		}

		// calculate time and convert it back to mediawiki format
		$dbw = wfGetDB( DB_MASTER );
		$dbw->delete( 'online_status', array( 'timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $time ) ) ), __METHOD__ );
		self::setCache( 'null', 'true', 'delete', 3600 ); // remember we deleted it for 1 hour so that we avoid calling this too many times
		return 0;
	}