Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F8198189
SharedFolderJob.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SharedFolderJob.php
View Options
<?php
namespace
App\Jobs
;
/**
* The abstract \App\Jobs\SharedFolderJob implements the logic needed for all dispatchable Jobs related to
* \App\SharedFolder objects.
*
* ```php
* $job = new \App\Jobs\SharedFolder\CreateJob($folderId);
* $job->handle();
* ```
*/
abstract
class
SharedFolderJob
extends
CommonJob
{
/**
* The ID for the \App\SharedFolder. This is the shortest globally unique identifier and saves Redis space
* compared to a serialized version of the complete \App\SharedFolder object.
*
* @var int
*/
protected
$folderId
;
/**
* The \App\SharedFolder email property, for legibility in the queue management.
*
* @var string
*/
protected
$folderEmail
;
/**
* Create a new job instance.
*
* @param int $folderId The ID for the shared folder to process.
*
* @return void
*/
public
function
__construct
(
int
$folderId
)
{
$this
->
folderId
=
$folderId
;
$folder
=
$this
->
getSharedFolder
();
if
(
$folder
)
{
$this
->
folderEmail
=
$folder
->
email
;
}
}
/**
* Get the \App\SharedFolder entry associated with this job.
*
* @return \App\SharedFolder|null
*
* @throws \Exception
*/
protected
function
getSharedFolder
()
{
$folder
=
\App\SharedFolder
::
withTrashed
()->
find
(
$this
->
folderId
);
if
(!
$folder
)
{
// The record might not exist yet in case of a db replication environment
// This will release the job and delay another attempt for 5 seconds
if
(
$this
instanceof
SharedFolder\CreateJob
)
{
$this
->
release
(
5
);
return
null
;
}
$this
->
fail
(
new
\Exception
(
"Shared folder {$this->folderId} could not be found in the database."
));
}
return
$folder
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jul 8, 6:26 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1051172
Default Alt Text
SharedFolderJob.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment