HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/Framework/Migrations/Contracts/BatchMigration.php
<?php

namespace Give\Framework\Migrations\Contracts;

/**
 * Extend this class when you need database migration to run in batches.
 *
 * @since 4.0.0
 */
abstract class BatchMigration extends BaseMigration
{
    /**
     * Get the number of items per batch
     *
     * @since 4.0.0
     */
    abstract public function getBatchSize(): int;

    /**
     *
     * Get the total items count
     *
     * @since 4.0.0
     */
    abstract public function getItemsCount(): int;


    /**
     *
     * Get the first and the last item ID for a batch
     *
     * @since 4.0.0
     *
     * @return array{0: int, 1: int} the first value is the first id and the second value is the last id of a batch
     */
    abstract public function getBatchItemsAfter($lastId): ?array;

    /**
     * Run batch
     *
     * @param $firstId - first item ID in batch
     * @param $lastId  - last item ID in batch
     *
     * @since 4.0.0
     */
    abstract public function runBatch($firstId, $lastId);

    /**
     * Last step of the migration process
     *
     * The purpose of this method is to check if we have new items that came during the migration.
     *
     * @since 4.0.0
     *
     * @param $lastProcessedId
     *
     * @return bool - true if there are new items, otherwise false
     */
    abstract public function hasMoreItemsToBatch($lastProcessedId): ?bool;
}