FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
craft-async-queue/src/BackgroundProcess.php at master · ClockworkNet/craft-async-queue · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ClockworkNet
/
craft-async-queue
Public
forked from
ostark/craft-async-queue
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
craft-async-queue
/
src
/
BackgroundProcess.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (47 loc) · 1.49 KB
Breadcrumbs
craft-async-queue
/
src
/
BackgroundProcess.php
Copy path
File metadata and controls
56 lines (47 loc) · 1.49 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace
ostark
\
AsyncQueue
;
use
ostark
\
AsyncQueue
\
Exceptions
\
LogicException
;
use
ostark
\
AsyncQueue
\
Exceptions
\
RuntimeException
;
use
Symfony
\
Component
\
Process
\
Process
;
class
BackgroundProcess
{
/**
* @var \ostark\AsyncQueue\QueueCommand
*/
protected
$
command
;
/**
* BackgroundProcess constructor.
*
* @param \ostark\AsyncQueue\QueueCommand|null $command
*/
public
function
__construct
(
QueueCommand
$
command
=
null
)
{
$
this
->
command
=
$
command
?:
new
QueueCommand
();
}
/**
* Runs craft queue/run in the background
*
* @return \Symfony\Component\Process\Process
*
* @throws \ostark\AsyncQueue\Exceptions\PhpExecutableNotFound
* @throws \ostark\AsyncQueue\Exceptions\RuntimeException
* @throws \ostark\AsyncQueue\Exceptions\LogicException
*/
public
function
start
()
{
$
cmd
=
$
this
->
command
->
getPreparedCommand
();
$
cwd
=
realpath
(
CRAFT_BASE_PATH
);
$
process
= Process::
fromShellCommandline
(
$
cmd
,
$
cwd
);
try
{
$
process
->
run
();
}
catch
(
\
Symfony
\
Component
\
Process
\
Exception
\
RuntimeException
$
e
) {
$
e
=
new
RuntimeException
(
$
e
->
getMessage
());
$
e
->
setProcess
(
$
process
);
throw
$
e
;
}
catch
(
\
Symfony
\
Component
\
Process
\
Exception
\
LogicException
$
e
) {
$
e
=
new
LogicException
(
$
e
->
getMessage
());
$
e
->
setProcess
(
$
process
);
throw
$
e
;
}
return
$
process
;
}
}
Back
|
FazBrowse Home
|
New Git URL