Dotclear

source: plugins/maintenance/inc/tasks/class.dc.maintenance.indexposts.php @ 1959:2c77682177b4

Revision 1959:2c77682177b4, 1.3 KB checked in by Denis Jean-Chirstian <contact@…>, 12 years ago (diff)

Plugin maintenance, small fixes and boss requests, addresses #999

Line 
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 -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14class dcMaintenanceIndexposts extends dcMaintenanceTask
15{
16     protected $ajax = true;
17     protected $group = 'index';
18     protected $limit = 500;
19     protected $step_task;
20
21     protected function init()
22     {
23          $this->name         = __('Search engine index');
24          $this->task         = __('Index all posts');
25          $this->step_task    = __('next');
26          $this->step         = __('Indexing entry %d to %d.');
27          $this->success           = __('Entries index done.');
28          $this->error        = __('Failed to index entries.');
29     }
30
31     public function execute()
32     {
33          $this->code = $this->core->indexAllPosts($this->code, $this->limit);
34
35          return $this->code ? $this->code : true;
36     }
37
38     public function task()
39     {
40          return $this->code ? $this->step_task : $this->task;
41     }
42
43     public function step()
44     {
45          return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : null;
46     }
47
48     public function success()
49     {
50          return $this->code ? sprintf($this->step, $this->code - $this->limit, $this->code) : $this->success;
51     }
52}
Note: See TracBrowser for help on using the repository browser.

Sites map