The producer/worker can works only from the command line

This commit is contained in:
Frederic Guillot 2016-05-01 22:15:31 -04:00
parent b2edaad23d
commit 2579631599
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,10 @@ use Pheanstalk\Pheanstalk;
require __DIR__.'/common.php';
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);
}
$connection = new Pheanstalk(BEANSTALKD_HOST);
foreach (Model\Feed\get_ids() as $feed_id) {

View File

@ -4,6 +4,10 @@ use Pheanstalk\Pheanstalk;
require __DIR__.'/common.php';
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);
}
$connection = new Pheanstalk(BEANSTALKD_HOST);
while ($job = $connection->reserveFromTube(BEANSTALKD_QUEUE)) {