Dotclear

source: plugins/maintenance/inc/tasks/class.dc.maintenance.vacuum.php @ 3730:5c45a5df9a59

Revision 3730:5c45a5df9a59, 1.3 KB checked in by franck <carnet.franck.paul@…>, 8 years ago (diff)

Code formatting (PSR-2)

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 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            if (strpos($table, $this->core->prefix) === 0) {
34                $this->core->con->vacuum($table);
35            }
36        }
37
38        return true;
39    }
40}
Note: See TracBrowser for help on using the repository browser.

Sites map