55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?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 dcMaintenanceIndexcomments 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 comments for search engine');
|
|
$this->step_task = __('Next');
|
|
$this->step = __('Indexing comment %d to %d.');
|
|
$this->success = __('Comments index done.');
|
|
$this->error = __('Failed to index comments.');
|
|
|
|
$this->description = __('Index all comments and trackbacks 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->indexAllComments($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;
|
|
}
|
|
}
|