Fix newfilename calculation

This commit is contained in:
Deon George 2020-01-05 09:37:50 +11:00
parent 1ffc2d994e
commit 9c0a02c425
4 changed files with 26 additions and 10 deletions

View File

@ -14,16 +14,16 @@ class PhotoMove extends Job implements ShouldQueue
{ {
use InteractsWithQueue,SerializesModels; use InteractsWithQueue,SerializesModels;
private $photo; public $photo;
/** /**
* Create a new job instance. * Create a new job instance.
* *
* @return void * @return void
*/ */
public function __construct(Photo $photo) public function __construct(Photo $o)
{ {
$this->photo = $photo; $this->photo = $o;
} }
/** /**

View File

@ -14,16 +14,16 @@ class VideoMove extends Job implements ShouldQueue
{ {
use InteractsWithQueue,SerializesModels; use InteractsWithQueue,SerializesModels;
private $video; public $video;
/** /**
* Create a new job instance. * Create a new job instance.
* *
* @return void * @return void
*/ */
public function __construct(Video $video) public function __construct(Video $o)
{ {
$this->video = $video; $this->video = $o;
} }
/** /**

View File

@ -15,6 +15,10 @@ abstract class Catalog extends Model
protected static $includeSubSecTime = FALSE; protected static $includeSubSecTime = FALSE;
protected $dates = ['created']; protected $dates = ['created'];
protected $casts = [
'subsectime' => 'int',
];
/** /**
* People in Multimedia Object * People in Multimedia Object
* *
@ -220,10 +224,10 @@ abstract class Catalog extends Model
// If the date created is not set, the file name will be based on the ID of the file. // If the date created is not set, the file name will be based on the ID of the file.
$file = sprintf('%s.%s',(is_null($this->created) $file = sprintf('%s.%s',(is_null($this->created)
? sprintf('UNKNOWN/%07s',$this->file_path_id()) ? sprintf('UNKNOWN/%07s',$this->file_path_id())
: $this->created->format('Y/m/d-His').((! is_null($this->subsectime)) ? sprintf('.%03d',$this->subsectime) : '' ). : $this->created->format('Y/m/d-His').
((! static::$includeSubSecTime OR ! is_null($this->subsectime)) ? '' : sprintf('-%05s',$this->id)). ((! is_null($this->subsectime)) ? sprintf('_%03d',$this->subsectime) : '' ).
($this->ignore_duplicate ? sprintf('-%06d',$this->id) : '') sprintf('-%05s',$this->id))
),$this->type() ,$this->type()
); );
return (($short OR preg_match('/^\//',$file)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$file; return (($short OR preg_match('/^\//',$file)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$file;

12
app/Models/Jobs.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Jobs extends Model
{
protected $casts = [
'payload' => 'array',
];
}