Commit 537aa2a4e4c8c734a4e2e966361de0e62eee121b

Authored by Jarrett Jordaan
1 parent 762864d3

Story Id:1166880 Server Testing Updates

Committed by: Jarrett Jordaan

Reviewed by: Paul Barrett
setup/migrate/migrateUtil.php
... ... @@ -98,7 +98,7 @@ class MigrateUtil {
98 98 }
99 99  
100 100  
101   - function getInstallerServices() {
  101 + function getInstallServices() {
102 102 require_once("../wizard/installUtil.php");
103 103 require_once("../wizard/steps/services.php");
104 104  
... ...
setup/migrate/steps/complete.php deleted
1   -<?php
2   -/**
3   -* Complete Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -
43   -class complete extends Step {
44   -
45   - /**
46   - * Reference to Database object
47   - *
48   - * @author KnowledgeTree Team
49   - * @access private
50   - * @var object
51   - */
52   - private $_dbhandler = null;
53   -
54   - /**
55   - * List of services to check
56   - *
57   - * @access private
58   - * @var array
59   - */
60   - private $services_check = 'tick';
61   - private $paths_check = 'tick';
62   - private $privileges_check = 'tick';
63   - private $database_check = 'tick';
64   - protected $silent = true;
65   -
66   - protected $util = null;
67   -
68   - public function __construct() {
69   - $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
70   - $this->_dbhandler = new dbUtil();
71   - $this->util = new MigrateUtil();
72   - }
73   -
74   - function doStep() {
75   - $this->doRun();
76   - return 'landing';
77   - }
78   -
79   - function doRun() {
80   - $this->checkServices();
81   - $this->storeSilent();// Set silent mode variables
82   - }
83   -
84   - private function checkServices()
85   - {
86   - $services = new services();
87   - foreach ($services->getServices() as $serviceName) {
88   - $this->temp_variables[$serviceName."Status"] = 'tick';
89   - }
90   - return true;
91   - }
92   -
93   - /**
94   - * Set all silent mode varibles
95   - *
96   - */
97   - private function storeSilent() {
98   - $this->temp_variables['services_check'] = $this->services_check;
99   - }
100   -}
101   -?>
102 0 \ No newline at end of file
setup/migrate/steps/database.php deleted
1   -<?php
2   -/**
3   -* Database Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -
43   -class database extends Step
44   -{
45   - /**
46   - * Reference to Database object
47   - *
48   - * @author KnowledgeTree Team
49   - * @access public
50   - * @var object
51   - */
52   - public $_dbhandler = null;
53   -
54   - /**
55   - * Reference to Database object
56   - *
57   - * @author KnowledgeTree Team
58   - * @access public
59   - * @var object
60   - */
61   - public $_util = null;
62   -
63   - /**
64   - * Database type
65   - *
66   - * @author KnowledgeTree Team
67   - * @access private
68   - * @var array
69   - */
70   - private $dtype = '';
71   -
72   - /**
73   - * Database types
74   - *
75   - * @author KnowledgeTree Team
76   - * @access private
77   - * @var array
78   - */
79   - private $dtypes = array();
80   -
81   - /**
82   - * Database host
83   - *
84   - * @author KnowledgeTree Team
85   - * @access private
86   - * @var string
87   - */
88   - private $dhost = '';
89   -
90   - /**
91   - * Database port
92   - *
93   - * @author KnowledgeTree Team
94   - * @access private
95   - * @var string
96   - */
97   - private $dport = '';
98   -
99   - /**
100   - * Database name
101   - *
102   - * @author KnowledgeTree Team
103   - * @access private
104   - * @var string
105   - */
106   - private $dname = '';
107   -
108   - /**
109   - * Database root username
110   - *
111   - * @author KnowledgeTree Team
112   - * @access private
113   - * @var string
114   - */
115   - private $duname = '';
116   -
117   - /**
118   - * Database root password
119   - *
120   - * @author KnowledgeTree Team
121   - * @access private
122   - * @var string
123   - */
124   - private $dpassword = '';
125   -
126   - /**
127   - * Database dms username
128   - *
129   - * @author KnowledgeTree Team
130   - * @access private
131   - * @var string
132   - */
133   - private $dmsname = '';
134   -
135   - /**
136   - * Database dms password
137   - *
138   - * @author KnowledgeTree Team
139   - * @access private
140   - * @var string
141   - */
142   - private $dmspassword = '';
143   -
144   - /**
145   - * Default dms user username
146   - *
147   - * @author KnowledgeTree Team
148   - * @access private
149   - * @var boolean
150   - */
151   - private $dmsusername = '';
152   -
153   - /**
154   - * Default dms user password
155   - *
156   - * @author KnowledgeTree Team
157   - * @access private
158   - * @var boolean
159   - */
160   - private $dmsuserpassword = '';
161   -
162   - /**
163   - * Location of database binaries.
164   - *
165   - * @author KnowledgeTree Team
166   - * @access private
167   - * @var string
168   - */
169   - private $mysqlDir; // TODO:multiple databases
170   -
171   - /**
172   - * Name of database binary.
173   - *
174   - * @author KnowledgeTree Team
175   - * @access private
176   - * @var string
177   - */
178   - private $dbbinary = ''; // TODO:multiple databases
179   -
180   - /**
181   - * Database table prefix
182   - *
183   - * @author KnowledgeTree Team
184   - * @access private
185   - * @var string
186   - */
187   - private $tprefix = '';
188   -
189   - /**
190   - * Flag to drop database
191   - *
192   - * @author KnowledgeTree Team
193   - * @access private
194   - * @var boolean
195   - */
196   - private $ddrop = false;
197   -
198   - /**
199   - * List of errors encountered
200   - *
201   - * @author KnowledgeTree Team
202   - * @access public
203   - * @var array
204   - */
205   - public $error = array();
206   -
207   - /**
208   - * List of errors used in template
209   - *
210   - * @author KnowledgeTree Team
211   - * @access public
212   - * @var array
213   - */
214   - public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword');
215   -
216   - /**
217   - * Flag to store class information in session
218   - *
219   - * @author KnowledgeTree Team
220   - * @access public
221   - * @var array
222   - */
223   - public $storeInSession = true;
224   -
225   - /**
226   - * Flag if step needs to be migrated
227   - *
228   - * @author KnowledgeTree Team
229   - * @access public
230   - * @var array
231   - */
232   - protected $runMigrate = true;
233   -
234   - /**
235   - * Flag if step needs to run silently
236   - *
237   - * @author KnowledgeTree Team
238   - * @access public
239   - * @var array
240   - */
241   - protected $silent = true;
242   -
243   - /**
244   - * Constructs database object
245   - *
246   - * @author KnowledgeTree Team
247   - * @access public
248   - * @param none
249   - */
250   - public function __construct() {
251   - $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent);
252   - $this->_dbhandler = new dbUtil();
253   - $this->_util = new MigrateUtil();
254   - if(WINDOWS_OS)
255   - $this->mysqlDir = MYSQL_BIN;
256   - }
257   -
258   - /**
259   - * Main control of database setup
260   - *
261   - * @author KnowledgeTree Team
262   - * @param none
263   - * @access public
264   - * @return string
265   - */
266   - public function doStep() {
267   - $this->initErrors();
268   - $this->setDetails(); // Set any posted variables
269   - if(!$this->inStep("database")) {
270   - return 'landing';
271   - }
272   - if($this->next()) {
273   - return 'next';
274   - } else if($this->previous()) {
275   - return 'previous';
276   - }
277   -
278   - return 'landing';
279   - }
280   -
281   - /**
282   - * Store options
283   - *
284   - * @author KnowledgeTree Team
285   - * @params object SimpleXmlObject
286   - * @access private
287   - * @return void
288   - */
289   - private function setDetails() {
290   - $this->temp_variables['dhost'] = $this->getPostSafe('dhost');
291   - $this->temp_variables['dport'] = $this->getPostSafe('dport');
292   - $this->temp_variables['duname'] = $this->getPostSafe('duname');
293   - $this->temp_variables['dpassword'] = $this->getPostSafe('dpassword');
294   - $this->temp_variables['dbbinary'] = $this->getPostSafe('dbbinary');
295   - }
296   -
297   - /**
298   - * Safer way to return post data
299   - *
300   - * @author KnowledgeTree Team
301   - * @params SimpleXmlObject $simplexml
302   - * @access public
303   - * @return void
304   - */
305   - public function getPostSafe($key) {
306   - return isset($_POST[$key]) ? $_POST[$key] : "";
307   - }
308   -
309   - /**
310   - * Stores varibles used by template
311   - *
312   - * @author KnowledgeTree Team
313   - * @params none
314   - * @access public
315   - * @return array
316   - */
317   - public function getStepVars() {
318   - return $this->temp_variables;
319   - }
320   -
321   - /**
322   - * Returns database errors
323   - *
324   - * @author KnowledgeTree Team
325   - * @access public
326   - * @params none
327   - * @return array
328   - */
329   - public function getErrors() {
330   -
331   - return $this->error;
332   - }
333   -
334   - /**
335   - * Initialize errors to false
336   - *
337   - * @author KnowledgeTree Team
338   - * @param none
339   - * @access private
340   - * @return boolean
341   - */
342   - private function initErrors() {
343   - foreach ($this->templateErrors as $e) {
344   - $this->error[$e] = false;
345   - }
346   - }
347   -}
348   -?>
349 0 \ No newline at end of file
setup/migrate/steps/errors.php deleted
1   -<?php
2   -/**
3   -* Error Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -class Errors extends Step {
43   - public $error = array();
44   -
45   - function doStep() {
46   - return 'landing';
47   - }
48   -
49   - function getErrors() {
50   - return $this->error;
51   - }
52   -
53   - function getName() {
54   - return 'error';
55   - }
56   -}
57   -?>
58 0 \ No newline at end of file
setup/migrate/steps/installation.php deleted
1   -<?php
2   -/**
3   -* Migrate Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -
43   -class installation extends step
44   -{
45   - /**
46   - * Flag to display confirmation page first
47   - *
48   - * @author KnowledgeTree Team
49   - * @access public
50   - * @var array
51   - */
52   - public $displayFirst = false;
53   -
54   - /**
55   - * Flag to store class information in session
56   - *
57   - * @author KnowledgeTree Team
58   - * @access public
59   - * @var array
60   - */
61   - protected $storeInSession = true;
62   -
63   - /**
64   - * List of paths
65   - *
66   - * @author KnowledgeTree Team
67   - * @access public
68   - * @var array
69   - */
70   - protected $paths = array();
71   -
72   - /**
73   - * Flag if step needs to run silently
74   - *
75   - * @author KnowledgeTree Team
76   - * @access public
77   - * @var array
78   - */
79   - protected $silent = false;
80   -
81   - private $location = '';
82   - private $dbSettings = array();
83   - private $ktSettings = array();
84   - private $urlPaths = array();
85   -
86   - function __construct() {
87   - $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent);
88   - }
89   -
90   - public function doStep() {
91   - $this->detectInstallation();
92   - if(!$this->inStep("installation")) {
93   - $this->setDetails();
94   - $this->doRun();
95   - return 'landing';
96   - }
97   - if($this->next()) {
98   - if($this->doRun()) {
99   - $this->setDetails();
100   - return 'confirm';
101   - } else {
102   - return 'error';
103   - }
104   - } else if($this->previous()) {
105   - return 'previous';
106   - } else if($this->confirm()) {
107   - return 'next';
108   - }
109   - $this->doRun();
110   -
111   - return 'landing';
112   - }
113   -
114   - public function detectInstallation() {
115   - if(WINDOWS_OS) {
116   - $path1 = "'C:\\Program Files\ktdms'";
117   - $path2 = "'C:\\Program Files x86\ktdms'";
118   - if(file_exists($path1))
119   - $this->location = "C:\\Program Files\ktdms";
120   - elseif (file_exists($path2))
121   - $this->location = "C:\\Program Files x86\ktdms";
122   - } else {
123   - $path1 = "/opt/ktdms";
124   - $path2 = "/var/www/ktdms";
125   - if(file_exists($path1))
126   - $this->location = $path1;
127   - elseif(file_exists($path2))
128   - $this->location = $path2;
129   - }
130   - }
131   -
132   - public function doRun() {
133   - $ktInstallPath = isset($_POST['location']) ? $_POST['location']: '';
134   - if($ktInstallPath != '') {
135   - $this->location = $ktInstallPath;
136   - //echo $ktInstallPath;die;
137   - if(file_exists($ktInstallPath)) {
138   - $configPath = $ktInstallPath.DS."knowledgeTree".DS."config".DS."config-path";
139   - if(file_exists($configPath)) {
140   - $configFilePath = file_get_contents($configPath);
141   - if(file_exists($configFilePath)) {
142   - $this->readConfig($configFilePath);
143   - $this->storeSilent();
144   -
145   - return true;
146   - } else {
147   - $this->error[] = "KT installation configuration file empty";
148   - }
149   - } else {
150   - $this->error[] = "KT installation configuration file not found";
151   - }
152   - } else {
153   - $this->error[] = "KT installation not found";
154   - }
155   - }
156   - $this->storeSilent();
157   -
158   - return false;
159   - }
160   -
161   - private function readConfig($path) {
162   - $ini = new Ini($path);
163   - $dbSettings = $ini->getSection('db');
164   - $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'],
165   - 'dbName'=> $dbSettings['dbName'],
166   - 'dbUser'=> $dbSettings['dbUser'],
167   - 'dbPass'=> $dbSettings['dbPass'],
168   - 'dbPort'=> $dbSettings['dbPort'],
169   - 'dbAdminUser'=> $dbSettings['dbAdminUser'],
170   - 'dbAdminPass'=> $dbSettings['dbAdminPass'],
171   - );
172   - $ktSettings = $ini->getSection('KnowledgeTree');
173   - $froot = $ktSettings['fileSystemRoot'];
174   - if ($froot == 'default') {
175   - $froot = $this->location;
176   - }
177   - $this->ktSettings = array('fileSystemRoot'=> $froot,
178   - );
179   - $urlPaths = $ini->getSection('urls');
180   - $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $froot.DS.'var'),
181   - array('name'=> 'Log Directory', 'path'=> $froot.DS.'log'),
182   - array('name'=> 'Document Root', 'path'=> $froot.DS.'Documents'),
183   - array('name'=> 'UI Directory', 'path'=> $froot.DS.'presentation'.DS.'lookAndFeel'.DS.'knowledgeTree'),
184   - array('name'=> 'Temporary Directory', 'path'=> $froot.DS.'tmp'),
185   - array('name'=> 'Cache Directory', 'path'=> $froot.DS.'cache'),
186   - );
187   - $this->temp_variables['urlPaths'] = $this->urlPaths;
188   - $this->temp_variables['ktSettings'] = $this->ktSettings;
189   - $this->temp_variables['dbSettings'] = $this->dbSettings;
190   - }
191   -
192   - private function setDetails() {
193   - $inst = $this->getDataFromSession("installation");
194   - if ($inst) {
195   - $this->location = $inst['location'];
196   - }
197   - }
198   -
199   - public function getStepVars() {
200   - return $this->temp_variables;
201   - }
202   -
203   - public function getErrors() {
204   - return $this->error;
205   - }
206   -
207   - public function storeSilent() {
208   - $this->temp_variables['location'] = $this->location;
209   -
210   - }
211   -
212   -}
213   -?>
214 0 \ No newline at end of file
setup/migrate/steps/migrateServices.php
... ... @@ -134,6 +134,7 @@ class migrateServices extends Step
134 134 public function __construct() {
135 135 $this->temp_variables = array("step_name"=>"migrateServices", "silent"=>$this->silent);
136 136 $this->util = new MigrateUtil();
  137 + $this->installServices = $this->util->getInstallServices();
137 138 }
138 139  
139 140 /**
... ... @@ -146,7 +147,6 @@ class migrateServices extends Step
146 147 */
147 148 public function doStep()
148 149 {
149   - $this->installServices = $this->util->getInstallerServices();
150 150 $this->services = $this->installServices->migrateGetServices();
151 151 $this->doRun();
152 152 $this->storeSilent();
... ... @@ -158,7 +158,6 @@ class migrateServices extends Step
158 158 } else if($this->previous()) {
159 159 return 'previous';
160 160 }
161   -
162 161 return 'landing';
163 162 }
164 163  
... ... @@ -201,16 +200,18 @@ class migrateServices extends Step
201 200 *
202 201 */
203 202 private function stopServices() {
204   - // Try the dmsctl
205   - $cmd = "./dmsctl.sh stop";
206   - $this->util->pexec($cmd);
207   - // probably will not work.
208   - foreach ($this->services as $service) {
209   - $sStatus = $service->status();
210   - if($sStatus != '') {
211   - $res = $service->uninstall();
212   - print_r($res);
213   - }
  203 + $conf = $this->getDataFromSession("installation"); // Get installation directory
  204 + if($conf['location'] != '') {
  205 + $cmd = $conf['location']."/dmsctl.sh stop"; // Try the dmsctl
  206 + // echo $cmd;
  207 + $this->util->pexec($cmd);
  208 + } else { // probably will not work, but worth a try.
  209 + foreach ($this->services as $service) {
  210 + $sStatus = $service->status();
  211 + if($sStatus != '') {
  212 + $res = $service->uninstall();
  213 + }
  214 + }
214 215 }
215 216 }
216 217  
... ... @@ -219,6 +220,7 @@ class migrateServices extends Step
219 220 $sStatus = $service->status();
220 221 if($sStatus == 'STARTED') {
221 222 $state = 'cross';
  223 + $this->error[] = "Service : {$service->getName()} could not be stopped.<br/>";
222 224 } else {
223 225 $state = 'tick';
224 226 }
... ...
setup/migrate/steps/services.php deleted
1   -<?php
2   -/**
3   -* Services Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -
43   -class services extends Step
44   -{
45   - /**
46   - * List of errors encountered
47   - *
48   - * @author KnowledgeTree Team
49   - * @access protected
50   - * @var array
51   - */
52   - protected $error = array();
53   -
54   - /**
55   - * Flag if step needs to be migrated
56   - *
57   - * @author KnowledgeTree Team
58   - * @access protected
59   - * @var array
60   - */
61   - protected $runMigrate = true;
62   -
63   - /**
64   - * List of services to be migrated
65   - *
66   - * @author KnowledgeTree Team
67   - * @access private
68   - * @var array
69   - */
70   - private $services = array('Lucene', 'Scheduler', 'OpenOffice');
71   -
72   - /**
73   - * Reference to utility object
74   - *
75   - * @author KnowledgeTree Team
76   - * @access protected
77   - * @var string
78   - */
79   - protected $util;
80   -
81   -
82   - /**
83   - * Flag if services are already Stopped
84   - *
85   - * @author KnowledgeTree Team
86   - * @access private
87   - * @var mixed
88   - */
89   - private $alreadyStopped = false;
90   -
91   - /**
92   - * Flag if services are already Stopped
93   - *
94   - * @author KnowledgeTree Team
95   - * @access private
96   - * @var mixed
97   - */
98   - private $luceneStopped = false;
99   -
100   - /**
101   - * Flag if services are already Stopped
102   - *
103   - * @author KnowledgeTree Team
104   - * @access private
105   - * @var mixed
106   - */
107   - private $schedulerStopped = false;
108   -
109   - /**
110   - * Flag if services are already Stopped
111   - *
112   - * @author KnowledgeTree Team
113   - * @access private
114   - * @var mixed
115   - */
116   - private $openOfficeStopped = false;
117   - /**
118   - * Service Migrateed
119   - *
120   - * @author KnowledgeTree Team
121   - * @access private
122   - * @var array
123   - */
124   - private $serviceCheck = 'tick';
125   -
126   - /**
127   - * Flag to store class information in session
128   - *
129   - * @author KnowledgeTree Team
130   - * @access public
131   - * @var boolean
132   - */
133   - protected $storeInSession = true;
134   -
135   - /**
136   - * List of variables to be loaded to template
137   - *
138   - * @author KnowledgeTree Team
139   - * @access public
140   - * @var array
141   - */
142   - protected $temp_variables;
143   -
144   - /**
145   - * Flag if step needs to run silently
146   - *
147   - * @author KnowledgeTree Team
148   - * @access public
149   - * @var array
150   - */
151   - protected $silent = true;
152   -
153   - /**
154   - * Constructs services object
155   - *
156   - * @author KnowledgeTree Team
157   - * @access public
158   - * @param none
159   - */
160   - public function __construct() {
161   - $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
162   - $this->util = new MigrateUtil();
163   - }
164   -
165   - /**
166   - * Main control of services setup
167   - *
168   - * @author KnowledgeTree Team
169   - * @param none
170   - * @access public
171   - * @return string
172   - */
173   - public function doStep()
174   - {
175   - $this->doRun();
176   - $this->storeSilent();
177   - if(!$this->inStep("services")) {
178   - return 'landing';
179   - }
180   - if($this->next()) {
181   - return 'next';
182   - } else if($this->previous()) {
183   - return 'previous';
184   - }
185   -
186   - return 'landing';
187   - }
188   -
189   - /**
190   - * Get service names
191   - *
192   - * @author KnowledgeTree Team
193   - * @param none
194   - * @access public
195   - * @return array
196   - */
197   - public function getServices() {
198   - return $this->services;
199   - }
200   -
201   - /**
202   - * Run step
203   - *
204   - * @author KnowledgeTree Team
205   - * @param none
206   - * @access private
207   - * @return boolean
208   - */
209   - private function doRun() {
210   - $serverDetails = $this->getServices();
211   - foreach ($serverDetails as $serviceName) {
212   -
213   - }
214   -
215   - $this->checkServiceStatus();
216   - return true;
217   - }
218   -
219   - /**
220   - * A final check to see if services are still running,
221   - * incase they switched on and turned off.
222   - *
223   - * @author KnowledgeTree Team
224   - * @param none
225   - * @access private
226   - * @return void
227   - */
228   - private function checkServiceStatus() {
229   - $serverDetails = $this->getServices();
230   - foreach ($serverDetails as $serviceName) {
231   - $className = OS.$serviceName;
232   - $service = new $className();
233   - $service->load();
234   - $status = $this->serviceInstalled($service);
235   - echo "$status<br/>";
236   - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$serviceName." has been shut down");
237   - }
238   - }
239   -
240   - /**
241   - * Checks if all services have been started already,
242   - * incase the user lands on service page multiple times
243   - *
244   - * @author KnowledgeTree Team
245   - * @param none
246   - * @access public
247   - * @return boolean
248   - */
249   - public function alreadyStopped() {
250   - $migrated = true;
251   - $serverDetails = $this->getServices();
252   - foreach ($serverDetails as $serviceName) {
253   - $className = OS.$serviceName;
254   - $service = new $className();
255   - $status = $this->serviceStatus($service);
256   - if(!$status) {
257   - return false;
258   - }
259   - }
260   - return true;
261   - }
262   -
263   - /**
264   - * Returns services errors
265   - *
266   - * @author KnowledgeTree Team
267   - * @access public
268   - * @params none
269   - * @return array
270   - */
271   - public function getErrors() {
272   - return $this->error;
273   - }
274   -
275   - /**
276   - * Returns services warnings
277   - *
278   - * @author KnowledgeTree Team
279   - * @access public
280   - * @params none
281   - * @return array
282   - */
283   - public function getWarnings() {
284   - return $this->warnings;
285   - }
286   -
287   - /**
288   - * Get the variables to be passed to the template
289   - *
290   - * @author KnowledgeTree Team
291   - * @access public
292   - * @return array
293   - */
294   - public function getStepVars()
295   - {
296   - return $this->temp_variables;
297   - }
298   -
299   - /**
300   - * Set all silent mode varibles
301   - *
302   - * @author KnowledgeTree Team
303   - * @param none
304   - * @access private
305   - * @return void
306   - */
307   - private function storeSilent() {
308   - $this->temp_variables['alreadyStopped'] = $this->alreadyStopped;
309   - $this->temp_variables['luceneStopped'] = $this->luceneStopped;
310   - $this->temp_variables['schedulerStopped'] = $this->schedulerStopped;
311   - $this->temp_variables['openOfficeStopped'] = $this->openOfficeStopped;
312   - $this->temp_variables['serviceCheck'] = $this->serviceCheck;
313   - }
314   -}
315   -?>
316 0 \ No newline at end of file
setup/migrate/steps/welcome.php deleted
1   -<?php
2   -/**
3   -* Welcome Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Migrater
40   -* @version Version 0.1
41   -*/
42   -
43   -class welcome extends step {
44   -
45   - protected $silent = true;
46   -
47   - function __construct() {
48   - $this->temp_variables = array("step_name"=>"license");
49   - }
50   -
51   - function doStep() {
52   - if($this->next()) {
53   - return 'next'; // Just a welcome, so return "next" action
54   - } elseif ($this->installer()) {
55   - return 'install'; // Just a welcome, so return "next" action
56   - }
57   -
58   - return 'landing';
59   - }
60   -
61   -}
62   -
63   -?>
64 0 \ No newline at end of file
setup/migrate/templates/services.tpl
... ... @@ -44,8 +44,10 @@
44 44 $details = 'Hide Details';
45 45 $display = 'block';
46 46 } else {
47   - $details = 'Show Details';
48   - $display = 'none';
  47 + $details = 'Hide Details';
  48 + $display = 'block';
  49 +// $details = 'Show Details';
  50 +// $display = 'none';
49 51 }
50 52 ?>
51 53 <div id="option6" class="onclick" onclick="javascript:{w.toggleClass('service_details', 'option6');}"><?php echo $details; ?></div>
... ...