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 ----------------------------------------- |
---|
12 | if (!defined('DC_RC_PATH')) { return; } |
---|
13 | |
---|
14 | class dcMaintenanceVacuum extends dcMaintenanceTask |
---|
15 | { |
---|
16 | protected $group = 'optimize'; |
---|
17 | |
---|
18 | protected function init() |
---|
19 | { |
---|
20 | $this->name = __('Optimise database'); |
---|
21 | $this->task = __('optimize tables'); |
---|
22 | $this->success = __('Optimization successful.'); |
---|
23 | $this->error = __('Failed to optimize tables.'); |
---|
24 | |
---|
25 | $this->description = __("After numerous delete or update operations on Dotclear's database, it gets fragmented. Optimizing will allow to defragment it. It has no incidence on your data's integrity. It is recommended to optimize before any blog export."); |
---|
26 | } |
---|
27 | |
---|
28 | public function execute() |
---|
29 | { |
---|
30 | $schema = dbSchema::init($this->core->con); |
---|
31 | |
---|
32 | foreach ($schema->getTables() as $table) |
---|
33 | { |
---|
34 | if (strpos($table, $this->core->prefix) === 0) { |
---|
35 | $this->core->con->vacuum($table); |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | return true; |
---|
40 | } |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.