* General settings * * Uncomment to override the default settings. * * $resquePrefix is the prefix php-resque prepends to all its keys. * * @var array */ $settings = array('cubePublic' => array('host' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'http://localhost:1081/', 'port' => 1081), 'readOnly' => true, 'resqueConfig' => __DIR__ . DIRECTORY_SEPARATOR . './resque.ini'); /** * Service settings * All database connection settings * * @var array */ ResqueBoard\Lib\Service\Service::$settings = array('Redis' => array('host' => 'www1', 'port' => 6379, 'database' => 0, 'password' => '', 'prefix' => 'resque'), 'Mongo' => array('host' => 'localhost', 'port' => 27017, 'database' => 'cube_development'), 'Cube' => array('host' => '127.0.0.1', 'port' => 1081)); /** * Default number of items to display for pagination * * @var int */ define('PAGINATION_LIMIT', 15); /** * Debug mode * * @var bool */ define('DEBUG', false); /** * Path to the cache folder *
$app->response()->header("Status", "410"); echo json_encode(array('message' => 'Worker not found')); } catch (ResqueBoard\Lib\Resque\WorkerAlreadyPausedException $e) { $app->response()->header("Status", "404"); echo json_encode(array('message' => 'Worker is already paused')); } }); $app->get('/api/workers/resume/:worker', function ($worker) use($app, $settings) { $app->response()->header("Content-Type", "application/json"); if ($settings['readOnly']) { $app->response()->header("Status", "403"); echo json_encode(array('message' => 'You don\'t have permission to resume worker')); return; } try { $resqueApi = new ResqueBoard\Lib\Resque\Api(ResqueBoard\Lib\Service\Service::Redis()); $response = $resqueApi->resume($worker); if ($response !== true) { echo json_encode(array('message' => $response)); } } catch (ResqueBoard\Lib\Resque\InvalidWorkerNameException $e) { $app->response()->header("Status", "400"); echo json_encode(array('message' => 'Invalid worker name')); } catch (ResqueBoard\Lib\Resque\WorkerNotExistException $e) { $app->response()->header("Status", "410"); echo json_encode(array('message' => 'Worker not found')); } catch (ResqueBoard\Lib\Resque\WorkerNotPausedException $e) { $app->response()->header("Status", "404"); echo json_encode(array('message' => 'Worker is already running')); } });