<?php $step = 10; $offset = isset($_SESSION['galgenoffset']) && $_SESSION['galgenoffset'] ? $_SESSION['galgenoffset'] : 0; $modx->setLogLevel(MODX_LOG_LEVEL_ERROR); $q = $modx->newQuery('modResource', array('parent' => 6007)); $total = $modx->getCount("modResource", $q); $q->limit($step,$offset); foreach($modx->getIterator("modResource", $q) as $doc){ $doc->remove(); } $_SESSION['galgenoffset'] = $offset + $step; if ($_SESSION['galgenoffset'] >= $total) { $sucsess = 100; $_SESSION['Console']['completed'] = true; unset($_SESSION['galgenoffset']); } else { $sucsess = round($_SESSION['galgenoffset'] / $total, 2) * 100; $_SESSION['Console']['completed'] = false; } for ($i=0; $i<=100; $i++) { if ($i <= $sucsess) { print '='; } else { print '_'; } } $current = $_SESSION['galgenoffset'] ? $_SESSION['galgenoffset'] : ($sucsess == 100 ? $total : 0); print "\n"; print $sucsess.'% ('.$current.')'."\n\n";