| Revision 1925:567a4a03e5df,
1.3 KB
checked in by Denis Jean-Chirstian <contact@…>, 12 years ago
(diff) |
|
Revamp plugin maintenance, step 1, rewrite code to open it, addresses #999
|
| Rev | Line | |
|---|
| [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 ----------------------------------------- |
|---|
| 12 | if (!defined('DC_RC_PATH')) { return; } |
|---|
| 13 | |
|---|
| 14 | class dcMaintenanceIndexposts extends dcMaintenanceTask |
|---|
| 15 | { |
|---|
| 16 | protected $group = 'index'; |
|---|
| 17 | protected $limit = 500; |
|---|
| 18 | protected $step_task; |
|---|
| 19 | |
|---|
| 20 | protected function init() |
|---|
| 21 | { |
|---|
| 22 | $this->name = __('Search engine index'); |
|---|
| 23 | $this->task = __('Index all posts'); |
|---|
| 24 | $this->step_task = __('next'); |
|---|
| 25 | $this->step = __('Indexing entry %d to %d.'); |
|---|
| 26 | $this->success = __('Entries index done.'); |
|---|
| 27 | $this->error = __('Failed to index entries.'); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | public function execute() |
|---|
| 31 | { |
|---|
| 32 | $this->code = $this->core->indexAllPosts($this->code, $this->limit); |
|---|
| 33 | |
|---|
| 34 | return $this->code ? $this->code : true; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | public function task() |
|---|
| 38 | { |
|---|
| 39 | return $this->code ? $this->step_task : $this->task; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | public function step() |
|---|
| 43 | { |
|---|
| 44 | return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | public function success() |
|---|
| 48 | { |
|---|
| 49 | return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success; |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.