Commit b1ea2a7758585749262ac0c3a076d6ea2d19a630
1 parent
f5c0c01c
Added call home scheduler task. Added enable checkbox to install step of install…
…er. Added db scripts to insert task in DB. PT: 1236126 Committed by: Megan Watson
Showing
6 changed files
with
312 additions
and
73 deletions
bin/system_info.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * | |
| 5 | + * $Id: | |
| 6 | + * | |
| 7 | + * KnowledgeTree Community Edition | |
| 8 | + * Document Management Made Simple | |
| 9 | + * Copyright (C) 2008, 2009 KnowledgeTree Inc. | |
| 10 | + * | |
| 11 | + * | |
| 12 | + * This program is free software; you can redistribute it and/or modify it under | |
| 13 | + * the terms of the GNU General Public License version 3 as published by the | |
| 14 | + * Free Software Foundation. | |
| 15 | + * | |
| 16 | + * This program is distributed in the hope that it will be useful, but WITHOUT | |
| 17 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 18 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 19 | + * details. | |
| 20 | + * | |
| 21 | + * You should have received a copy of the GNU General Public License | |
| 22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 23 | + * | |
| 24 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 25 | + * California 94120-7775, or email info@knowledgetree.com. | |
| 26 | + * | |
| 27 | + * The interactive user interfaces in modified source and object code versions | |
| 28 | + * of this program must display Appropriate Legal Notices, as required under | |
| 29 | + * Section 5 of the GNU General Public License version 3. | |
| 30 | + * | |
| 31 | + * In accordance with Section 7(b) of the GNU General Public License version 3, | |
| 32 | + * these Appropriate Legal Notices must retain the display of the "Powered by | |
| 33 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 34 | + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | |
| 35 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 36 | + * copyright notice. | |
| 37 | + * Contributor( s): ______________________________________ | |
| 38 | + */ | |
| 39 | + | |
| 40 | +/* | |
| 41 | +* Script to collect system information as part of a call home mechanism, no identifying information is stored. | |
| 42 | +* | |
| 43 | +* The following data is collected: | |
| 44 | +* Unique installation information: installation GUID, number of users in repository, number of documents in repository, | |
| 45 | +* operating system (platform, platform version, flavor if Linux), version and edition. | |
| 46 | +*/ | |
| 47 | +chdir(realpath(dirname(__FILE__))); | |
| 48 | +require_once('../config/dmsDefaults.php'); | |
| 49 | + | |
| 50 | +global $default; | |
| 51 | +$default->log->debug('System information collection script starting...'); | |
| 52 | + | |
| 53 | +// Get installation guid | |
| 54 | +function getGuid() | |
| 55 | +{ | |
| 56 | + $guid = KTUtil::getSystemIdentifier(); | |
| 57 | + | |
| 58 | + if(PEAR::isError($guid)){ | |
| 59 | + $guid = ''; | |
| 60 | + } | |
| 61 | + return $guid; | |
| 62 | +} | |
| 63 | + | |
| 64 | +// Get the number of users in the repository | |
| 65 | +function getUserCnt() | |
| 66 | +{ | |
| 67 | + $query = 'select count(*) as cnt, disabled from users where id > 0 group by disabled;'; | |
| 68 | + $result = DBUtil::getResultArray($query); | |
| 69 | + | |
| 70 | + if(empty($result) || PEAR::isError($result)){ | |
| 71 | + return ''; | |
| 72 | + } | |
| 73 | + $users = ''; | |
| 74 | + | |
| 75 | + foreach ($result as $row){ | |
| 76 | + $str = ''; | |
| 77 | + switch($row['disabled']){ | |
| 78 | + case 0: $str = 'Enabled'; break; | |
| 79 | + case 1: $str = 'Disabled'; break; | |
| 80 | + case 2: $str = 'Deleted'; break; | |
| 81 | + } | |
| 82 | + | |
| 83 | + $str .= ': '.$row['cnt']; | |
| 84 | + | |
| 85 | + $users .= (!empty($users)) ? '; ' : ''; | |
| 86 | + $users .= $str; | |
| 87 | + } | |
| 88 | + return $users; | |
| 89 | +} | |
| 90 | + | |
| 91 | +// Get the number of documents in the repository | |
| 92 | +function getDocCnt() | |
| 93 | +{ | |
| 94 | + $query = 'select count(*) as cnt, s.name from documents d, status_lookup s WHERE s.id = d.status_id group by d.status_id;'; | |
| 95 | + $result2 = DBUtil::getResultArray($query); | |
| 96 | + | |
| 97 | + if(empty($result2) || PEAR::isError($result2)){ | |
| 98 | + return ''; | |
| 99 | + } | |
| 100 | + $docs = ''; | |
| 101 | + | |
| 102 | + foreach ($result2 as $row){ | |
| 103 | + $docs .= (!empty($docs)) ? '; ' : ''; | |
| 104 | + $docs .= $row['name'].': '.$row['cnt']; | |
| 105 | + } | |
| 106 | + return $docs; | |
| 107 | +} | |
| 108 | + | |
| 109 | +// Get the version of KT | |
| 110 | +function getKTVersion() | |
| 111 | +{ | |
| 112 | + $version = KTUtil::getSystemSetting('knowledgeTreeVersion'); | |
| 113 | + if(empty($version) || PEAR::isError($version)){ | |
| 114 | + $version = file_get_contents(KT_DIR . 'docs/VERSION.txt'); | |
| 115 | + } | |
| 116 | + // remove newline that is in the version file | |
| 117 | + $version = str_replace("\n", '', $version); | |
| 118 | + return $version; | |
| 119 | +} | |
| 120 | + | |
| 121 | +// Get the edition of KT | |
| 122 | +function getKTEdition() | |
| 123 | +{ | |
| 124 | + $edition = 'Community'; | |
| 125 | + if (KTPluginUtil::pluginIsActive('ktdms.wintools')) { | |
| 126 | + $path = KTPluginUtil::getPluginPath('ktdms.wintools'); | |
| 127 | + require_once($path . 'baobabkeyutil.inc.php'); | |
| 128 | + $edition = BaobabKeyUtil::getName(); | |
| 129 | + | |
| 130 | + // Remove the brackets around the name | |
| 131 | + $edition = substr($edition, 1); | |
| 132 | + $edition = substr($edition, 0, strlen($edition)-1); | |
| 133 | + } | |
| 134 | + return $edition; | |
| 135 | +} | |
| 136 | + | |
| 137 | + | |
| 138 | +// Get OS info - platform, version, linux flavour | |
| 139 | +function getOSInfo() | |
| 140 | +{ | |
| 141 | + $server = php_uname(); | |
| 142 | + | |
| 143 | + if(strpos($server, 'Darwin') !== false){ | |
| 144 | + $os = 'Mac OS X'; | |
| 145 | + }else if(strpos($server, 'Win') !== false){ | |
| 146 | + $os = 'Windows'; | |
| 147 | + }else { | |
| 148 | + $os = 'Linux'; | |
| 149 | + } | |
| 150 | + | |
| 151 | + return $os; | |
| 152 | +} | |
| 153 | + | |
| 154 | +function sendForm($data) | |
| 155 | +{ | |
| 156 | + $url = 'http://ktnetwork.knowledgetree.com/call_home.php'; | |
| 157 | + //$url = 'http://10.33.20.250/knowledgetree/call_home.php'; | |
| 158 | + $data = http_build_query($data); | |
| 159 | + | |
| 160 | + $ch = curl_init($url); | |
| 161 | + curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); | |
| 162 | + curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, false); | |
| 163 | + curl_setopt($ch, CURLOPT_POST, true); | |
| 164 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | |
| 165 | + curl_exec($ch); | |
| 166 | + curl_close($ch); | |
| 167 | +} | |
| 168 | + | |
| 169 | +$post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo(); | |
| 170 | +$data['system_info'] = $post_str; | |
| 171 | + | |
| 172 | +sendForm($data); | |
| 173 | + | |
| 174 | +$default->log->debug('System information collection script finishing.'); | |
| 175 | +exit(0); | |
| 176 | +?> | ... | ... |
setup/wizard/config/config.xml
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | <step name="Service Dependency" order="3" mode="silent">services</step> |
| 18 | 18 | <step name="Database Configuration" order="1">database</step> |
| 19 | 19 | <step name="Registration">registration</step> |
| 20 | - <step name="Install" mode="silent">install</step> | |
| 20 | + <step name="Install" order="4" mode="silent">install</step> | |
| 21 | 21 | <step name="Complete">complete</step> |
| 22 | 22 | </steps> |
| 23 | 23 | </install> |
| 24 | 24 | \ No newline at end of file | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -39,8 +39,8 @@ |
| 39 | 39 | * @package Installer |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | -class InstallUtil { | |
| 43 | - | |
| 42 | +class InstallUtil { | |
| 43 | + | |
| 44 | 44 | private $salt = 'installers'; |
| 45 | 45 | /** |
| 46 | 46 | * Constructs installation object |
| ... | ... | @@ -50,7 +50,7 @@ class InstallUtil { |
| 50 | 50 | */ |
| 51 | 51 | public function __construct() { |
| 52 | 52 | } |
| 53 | - | |
| 53 | + | |
| 54 | 54 | /** |
| 55 | 55 | * Check if system needs to be installed |
| 56 | 56 | * |
| ... | ... | @@ -64,7 +64,7 @@ class InstallUtil { |
| 64 | 64 | |
| 65 | 65 | return true; |
| 66 | 66 | } |
| 67 | - | |
| 67 | + | |
| 68 | 68 | return false; |
| 69 | 69 | } |
| 70 | 70 | |
| ... | ... | @@ -100,13 +100,13 @@ class InstallUtil { |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * Redirect |
| 103 | - * | |
| 103 | + * | |
| 104 | 104 | * This function redirects the client. This is done by issuing |
| 105 | 105 | * a "Location" header and exiting if wanted. If you set $rfc2616 to true |
| 106 | 106 | * HTTP will output a hypertext note with the location of the redirect. |
| 107 | - * | |
| 108 | - * @static | |
| 109 | - * @access public | |
| 107 | + * | |
| 108 | + * @static | |
| 109 | + * @access public | |
| 110 | 110 | * have already been sent. |
| 111 | 111 | * @param string $url URL where the redirect should go to. |
| 112 | 112 | * @param bool $exit Whether to exit immediately after redirection. |
| ... | ... | @@ -119,10 +119,10 @@ class InstallUtil { |
| 119 | 119 | if (headers_sent()) { |
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | - | |
| 122 | + | |
| 123 | 123 | $url = $this->absoluteURI($url); |
| 124 | 124 | header('Location: '. $url); |
| 125 | - | |
| 125 | + | |
| 126 | 126 | if ( $rfc2616 && isset($_SERVER['REQUEST_METHOD']) && |
| 127 | 127 | $_SERVER['REQUEST_METHOD'] != 'HEAD') { |
| 128 | 128 | printf('Redirecting to: <a href="%s">%s</a>.', $url, $url); |
| ... | ... | @@ -135,21 +135,21 @@ class InstallUtil { |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Absolute URI |
| 138 | - * | |
| 138 | + * | |
| 139 | 139 | * This function returns the absolute URI for the partial URL passed. |
| 140 | 140 | * The current scheme (HTTP/HTTPS), host server, port, current script |
| 141 | 141 | * location are used if necessary to resolve any relative URLs. |
| 142 | - * | |
| 142 | + * | |
| 143 | 143 | * Offsets potentially created by PATH_INFO are taken care of to resolve |
| 144 | 144 | * relative URLs to the current script. |
| 145 | - * | |
| 146 | - * You can choose a new protocol while resolving the URI. This is | |
| 147 | - * particularly useful when redirecting a web browser using relative URIs | |
| 145 | + * | |
| 146 | + * You can choose a new protocol while resolving the URI. This is | |
| 147 | + * particularly useful when redirecting a web browser using relative URIs | |
| 148 | 148 | * and to switch from HTTP to HTTPS, or vice-versa, at the same time. |
| 149 | - * | |
| 150 | - * @author Philippe Jausions <Philippe.Jausions@11abacus.com> | |
| 151 | - * @static | |
| 152 | - * @access public | |
| 149 | + * | |
| 150 | + * @author Philippe Jausions <Philippe.Jausions@11abacus.com> | |
| 151 | + * @static | |
| 152 | + * @access public | |
| 153 | 153 | * @param string $url Absolute or relative URI the redirect should go to. |
| 154 | 154 | * @param string $protocol Protocol to use when redirecting URIs. |
| 155 | 155 | * @param integer $port A new port number. |
| ... | ... | @@ -159,7 +159,7 @@ class InstallUtil { |
| 159 | 159 | { |
| 160 | 160 | // filter CR/LF |
| 161 | 161 | $url = str_replace(array("\r", "\n"), ' ', $url); |
| 162 | - | |
| 162 | + | |
| 163 | 163 | // Mess around with already absolute URIs |
| 164 | 164 | if (preg_match('!^([a-z0-9]+)://!i', $url)) { |
| 165 | 165 | if (empty($protocol) && empty($port)) { |
| ... | ... | @@ -169,12 +169,12 @@ class InstallUtil { |
| 169 | 169 | $url = $protocol .':'. end($array = explode(':', $url, 2)); |
| 170 | 170 | } |
| 171 | 171 | if (!empty($port)) { |
| 172 | - $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', | |
| 172 | + $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', | |
| 173 | 173 | '\1:'. $port, $url); |
| 174 | 174 | } |
| 175 | 175 | return $url; |
| 176 | 176 | } |
| 177 | - | |
| 177 | + | |
| 178 | 178 | $host = 'localhost'; |
| 179 | 179 | if (!empty($_SERVER['HTTP_HOST'])) { |
| 180 | 180 | list($host) = explode(':', $_SERVER['HTTP_HOST']); |
| ... | ... | @@ -192,7 +192,7 @@ class InstallUtil { |
| 192 | 192 | $port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80; |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | - | |
| 195 | + | |
| 196 | 196 | if ($protocol == 'http' && $port == 80) { |
| 197 | 197 | unset($port); |
| 198 | 198 | } |
| ... | ... | @@ -201,31 +201,31 @@ class InstallUtil { |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $server = $protocol .'://'. $host . (isset($port) ? ':'. $port : ''); |
| 204 | - | |
| 204 | + | |
| 205 | 205 | if (!strlen($url)) { |
| 206 | - $url = isset($_SERVER['REQUEST_URI']) ? | |
| 206 | + $url = isset($_SERVER['REQUEST_URI']) ? | |
| 207 | 207 | $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; |
| 208 | 208 | } |
| 209 | - | |
| 209 | + | |
| 210 | 210 | if ($url{0} == '/') { |
| 211 | 211 | return $server . $url; |
| 212 | 212 | } |
| 213 | - | |
| 213 | + | |
| 214 | 214 | // Check for PATH_INFO |
| 215 | - if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) && | |
| 215 | + if (isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) && | |
| 216 | 216 | $_SERVER['PHP_SELF'] != $_SERVER['PATH_INFO']) { |
| 217 | 217 | $path = dirname(substr($_SERVER['PHP_SELF'], 0, -strlen($_SERVER['PATH_INFO']))); |
| 218 | 218 | } else { |
| 219 | 219 | $path = dirname($_SERVER['PHP_SELF']); |
| 220 | 220 | } |
| 221 | - | |
| 221 | + | |
| 222 | 222 | if (substr($path = strtr($path, '\\', '/'), -1) != '/') { |
| 223 | 223 | $path .= '/'; |
| 224 | 224 | } |
| 225 | - | |
| 225 | + | |
| 226 | 226 | return $server . $path . $url; |
| 227 | 227 | } |
| 228 | - | |
| 228 | + | |
| 229 | 229 | /** |
| 230 | 230 | * Check whether a given directory / file path exists and is writable |
| 231 | 231 | * |
| ... | ... | @@ -244,7 +244,7 @@ class InstallUtil { |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | } |
| 247 | - | |
| 247 | + | |
| 248 | 248 | /** |
| 249 | 249 | * Check whether a given directory / file path exists and is writable |
| 250 | 250 | * |
| ... | ... | @@ -258,7 +258,7 @@ class InstallUtil { |
| 258 | 258 | { |
| 259 | 259 | if(!$file) |
| 260 | 260 | $exist = 'Directory doesn\'t exist'; |
| 261 | - else | |
| 261 | + else | |
| 262 | 262 | $exist = 'File doesn\'t exist'; |
| 263 | 263 | $write = 'Directory not writable'; |
| 264 | 264 | $ret = array('class' => 'cross'); |
| ... | ... | @@ -280,12 +280,12 @@ class InstallUtil { |
| 280 | 280 | $ret['msg'] = $exist; |
| 281 | 281 | return $ret; |
| 282 | 282 | } |
| 283 | - mkdir($dir, '0755'); | |
| 283 | + mkdir($dir, 0755); | |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if(is_writable($dir)){ |
| 287 | 287 | $ret['class'] = 'tick'; |
| 288 | - | |
| 288 | + | |
| 289 | 289 | return $ret; |
| 290 | 290 | } |
| 291 | 291 | |
| ... | ... | @@ -293,7 +293,7 @@ class InstallUtil { |
| 293 | 293 | $ret['msg'] = $write; |
| 294 | 294 | return $ret; |
| 295 | 295 | } |
| 296 | - | |
| 296 | + | |
| 297 | 297 | /** |
| 298 | 298 | * Change permissions on a directory helper |
| 299 | 299 | * |
| ... | ... | @@ -305,7 +305,7 @@ class InstallUtil { |
| 305 | 305 | public function canChangePermissions($folderPath) { |
| 306 | 306 | return $this->_chmodRecursive($folderPath, 0755); |
| 307 | 307 | } |
| 308 | - | |
| 308 | + | |
| 309 | 309 | /** |
| 310 | 310 | * Change permissions on a directory (recursive) |
| 311 | 311 | * |
| ... | ... | @@ -344,7 +344,7 @@ class InstallUtil { |
| 344 | 344 | return true; |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | - | |
| 347 | + | |
| 348 | 348 | /** |
| 349 | 349 | * Check if a file can be written to a folder |
| 350 | 350 | * |
| ... | ... | @@ -358,11 +358,11 @@ class InstallUtil { |
| 358 | 358 | if($fr = fwrite($fh, 'test') === false) { |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | - | |
| 361 | + | |
| 362 | 362 | fclose($fh); |
| 363 | 363 | return true; |
| 364 | 364 | } |
| 365 | - | |
| 365 | + | |
| 366 | 366 | /** |
| 367 | 367 | * Attempt using the php-java bridge |
| 368 | 368 | * |
| ... | ... | @@ -379,7 +379,7 @@ class InstallUtil { |
| 379 | 379 | } |
| 380 | 380 | return true; |
| 381 | 381 | } |
| 382 | - | |
| 382 | + | |
| 383 | 383 | /** |
| 384 | 384 | * Check if Zend Bridge is enabled |
| 385 | 385 | * |
| ... | ... | @@ -390,12 +390,12 @@ class InstallUtil { |
| 390 | 390 | */ |
| 391 | 391 | public function zendBridge() { |
| 392 | 392 | $mods = get_loaded_extensions(); |
| 393 | - if(in_array('Zend Java Bridge', $mods)) | |
| 393 | + if(in_array('Zend Java Bridge', $mods)) | |
| 394 | 394 | return true; |
| 395 | - else | |
| 395 | + else | |
| 396 | 396 | return false; |
| 397 | 397 | } |
| 398 | - | |
| 398 | + | |
| 399 | 399 | /** |
| 400 | 400 | * Attempt java detection |
| 401 | 401 | * |
| ... | ... | @@ -412,7 +412,7 @@ class InstallUtil { |
| 412 | 412 | |
| 413 | 413 | return 'java'; |
| 414 | 414 | } |
| 415 | - | |
| 415 | + | |
| 416 | 416 | /** |
| 417 | 417 | * Attempt java detection |
| 418 | 418 | * |
| ... | ... | @@ -429,7 +429,7 @@ class InstallUtil { |
| 429 | 429 | |
| 430 | 430 | return 'java'; |
| 431 | 431 | } |
| 432 | - | |
| 432 | + | |
| 433 | 433 | /** |
| 434 | 434 | * Attempt java detection |
| 435 | 435 | * |
| ... | ... | @@ -451,7 +451,7 @@ class InstallUtil { |
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | - | |
| 454 | + | |
| 455 | 455 | /** |
| 456 | 456 | * Check if user entered location of JRE |
| 457 | 457 | * |
| ... | ... | @@ -471,7 +471,7 @@ class InstallUtil { |
| 471 | 471 | return false; |
| 472 | 472 | } |
| 473 | 473 | } |
| 474 | - | |
| 474 | + | |
| 475 | 475 | /** |
| 476 | 476 | * Check if user entered location of PHP |
| 477 | 477 | * |
| ... | ... | @@ -491,7 +491,7 @@ class InstallUtil { |
| 491 | 491 | return false; |
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | - | |
| 494 | + | |
| 495 | 495 | public function openOfficeSpecified() { |
| 496 | 496 | if(isset($_POST['soffice'])) { |
| 497 | 497 | if($_POST['soffice'] != '') { |
| ... | ... | @@ -503,7 +503,7 @@ class InstallUtil { |
| 503 | 503 | return false; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | - | |
| 506 | + | |
| 507 | 507 | /** |
| 508 | 508 | * Get session data from post |
| 509 | 509 | * |
| ... | ... | @@ -516,10 +516,10 @@ class InstallUtil { |
| 516 | 516 | if(empty($_SESSION[$this->salt][$class])) { |
| 517 | 517 | return false; |
| 518 | 518 | } |
| 519 | - | |
| 519 | + | |
| 520 | 520 | return $_SESSION[$this->salt][$class]; |
| 521 | 521 | } |
| 522 | - | |
| 522 | + | |
| 523 | 523 | /** |
| 524 | 524 | * Determine the location of JAVA_HOME |
| 525 | 525 | * |
| ... | ... | @@ -539,7 +539,7 @@ class InstallUtil { |
| 539 | 539 | |
| 540 | 540 | return $response; |
| 541 | 541 | } |
| 542 | - | |
| 542 | + | |
| 543 | 543 | /** |
| 544 | 544 | * Determine the location of PHP |
| 545 | 545 | * |
| ... | ... | @@ -562,10 +562,10 @@ class InstallUtil { |
| 562 | 562 | if(file_exists(PHP_DIR."php")) { |
| 563 | 563 | return PHP_DIR."php"; |
| 564 | 564 | } |
| 565 | - | |
| 565 | + | |
| 566 | 566 | return 'php'; |
| 567 | 567 | } |
| 568 | - | |
| 568 | + | |
| 569 | 569 | function getPhpHelper($cmd) { |
| 570 | 570 | $response = $this->pexec($cmd); |
| 571 | 571 | if(is_array($response['out'])) { |
| ... | ... | @@ -579,10 +579,10 @@ class InstallUtil { |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | - | |
| 583 | - return ''; | |
| 582 | + | |
| 583 | + return ''; | |
| 584 | 584 | } |
| 585 | - | |
| 585 | + | |
| 586 | 586 | function getOpenOffice() { |
| 587 | 587 | $cmd = "whereis soffice"; |
| 588 | 588 | $res = $this->getOpenOfficeHelper($cmd); |
| ... | ... | @@ -594,10 +594,10 @@ class InstallUtil { |
| 594 | 594 | if($res != '') { |
| 595 | 595 | return $res; |
| 596 | 596 | } |
| 597 | - | |
| 597 | + | |
| 598 | 598 | return 'soffice'; |
| 599 | 599 | } |
| 600 | - | |
| 600 | + | |
| 601 | 601 | function getOpenOfficeHelper($cmd) { |
| 602 | 602 | $response = $this->pexec($cmd); |
| 603 | 603 | if(is_array($response['out'])) { |
| ... | ... | @@ -611,11 +611,11 @@ class InstallUtil { |
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | - | |
| 614 | + | |
| 615 | 615 | return ''; |
| 616 | 616 | } |
| 617 | - | |
| 618 | - | |
| 617 | + | |
| 618 | + | |
| 619 | 619 | /** |
| 620 | 620 | * Portably execute a command on any of the supported platforms. |
| 621 | 621 | * |
| ... | ... | @@ -656,9 +656,9 @@ class InstallUtil { |
| 656 | 656 | |
| 657 | 657 | return $aRet; |
| 658 | 658 | } |
| 659 | - | |
| 659 | + | |
| 660 | 660 | /** |
| 661 | - * | |
| 661 | + * | |
| 662 | 662 | * |
| 663 | 663 | * @author KnowledgeTree Team |
| 664 | 664 | * @access public |
| ... | ... | @@ -681,9 +681,9 @@ class InstallUtil { |
| 681 | 681 | } |
| 682 | 682 | return $mDefault; |
| 683 | 683 | } |
| 684 | - | |
| 684 | + | |
| 685 | 685 | /** |
| 686 | - * | |
| 686 | + * | |
| 687 | 687 | * |
| 688 | 688 | * @author KnowledgeTree Team |
| 689 | 689 | * @access public | ... | ... |
setup/wizard/steps/install.php
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | -* Install Step Controller. | |
| 3 | +* Install Step Controller. | |
| 4 | 4 | * |
| 5 | 5 | * KnowledgeTree Community Edition |
| 6 | 6 | * Document Management Made Simple |
| ... | ... | @@ -40,9 +40,27 @@ |
| 40 | 40 | * @version Version 0.1 |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | -class install extends step | |
| 43 | +class install extends step | |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | + /** | |
| 47 | + * Flag to store class information in session | |
| 48 | + * | |
| 49 | + * @author KnowledgeTree Team | |
| 50 | + * @access public | |
| 51 | + * @var array | |
| 52 | + */ | |
| 53 | + protected $storeInSession = true; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Flag if step needs to be installed | |
| 57 | + * | |
| 58 | + * @author KnowledgeTree Team | |
| 59 | + * @access public | |
| 60 | + * @var array | |
| 61 | + */ | |
| 62 | + protected $runInstall = true; | |
| 63 | + | |
| 46 | 64 | function __construct() { |
| 47 | 65 | $this->temp_variables = array("step_name"=>"install"); |
| 48 | 66 | } |
| ... | ... | @@ -52,12 +70,14 @@ class install extends step |
| 52 | 70 | return 'landing'; |
| 53 | 71 | } |
| 54 | 72 | if($this->install()) { |
| 73 | + $this->doRun(); | |
| 55 | 74 | return 'install'; |
| 56 | 75 | } else if($this->previous()) { |
| 57 | 76 | return 'previous'; |
| 58 | 77 | } |
| 59 | 78 | |
| 60 | - return 'landing'; | |
| 79 | + $this->doRun(); | |
| 80 | + return 'landing'; | |
| 61 | 81 | } |
| 62 | 82 | |
| 63 | 83 | public function getStepVars() |
| ... | ... | @@ -68,5 +88,41 @@ class install extends step |
| 68 | 88 | public function getErrors() { |
| 69 | 89 | return $this->error; |
| 70 | 90 | } |
| 91 | + | |
| 92 | + public function doRun() | |
| 93 | + { | |
| 94 | + if(isset($_POST['Install'])){ | |
| 95 | + if(isset($_POST['call_home'])){ | |
| 96 | + $value = $_POST['call_home']; | |
| 97 | + }else{ | |
| 98 | + $value = 'disable'; | |
| 99 | + } | |
| 100 | + $this->temp_variables['call_home'] = $value; | |
| 101 | + | |
| 102 | + // Force a set session | |
| 103 | + // TODO: fix this to correctly set the session | |
| 104 | + $_SESSION['installers'] ['install']['call_home'] = $value; | |
| 105 | + } | |
| 106 | + } | |
| 107 | + | |
| 108 | + public function installStep() | |
| 109 | + { | |
| 110 | + $conf = $this->getDataFromSession("install"); | |
| 111 | + // retrieve database information from session | |
| 112 | + // initialise the db connection | |
| 113 | + $this->_dbhandler = new dbUtil(); | |
| 114 | + $dbconf = $this->getDataFromSession("database"); | |
| 115 | + $this->_dbhandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); | |
| 116 | + | |
| 117 | + $complete = 1; | |
| 118 | + if($conf['call_home'] == 'enable'){ | |
| 119 | + $complete = 0; | |
| 120 | + } | |
| 121 | + $query = "UPDATE scheduler_tasks SET is_complete = {$complete} WHERE task = 'Call Home'"; | |
| 122 | + $this->_dbhandler->query($query); | |
| 123 | + | |
| 124 | + // close the database connection | |
| 125 | + $this->_dbhandler->close(); | |
| 126 | + } | |
| 71 | 127 | } |
| 72 | 128 | ?> |
| 73 | 129 | \ No newline at end of file | ... | ... |
setup/wizard/templates/install.tpl
| ... | ... | @@ -5,9 +5,14 @@ |
| 5 | 5 | <br/> |
| 6 | 6 | <br/> |
| 7 | 7 | <p class="empty_space"> |
| 8 | - The wizard will now complete the installation and run a final check on the system. | |
| 8 | + The wizard will now complete the installation and run a final check on the system. | |
| 9 | + </p> | |
| 10 | + <div class="demo"><?php echo $html->image('kt_browse.png'); ?></div> | |
| 11 | + <br/> | |
| 12 | + <br/> | |
| 13 | + <p> | |
| 14 | + <input type='checkbox' name='call_home' value='enable' checked /> Enable the monitoring system | |
| 9 | 15 | </p> |
| 10 | - <div class="demo"><?php echo $html->image('dame/kt_browse.png'); ?></div> | |
| 11 | 16 | </div> |
| 12 | 17 | <input type="submit" name="Previous" value="Previous" class="button_previous"/> |
| 13 | 18 | <input type="submit" name="Install" value="Install" class="button_next"/> | ... | ... |
sql/mysql/upgrade/3.7.0/call_home_task.sql
0 → 100644