mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Compare commits
2 commits
81fe761577
...
eb3395645f
Author | SHA1 | Date | |
---|---|---|---|
eb3395645f | |||
e3ac97920c |
9 changed files with 78 additions and 58 deletions
|
@ -1,3 +1,9 @@
|
|||
# 2.5.1 (2025-06-08)
|
||||
- Update psr/log version requirements
|
||||
|
||||
# 2.5.0 (2025-06-08)
|
||||
- Update packages
|
||||
|
||||
# 2.4.0 (2024-12-11)
|
||||
- Update packages (psr/log ^3.0.2)
|
||||
|
||||
|
|
28
README.md
28
README.md
|
@ -42,7 +42,7 @@ On top of the original fork (chrisboulton/php-resque) I have added:
|
|||
|
||||
## Requirements ##
|
||||
|
||||
* PHP 7.0+
|
||||
* PHP 8.1+
|
||||
* phpredis
|
||||
* Redis 2.2+
|
||||
|
||||
|
@ -74,7 +74,7 @@ Resque::setBackend('redis:6379');
|
|||
|
||||
$args = ['name' => 'TestName'];
|
||||
|
||||
Resque::enqueue('default', 'My_Job', $args);
|
||||
Resque::enqueue('default', '\App\MyJobClass', $args);
|
||||
```
|
||||
|
||||
### Defining Jobs ###
|
||||
|
@ -82,7 +82,9 @@ Resque::enqueue('default', 'My_Job', $args);
|
|||
Each job should be in its own class, and include a `perform` method.
|
||||
|
||||
```php
|
||||
class My_Job
|
||||
namespace \App;
|
||||
|
||||
class MyJobClass
|
||||
{
|
||||
public function perform()
|
||||
{
|
||||
|
@ -105,7 +107,9 @@ The `tearDown` method, if defined, will be called after the job finishes.
|
|||
|
||||
|
||||
```php
|
||||
class My_Job
|
||||
namespace App;
|
||||
|
||||
class MyJobClass
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
|
@ -129,17 +133,17 @@ class My_Job
|
|||
This method can be used to conveniently remove a job from a queue.
|
||||
|
||||
```php
|
||||
// Removes job class 'My_Job' of queue 'default'
|
||||
Resque::dequeue('default', ['My_Job']);
|
||||
// Removes job class '\App\MyJobClass' of queue 'default'
|
||||
Resque::dequeue('default', ['\App\MyJobClass']);
|
||||
|
||||
// Removes job class 'My_Job' with Job ID '087df5819a790ac666c9608e2234b21e' of queue 'default'
|
||||
Resque::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']);
|
||||
// Removes job class '\App\MyJobClass' with Job ID '087df5819a790ac666c9608e2234b21e' of queue 'default'
|
||||
Resque::dequeue('default', ['\App\MyJobClass' => '087df5819a790ac666c9608e2234b21e']);
|
||||
|
||||
// Removes job class 'My_Job' with arguments of queue 'default'
|
||||
Resque::dequeue('default', ['My_Job' => ['foo' => 1, 'bar' => 2]]);
|
||||
// Removes job class '\App\MyJobClass' with arguments of queue 'default'
|
||||
Resque::dequeue('default', ['\App\MyJobClass' => ['foo' => 1, 'bar' => 2]]);
|
||||
|
||||
// Removes multiple jobs
|
||||
Resque::dequeue('default', ['My_Job', 'My_Job2']);
|
||||
Resque::dequeue('default', ['\App\MyJobClass', '\App\MyJobClass2']);
|
||||
```
|
||||
|
||||
If no jobs are given, this method will dequeue all jobs matching the provided queue.
|
||||
|
@ -160,7 +164,7 @@ To track the status of a job, pass `true` as the fourth argument to
|
|||
returned:
|
||||
|
||||
```php
|
||||
$token = Resque::enqueue('default', 'My_Job', $args, true);
|
||||
$token = Resque::enqueue('default', '\App\MyJobClass', $args, true);
|
||||
echo $token;
|
||||
```
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"psr/log": "^3.0.2",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"colinmollenhour/credis": "^1.14.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
74
composer.lock
generated
74
composer.lock
generated
|
@ -8,20 +8,20 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "colinmollenhour/credis",
|
||||
"version": "v1.16.1",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/colinmollenhour/credis.git",
|
||||
"reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95"
|
||||
"reference": "f4930b426f6b1238b687a1ffe6ee5af7f835b40a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/f11a89fd068d3e5db0c2b5a9ba8663bc36162e95",
|
||||
"reference": "f11a89fd068d3e5db0c2b5a9ba8663bc36162e95",
|
||||
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/f4930b426f6b1238b687a1ffe6ee5af7f835b40a",
|
||||
"reference": "f4930b426f6b1238b687a1ffe6ee5af7f835b40a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6.0"
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-redis": "Improved performance for communicating with redis"
|
||||
|
@ -49,9 +49,9 @@
|
|||
"homepage": "https://github.com/colinmollenhour/credis",
|
||||
"support": {
|
||||
"issues": "https://github.com/colinmollenhour/credis/issues",
|
||||
"source": "https://github.com/colinmollenhour/credis/tree/v1.16.1"
|
||||
"source": "https://github.com/colinmollenhour/credis/tree/v1.17.0"
|
||||
},
|
||||
"time": "2024-07-04T15:08:03+00:00"
|
||||
"time": "2025-02-10T18:58:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
|
@ -255,16 +255,16 @@
|
|||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.12.1",
|
||||
"version": "1.13.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
|
||||
"reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
|
||||
"reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c",
|
||||
"reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -303,7 +303,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -311,20 +311,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-08T17:47:46+00:00"
|
||||
"time": "2025-04-29T12:36:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v5.3.1",
|
||||
"version": "v5.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
|
||||
"reference": "ae59794362fe85e051a58ad36b289443f57be7a9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ae59794362fe85e051a58ad36b289443f57be7a9",
|
||||
"reference": "ae59794362fe85e051a58ad36b289443f57be7a9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -367,9 +367,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.5.0"
|
||||
},
|
||||
"time": "2024-10-08T18:51:32+00:00"
|
||||
"time": "2025-05-31T08:24:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
|
@ -872,16 +872,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "9.6.22",
|
||||
"version": "9.6.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c"
|
||||
"reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
|
||||
"reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95",
|
||||
"reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -892,7 +892,7 @@
|
|||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.12.1",
|
||||
"myclabs/deep-copy": "^1.13.1",
|
||||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"php": ">=7.3",
|
||||
|
@ -955,7 +955,7 @@
|
|||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -966,12 +966,20 @@
|
|||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://liberapay.com/sebastianbergmann",
|
||||
"type": "liberapay"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/sebastianbergmann",
|
||||
"type": "thanks_dev"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-12-05T13:48:26+00:00"
|
||||
"time": "2025-05-02T06:40:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
|
@ -1938,16 +1946,16 @@
|
|||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.11.1",
|
||||
"version": "3.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
|
||||
"reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87"
|
||||
"reference": "65ff2489553b83b4597e89c3b8b721487011d186"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87",
|
||||
"reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/65ff2489553b83b4597e89c3b8b721487011d186",
|
||||
"reference": "65ff2489553b83b4597e89c3b8b721487011d186",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2012,9 +2020,13 @@
|
|||
{
|
||||
"url": "https://opencollective.com/php_codesniffer",
|
||||
"type": "open_collective"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/phpcsstandards",
|
||||
"type": "thanks_dev"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-16T12:02:36+00:00"
|
||||
"time": "2025-05-11T03:36:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
|
|
|
@ -22,6 +22,7 @@ class Event
|
|||
*
|
||||
* @param string $event Name of event to be raised.
|
||||
* @param mixed $data Optional, any data that should be passed to each callback.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public static function trigger($event, $data = null)
|
||||
|
@ -49,7 +50,8 @@ class Event
|
|||
* Listen in on a given event to have a specified callback fired.
|
||||
*
|
||||
* @param string $event Name of event to listen on.
|
||||
* @param mixed $callback Any callback callable by call_user_func_array.
|
||||
* @param mixed $callback Any callback callable by call_user_func_array
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public static function listen($event, $callback)
|
||||
|
@ -67,6 +69,7 @@ class Event
|
|||
*
|
||||
* @param string $event Name of event.
|
||||
* @param mixed $callback The callback as defined when listen() was called.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public static function stopListening($event, $callback)
|
||||
|
@ -85,8 +88,10 @@ class Event
|
|||
|
||||
/**
|
||||
* Call all registered listeners.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function clearListeners()
|
||||
public static function clearListeners(): void
|
||||
{
|
||||
self::$events = [];
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Resque\Job;
|
|||
* @author Daniel Mason <daniel@m2.nz>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
class Factory implements FactoryInterface
|
||||
{
|
||||
public ?Job $job;
|
||||
|
@ -16,6 +17,8 @@ class Factory implements FactoryInterface
|
|||
public array $args;
|
||||
|
||||
/**
|
||||
* Create job factory
|
||||
*
|
||||
* @param $className
|
||||
* @param array $args
|
||||
* @param $queue
|
||||
|
|
|
@ -97,17 +97,6 @@ class Redis
|
|||
'rename',
|
||||
'rpoplpush'
|
||||
];
|
||||
// sinterstore
|
||||
// sunion
|
||||
// sunionstore
|
||||
// sdiff
|
||||
// sdiffstore
|
||||
// sinter
|
||||
// smove
|
||||
// mget
|
||||
// msetnx
|
||||
// mset
|
||||
// renamenx
|
||||
|
||||
/**
|
||||
* Set Redis namespace (prefix) default: resque
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Resque;
|
|||
|
||||
class Resque
|
||||
{
|
||||
public const VERSION = '2.3.0';
|
||||
public const VERSION = '2.5.1';
|
||||
|
||||
public const DEFAULT_INTERVAL = 5;
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ class Worker
|
|||
foreach ($workers as $workerId) {
|
||||
$instances[] = self::find($workerId);
|
||||
}
|
||||
|
||||
return $instances;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue