From 2579631599b86f35e56694ebf487949bfc21682a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 1 May 2016 22:15:31 -0400 Subject: [PATCH] The producer/worker can works only from the command line --- producer.php | 4 ++++ worker.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/producer.php b/producer.php index e2f53e8..53facaf 100644 --- a/producer.php +++ b/producer.php @@ -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) { diff --git a/worker.php b/worker.php index 433193f..59418e0 100644 --- a/worker.php +++ b/worker.php @@ -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)) {