/** * Get the number of times the job has been attempted. * * @return int */ public function attempts() { $stats = $this->pheanstalk->statsJob($this->job); return (int) $stats->reserves; }
/** * See if we can talk to beanstalkd * */ function CheckBeanstalkd() { global $settings; $ret = false; require_once './lib/beanstalkd/pheanstalk_init.php'; $pheanstalk = new Pheanstalk_Pheanstalk($settings['beanstalkd']); if ($pheanstalk->getConnection()->isServiceListening()) { $id = $pheanstalk->putInTube('wpt.installtest', "test"); $jobStats = $pheanstalk->statsJob($id); $tubeStats = $pheanstalk->statsTube('wpt.installtest'); $job = $pheanstalk->reserveFromTube('wpt.installtest', 0); if ($job !== false && $job->getData() == 'test') { $ret = true; } $pheanstalk->delete($job); } return $ret; }