Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Queue\Jobs;
4
 
5
use Illuminate\Container\Container;
6
use Illuminate\Contracts\Queue\Job as JobContract;
7
use Illuminate\Queue\DatabaseQueue;
8
 
9
class DatabaseJob extends Job implements JobContract
10
{
11
    /**
12
     * The database queue instance.
13
     *
14
     * @var \Illuminate\Queue\DatabaseQueue
15
     */
16
    protected $database;
17
 
18
    /**
19
     * The database job payload.
20
     *
21
     * @var \stdClass
22
     */
23
    protected $job;
24
 
25
    /**
26
     * Create a new job instance.
27
     *
28
     * @param  \Illuminate\Container\Container  $container
29
     * @param  \Illuminate\Queue\DatabaseQueue  $database
30
     * @param  \stdClass  $job
31
     * @param  string  $connectionName
32
     * @param  string  $queue
33
     * @return void
34
     */
35
    public function __construct(Container $container, DatabaseQueue $database, $job, $connectionName, $queue)
36
    {
37
        $this->job = $job;
38
        $this->queue = $queue;
39
        $this->database = $database;
40
        $this->container = $container;
41
        $this->connectionName = $connectionName;
42
    }
43
 
44
    /**
45
     * Release the job back into the queue after (n) seconds.
46
     *
47
     * @param  int  $delay
48
     * @return void
49
     */
50
    public function release($delay = 0)
51
    {
52
        parent::release($delay);
53
 
54
        $this->database->deleteAndRelease($this->queue, $this, $delay);
55
    }
56
 
57
    /**
58
     * Delete the job from the queue.
59
     *
60
     * @return void
61
     */
62
    public function delete()
63
    {
64
        parent::delete();
65
 
66
        $this->database->deleteReserved($this->queue, $this->job->id);
67
    }
68
 
69
    /**
70
     * Get the number of times the job has been attempted.
71
     *
72
     * @return int
73
     */
74
    public function attempts()
75
    {
76
        return (int) $this->job->attempts;
77
    }
78
 
79
    /**
80
     * Get the job identifier.
81
     *
82
     * @return string
83
     */
84
    public function getJobId()
85
    {
86
        return $this->job->id;
87
    }
88
 
89
    /**
90
     * Get the raw body string for the job.
91
     *
92
     * @return string
93
     */
94
    public function getRawBody()
95
    {
96
        return $this->job->payload;
97
    }
98
 
99
    /**
100
     * Get the database job record.
101
     *
102
     * @return \Illuminate\Queue\Jobs\DatabaseJobRecord
103
     */
104
    public function getJobRecord()
105
    {
106
        return $this->job;
107
    }
108
}