* @return bool whether $url exceeds the hourly quota of the site it is from */ function withinQuota($url) { if (!($site = UrlParser::urlMemberSiteArray($url, $this->quota_sites_keys, "q" . $this->allow_disallow_cache_time, true))) { return true; } list($quota, $current_count) = $this->quota_sites[$site]; if ($current_count < $quota) { $this->quota_sites[$site] = array($quota, $current_count + 1); $flag = true; } else { $flag = false; } if ($this->quota_clear_time + ONE_HOUR < time()) { $this->quota_clear_time = time(); foreach ($this->quota_sites as $site => $info) { list($quota, ) = $info; $this->quota_sites[$site] = array($quota, 0); } } return $flag; } } if (!defined("UNIT_TEST_MODE")) { /* * Instantiate and runs the QueueSever */ $queue_server = new QueueServer($INDEXED_FILE_TYPES); $queue_server->start(); }