- Fixed #16160: Call to undefined function ezi18n()
[tinyz:tinyz.git] / kernel / setup / steps / ezstep_system_finetune.php
1 <?php
2 //
3 // Definition of eZStepSystemFinetune class
4 //
5 // Created on: <08-Aug-2003 16:46:32 kk>
6 //
7 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
8 // SOFTWARE NAME: eZ Publish
9 // SOFTWARE RELEASE: 4.1.x
10 // COPYRIGHT NOTICE: Copyright (C) 1999-2010 eZ Systems AS
11 // SOFTWARE LICENSE: GNU General Public License v2.0
12 // NOTICE: >
13 //   This program is free software; you can redistribute it and/or
14 //   modify it under the terms of version 2.0  of the GNU General
15 //   Public License as published by the Free Software Foundation.
16 //
17 //   This program is distributed in the hope that it will be useful,
18 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 //   GNU General Public License for more details.
21 //
22 //   You should have received a copy of version 2.0 of the GNU General
23 //   Public License along with this program; if not, write to the Free
24 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 //   MA 02110-1301, USA.
26 //
27 //
28 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
29 //
30
31 /*! \file
32 */
33
34
35 /*!
36   \class eZStepSystemCheck ezstep_system_check.php
37   \brief The class eZStepSystemCheck does
38
39 */
40
41 class eZStepSystemFinetune extends eZStepInstaller
42 {
43     /*!
44      Constructor
45     */
46     function eZStepSystemFinetune( $tpl, $http, $ini, &$persistenceList )
47     {
48         $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList,
49                                 'system_finetune', 'System finetune' );
50     }
51
52     function processPostData()
53     {
54         if ( $this->Http->hasPostVariable( 'eZSetup_finetune_button' ) )
55         {
56             $this->PersistenceList['run_finetune'] = true;
57             return false;
58         }
59         $this->PersistenceList['run_finetune'] = false;
60         return true;
61     }
62
63     function init()
64     {
65         if ( !isset( $this->PersistenceList['run_finetune'] ) )
66             $this->PersistenceList['run_finetune'] = false;
67         if ( $this->PersistenceList['run_finetune'] )
68         {
69             $criticalTests = eZSetupCriticalTests();
70             $optionalTests = eZSetupOptionalTests();
71             $testTable = eZSetupTestTable();
72
73             $runResult = eZSetupRunTests( $criticalTests, 'eZSetup:init:system_check', $this->PersistenceList );
74             $optionalRunResult = eZSetupRunTests( $optionalTests, 'eZSetup:init:system_check', $this->PersistenceList );
75             $this->Results = $runResult['results'];
76             $this->Result = $runResult['result'];
77             $this->OptionalResults = $optionalRunResult['results'];
78             $this->OptionalResult = $optionalRunResult['result'];
79             $persistenceData = $runResult['persistence_list'];
80
81             $testsRun = array();
82             foreach ( $this->Results as $testResultItem )
83             {
84                 $testsRun[$testResultItem[1]] = $testResultItem[0];
85             }
86
87             eZSetupMergePersistenceList( $this->PersistenceList, $persistenceData );
88
89             $this->PersistenceList['tests_run'] = $testsRun;
90             $this->PersistenceList['optional_tests_run'] = $testsRun;
91
92             return ( $this->OptionalResult == EZ_SETUP_TEST_SUCCESS );
93         }
94         return true;
95     }
96
97     function display()
98     {
99         $this->Tpl->setVariable( 'test', array( 'result' => $this->OptionalResult,
100                                                          'results' => $this->OptionalResults ) );
101         $this->Tpl->setVariable( 'persistence_data', $this->PersistenceList );
102         $result = array();
103         // Display template
104         $result['content'] = $this->Tpl->fetch( "design:setup/init/system_finetune.tpl" );
105         $result['path'] = array( array( 'text' => ezpI18n::translate( 'design/standard/setup/init',
106                                                           'System finetuning' ),
107                                         'url' => false ) );
108         return $result;
109     }
110
111     function showMessage()
112     {
113         return false;
114     }
115
116     // Variables for storing results from tests
117     public $Result = null;
118     public $Results = null;
119 }
120
121 ?>