[1925] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
| 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
| 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
[3730] | 12 | if (!defined('DC_RC_PATH')) {return;} |
---|
[1925] | 13 | |
---|
| 14 | class dcMaintenanceIndexcomments extends dcMaintenanceTask |
---|
| 15 | { |
---|
[3730] | 16 | protected $ajax = true; |
---|
| 17 | protected $group = 'index'; |
---|
| 18 | protected $limit = 500; |
---|
| 19 | protected $step_task; |
---|
[1925] | 20 | |
---|
[3730] | 21 | protected function init() |
---|
| 22 | { |
---|
| 23 | $this->name = __('Search engine index'); |
---|
| 24 | $this->task = __('Index all comments for search engine'); |
---|
| 25 | $this->step_task = __('Next'); |
---|
| 26 | $this->step = __('Indexing comment %d to %d.'); |
---|
| 27 | $this->success = __('Comments index done.'); |
---|
| 28 | $this->error = __('Failed to index comments.'); |
---|
[2044] | 29 | |
---|
[3730] | 30 | $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.'); |
---|
| 31 | } |
---|
[1925] | 32 | |
---|
[3730] | 33 | public function execute() |
---|
| 34 | { |
---|
| 35 | $this->code = $this->core->indexAllComments($this->code, $this->limit); |
---|
[2566] | 36 | |
---|
[3730] | 37 | return $this->code ?: true; |
---|
| 38 | } |
---|
[1925] | 39 | |
---|
[3730] | 40 | public function task() |
---|
| 41 | { |
---|
| 42 | return $this->code ? $this->step_task : $this->task; |
---|
| 43 | } |
---|
[1925] | 44 | |
---|
[3730] | 45 | public function step() |
---|
| 46 | { |
---|
| 47 | return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null; |
---|
| 48 | } |
---|
[1925] | 49 | |
---|
[3730] | 50 | public function success() |
---|
| 51 | { |
---|
| 52 | return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success; |
---|
| 53 | } |
---|
[1925] | 54 | } |
---|