'fsi-preview-dirs', 'label' => __( 'Abandoned AI preview files', 'templately' ), 'group' => 'imports', 'scope' => 'files', 'retention_kind' => 'age', 'destructive' => true, 'schedulable' => true, ]; } /** * @param string $entry A process id. * @param int $threshold Unix time before which a record is expired. * @param array $known Unused here — ownership is a PROCESS record, not a * session one, and those are read individually. */ protected function is_reclaimable( string $entry, int $threshold, array $known = [] ): bool { $process = AIUtils::read_process( $entry ); if ( ! is_array( $process ) || empty( $process ) ) { // No record owns this directory. return true; } $updated_at = isset( $process['_updated_at'] ) ? (int) $process['_updated_at'] : 0; if ( $updated_at >= $threshold && $updated_at > 0 ) { return false; } // A process whose session is still live must survive even if its own // row looks stale — the session is the thing actually running. if ( ! empty( $process['session_id'] ) && SessionData::is_active( (string) $process['session_id'], $threshold ) ) { return false; } return true; } }