我正在使用 beanstalkd 来排队作业。
我在我的里面写了一个 php 脚本app/Lib/Queue/Beanstalk/workers/DownloadFileWorker.php
<?php
require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'config.php');
class DownloadS3FilesWorker extends PHPQueue\Worker
{
/**
* @var \PHPQueue\Backend\FS
*/
static private $dataSource;
public $factory = null;
private $queueConfig = array();
private $queueBackend = 'Beanstalkd';
public function __construct()
{
parent::__construct();
$this->queueConfig = EPubConfig::getConfig($this->queueBackend);
self::$dataSource = \PHPQueue\Base::backendFactory($this->queueBackend, $this->queueConfig);
}
/**
* @param \PHPQueue\Job $jobObject
*/
public function runJob($jobObject)
{
parent::runJob($jobObject);
$jobData = $jobObject->data;
App::uses('FileFactory', 'Lib/File');
$this->factory = new FileFactory($jobData);
$this->factory->downloadAllFiles();
$this->result_data = $jobData;
}
}
我收到以下错误。
PHP Fatal error: Class 'App' not found in /var/virtual/someapp/Lib/Queue/Beanstalk/workers/DownloadFileWorker.php on line 27
它FileFactory
本身将使用许多其他与 Cake 相关的类。