<?php

if (!empty($_SERVER['DOCUMENT_ROOT'])) {
    die("Access denied");
}

define('CRON_TASKS_BASE_PATH', __DIR__);
define('WP_USE_THEMES', false);
require(CRON_TASKS_BASE_PATH . '/../../../../wp-load.php');

use auctionforge\inc\ImageUploader;

if (!is_plugin_active(basename(dirname(__DIR__)) . '/' . basename(dirname(__DIR__)) . '.php')) {
    die("Plugin AuctionForge disabled");
}

$limit = 100;
$i = 0;
while ($lots = get_posts(
    array(
        'post_type' => 'lot',
        'numberposts' => $limit,
        'post_status' => array('draft', 'trash'),
        'offset' => $limit * $i,
        'lang' => '',
        /*'tax_query' => array(
            array(
                'taxonomy' => 'auction_number',
                'field' => 'id',
                'terms' => array()
            )
        ),*/
    )
)) {
    /** @var WP_Post $lot */
    foreach ($lots as $lot) {
        $res = wp_delete_post($lot->ID, true);
        var_dump($res->ID);
    }
    $i++;
}
