PHP Class Plank\Mediable\Commands\ImportMediaCommand

Author: Sean Fraser ([email protected])
Inheritance: extends Illuminate\Console\Command
Show file Open project: plank/laravel-mediable

Protected Properties

Property Type Description
$counters array Various counters of files being modified.
$description string
$filesystem Illuminate\Filesystem\FilesystemManager Filesystem Manager instance.
$signature string
$uploader Plank\Mediable\MediaUploader Uploader instance.

Public Methods

Method Description
__construct ( FileSystemManager $filesystem, MediaUploader $uploader ) Constructor.
handle ( ) : void Execute the console command.

Protected Methods

Method Description
createRecordForFile ( string $disk, string $path ) : void Generate a new media record.
getRecordForFile ( string $path, Illuminate\Database\Eloquent\Collection $existing_media ) : Media | null Search through the record list for one matching the provided path.
listFiles ( atring $disk, string $directory = '', boolean $recursive = true ) : array Generate a list of all files in the specified directory.
outputCounters ( boolean $force ) : void Send the counter total to the console.
resetCounters ( ) : void Reset the counters of processed files.
updateRecordForFile ( Media $media, string $path ) : void Update an existing media record.

Method Details

__construct() public method

Constructor.
public __construct ( FileSystemManager $filesystem, MediaUploader $uploader )
$filesystem FileSystemManager
$uploader Plank\Mediable\MediaUploader

createRecordForFile() protected method

Generate a new media record.
protected createRecordForFile ( string $disk, string $path ) : void
$disk string
$path string
return void

getRecordForFile() protected method

Search through the record list for one matching the provided path.
protected getRecordForFile ( string $path, Illuminate\Database\Eloquent\Collection $existing_media ) : Media | null
$path string
$existing_media Illuminate\Database\Eloquent\Collection
return Plank\Mediable\Media | null

handle() public method

Execute the console command.
public handle ( ) : void
return void

listFiles() protected method

Generate a list of all files in the specified directory.
protected listFiles ( atring $disk, string $directory = '', boolean $recursive = true ) : array
$disk atring
$directory string
$recursive boolean
return array

outputCounters() protected method

Send the counter total to the console.
protected outputCounters ( boolean $force ) : void
$force boolean
return void

resetCounters() protected method

Reset the counters of processed files.
protected resetCounters ( ) : void
return void

updateRecordForFile() protected method

Update an existing media record.
protected updateRecordForFile ( Media $media, string $path ) : void
$media Plank\Mediable\Media
$path string
return void

Property Details

$counters protected property

Various counters of files being modified.
protected array $counters
return array

$description protected property

protected string $description
return string

$filesystem protected property

Filesystem Manager instance.
protected FilesystemManager,Illuminate\Filesystem $filesystem
return Illuminate\Filesystem\FilesystemManager

$signature protected property

protected string $signature
return string

$uploader protected property

Uploader instance.
protected MediaUploader,Plank\Mediable $uploader
return Plank\Mediable\MediaUploader