CleanUp extends Command
Signature: lneuro:cleanup
Provides cleanup operations for old or unwanted NetworkHistory entries. Optionally consolidate corporations by namespace using --consolidate. Optionally prune entire projects if they are resolved using --prune, or even unresolved projects if --force is specified. Use --dry-run to simulate and --stat to display record counts and storage usage.
Table of Contents
Properties
- $description : mixed
- $signature : mixed
Methods
- handle() : mixed
- batchOutput() : mixed
- consolidateCorporations() : mixed
- consolidateGroup() : void
- Consolidates a group of corporations by reassigning related projects to the target corporation and deleting the extra corporations.
- formatBytes() : string
- Format bytes into a human-readable string.
- getTableStats() : array<string|int, mixed>|null
- Retrieve table statistics (row count and total size) for supported database drivers.
- loadAdditionalStyles() : mixed
- selectCorporation() : NetworkCorporation|null
- showStats() : array<string|int, mixed>
- Display statistics on matching records and estimated storage sizes.
- startInteractiveSession() : array<string|int, mixed>
Properties
$description
protected
mixed
$description
= 'Remove old or unwanted NetworkHistory entries. Optionally consolidate corporations by namespace using --consolidate. Optionally prune entire projects if they are resolved using --prune, or even unresolved projects if --force is specified. Use --dry-run to simulate and --stat to display record counts and storage usage.'
$signature
protected
mixed
$signature
= 'lneuro:cleanup
{--i|interactive : Present interactive command interface to set values and flags.}
{--mode=all : Can be set to "consolidateOnly" to skip the history cleanup and only consolidate [the] Corporation[s]. Not available in interactive.}
{--d|daysOld=30 : Set cutoff date (in days) for history deletion.}
{--c|corporation=0 : Select a corporation to apply cleanup to (ID). 0 => all.}
{--C|consolidate : Consolidates in --corporation specified Corporation(s) by namespace.}
{--p|prune : Delete related NetworkProject, NetworkState, and NetworkDataSet records.}
{--f|force : Delete records even when Project has no definite resolution.}
{--t|dry-run : Perform a dry run (no deletions).}
{--s|stat : Show statistics of matching records instead of performing deletion.}'
Methods
handle()
public
handle() : mixed
batchOutput()
private
batchOutput(array<string|int, mixed> $output) : mixed
Parameters
- $output : array<string|int, mixed>
consolidateCorporations()
private
consolidateCorporations() : mixed
consolidateGroup()
Consolidates a group of corporations by reassigning related projects to the target corporation and deleting the extra corporations.
private
consolidateGroup(NetworkCorporation $target, Collection $others) : void
Parameters
- $target : NetworkCorporation
-
The principal corporation to keep.
- $others : Collection
-
The collection of extra corporations to consolidate.
formatBytes()
Format bytes into a human-readable string.
private
formatBytes(int $bytes[, int $precision = 2 ]) : string
Parameters
- $bytes : int
- $precision : int = 2
Return values
stringgetTableStats()
Retrieve table statistics (row count and total size) for supported database drivers.
private
getTableStats(string $tableName) : array<string|int, mixed>|null
Parameters
- $tableName : string
Return values
array<string|int, mixed>|null —['rows' => int, 'size' => int] or null if the driver is unsupported.
loadAdditionalStyles()
private
loadAdditionalStyles() : mixed
selectCorporation()
private
selectCorporation() : NetworkCorporation|null
Return values
NetworkCorporation|nullshowStats()
Display statistics on matching records and estimated storage sizes.
private
showStats(Carbon $cutoffDate, NetworkCorporation|null $corporation, bool $force) : array<string|int, mixed>
Parameters
- $cutoffDate : Carbon
- $corporation : NetworkCorporation|null
- $force : bool
Return values
array<string|int, mixed>startInteractiveSession()
private
startInteractiveSession() : array<string|int, mixed>