<?php
/**
* @brief maintenance, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugins
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
if (!defined('DC_RC_PATH')) {
return;
}
class dcMaintenanceIndexposts extends dcMaintenanceTask
{
protected $ajax = true;
protected $group = 'index';
protected $limit = 500;
protected $step_task;
protected function init()
{
$this->name = __('Search engine index');
$this->task = __('Index all entries for search engine');
$this->step_task = __('Next');
$this->step = __('Indexing entry %d to %d.');
$this->success = __('Entries index done.');
$this->error = __('Failed to index entries.');
$this->description = __('Index all entries in search engine index. This operation is necessary, after importing content in your blog, to use internal search engine, on public and private pages.');
}
public function execute()
{
$this->code = $this->core->indexAllPosts($this->code, $this->limit);
return $this->code ?: true;
}
public function task()
{
return $this->code ? $this->step_task : $this->task;
}
public function step()
{
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null;
}
public function success()
{
return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success;
}
}