本文整理汇总了PHP中Batches::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Batches::clear方法的具体用法?PHP Batches::clear怎么用?PHP Batches::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Batches
的用法示例。
在下文中一共展示了Batches::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: step3
function step3()
{
$db = Convert::getSourceDB('mod_wiki_images');
$batch = new Batches('convert_wiki_images');
$total = $db->count();
if ($total < 1) {
$batch->clear();
Convert::addConvert('wiki');
return dgettext('wiki', 'No wiki images to convert. Module conversion complete!');
}
$batch->setTotalItems($total);
$batch->setBatchSet(5);
if (isset($_REQUEST['reset_batch'])) {
$batch->clear();
}
$content[] = dgettext('wiki', 'Converting wiki images...');
if (!$batch->load()) {
$content[] = dgettext('wiki', 'Batch previously run.');
} else {
$result = runBatch($db, $batch);
if (is_array($result)) {
$content[] = dgettext('wiki', 'Some errors occurred when trying to convert the following images:');
$content[] = '<ul><li>' . implode('</li><li>', $result) . '</li></ul>';
return implode('<br />', $content);
}
}
$percent = $batch->percentDone();
$content[] = Convert::getGraph($percent);
$batch->completeBatch();
if (!$batch->isFinished()) {
Convert::forward($batch->getAddress());
} else {
$batch->clear();
Convert::addConvert('wiki');
$content[] = dgettext('wiki', 'Module conversion complete!');
$content[] = '<a href="index.php">' . dgettext('wiki', 'Go back to main menu.') . '</a>';
}
return implode('<br />', $content);
}