Commit dea89b512200166fa2587d284e97150f4a9ba94e

Authored by sergem
2 parents 47c7a469 f1ae6e2a

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

setup/migrate/steps/migrateInstallation.php
... ... @@ -148,7 +148,7 @@ class migrateInstallation extends step
148 148 return false;
149 149 } else {
150 150 $this->foundVersion = $this->readVersion();
151   - if($version) {
  151 + if($this->foundVersion) {
152 152 $this->checkVersion();
153 153 }
154 154 $this->storeSilent();
... ... @@ -239,6 +239,8 @@ class migrateInstallation extends step
239 239 );
240 240 $ktSettings = $this->util->iniUtilities->getSection('KnowledgeTree');
241 241 $froot = $ktSettings['fileSystemRoot'];
  242 +// print_r($ktSettings);
  243 +// die;
242 244 if ($froot == 'default') {
243 245 $froot = $this->location;
244 246 }
... ...
setup/postcheckup.php
... ... @@ -38,7 +38,7 @@
38 38  
39 39 $checkup = true;
40 40 error_reporting(E_ALL);
41   -require_once('../config/dmsDefaults.php');
  41 +//require_once('../config/dmsDefaults.php');
42 42  
43 43 function writablePath($name, $path) {
44 44 $ret = sprintf('<tr><td>%s (%s)</td><td>', $name, $path);
... ...
setup/precheckup.php
... ... @@ -38,7 +38,7 @@
38 38  
39 39 error_reporting(E_ALL);
40 40  
41   -require_once('../config/dmsDefaults.php');
  41 +//require_once('../config/dmsDefaults.php');
42 42  
43 43 function get_php_setting($val) {
44 44 $r = (ini_get($val) == '1' ? 1 : 0);
... ...
setup/upgrade/lib/UpgradeItems.inc.php
... ... @@ -117,7 +117,7 @@ class UpgradeItem extends InstallUtil {
117 117 return $this->type;
118 118 }
119 119  
120   - function runDBQuery($query) {
  120 + function runDBQuery($query, $checkResult = false, $typeCheck = false) {
121 121 require_once("../wizard/steps/configuration.php"); // configuration to read the ini path
122 122 $wizConfigHandler = new configuration();
123 123 $configPath = $wizConfigHandler->readConfigPathIni();
... ... @@ -128,13 +128,36 @@ class UpgradeItem extends InstallUtil {
128 128 $dconf = $this->iniUtilities->getSection('db');
129 129 $this->dbUtilities->load($dconf['dbHost'], '', $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']);
130 130 $result = $this->dbUtilities->query($query);
131   - $assArr = $this->dbUtilities->fetchAssoc($result);
132   - return $assArr;
  131 +// echo "$query<br/>";
  132 +// echo '<pre>';
  133 +// print_r($result);
  134 +// echo '</pre>';
  135 + if($checkResult) {
  136 + $assArr = $this->dbUtilities->fetchAssoc($result);
  137 +// echo '<pre>';
  138 +// print_r($assArr);
  139 +// echo '</pre>';
  140 +// if(is_null($assArr)) {
  141 +// echo '=== null ===<br/>';
  142 +// return false;
  143 +// } else {
  144 +// echo '=== not null ===<br/>';
  145 +// }
  146 + if($typeCheck) {
  147 + return !is_null($assArr);
  148 + } else {
  149 + return is_null($assArr);
  150 + }
  151 + }
  152 +// echo '<pre>';
  153 +// print_r($assArr);
  154 +// echo '</pre>';
  155 + return !is_null($result);
133 156 }
134 157  
135 158 function _upgradeTableInstalled() {
136 159 $query = "SELECT COUNT(id) FROM upgrades";
137   - $res = $this->runDBQuery($query);
  160 + $res = $this->runDBQuery($query, true, true);
138 161 if($res) {
139 162 return true;
140 163 }
... ... @@ -146,8 +169,9 @@ class UpgradeItem extends InstallUtil {
146 169 return false;
147 170 }
148 171 $query = "SELECT id FROM upgrades WHERE descriptor = '".$this->getDescriptor()."' AND result = 1";
149   - $res = $this->runDBQuery($query);
150   - if($res) {
  172 + $res = $this->runDBQuery($query, true, false);
  173 +
  174 + if(!$res) {
151 175 return true;
152 176 }
153 177 return false;
... ... @@ -161,27 +185,30 @@ class UpgradeItem extends InstallUtil {
161 185 return new Upgrade_Already_Applied($this);
162 186 }
163 187 }
164   -// if (PEAR::isError($res)) {
165   -// return $res;
  188 +// if (!$res) {
  189 +// $this->error[] = 'An Error Has Occured';
166 190 // }
167   - $oCache =& KTCache::getSingleton();
168   - $save = $oCache->bEnabled;
169   - $oCache->bEnabled = false;
  191 +// $oCache =& KTCache::getSingleton();
  192 +// $save = $oCache->bEnabled;
  193 +// $oCache->bEnabled = false;
170 194 $res = $this->_performUpgrade();
171   - $oCache->bEnabled = $save;
172   -// if (PEAR::isError($res)) {
173   -// $this->_recordUpgrade(false);
174   -// return $res;
175   -// }
  195 +// $oCache->bEnabled = $save;
  196 + if (!$res) {
  197 + $this->_recordUpgrade(false);
  198 + $this->error[] = $this->dbUtilities->getErrors();
  199 + return false;
  200 + }
176 201 $res = $this->_recordUpgrade(true);
177   -// if (PEAR::isError($res)) {
178   -// return $res;
179   -// }
  202 + if (!$res) {
  203 + $this->error[] = 'An Error Has Occured 1';
  204 + return false;
  205 + }
180 206 return true;
181 207 }
182 208  
183 209 function _performUpgrade() {
184   -// return PEAR::raiseError("Unimplemented");
  210 + $this->error[] = 'Unimplemented';
  211 + return false;
185 212 }
186 213  
187 214 function _recordUpgrade($result) {
... ... @@ -193,17 +220,10 @@ class UpgradeItem extends InstallUtil {
193 220 } else {
194 221 $parentid = null;
195 222 }
196   - //TODO: Where is the code?
197   - exit("add code");
198   - /*return $this->autoInsert();
199   -
200   - DBUtil::autoInsert("upgrades", array(
201   - "descriptor" => $this->getDescriptor(),
202   - "description" => $this->description,
203   - "date_performed" => $this->date,
204   - "result" => $result,
205   - "parent" => $parentid,
206   - ));*/
  223 + $sql = "INSERT INTO upgrades (`id`, `descriptor`, `description`, `date_performed`, `result`, `parent`) VALUES ('', '". $this->getDescriptor()."', '".$this->description."', '".$this->date."', '".$result."', '".$parentid."')";
  224 + $this->dbUtilities->query($sql);
  225 +
  226 + return true;
207 227 }
208 228  
209 229 // STATIC
... ... @@ -358,15 +378,13 @@ class SQLUpgradeItem extends UpgradeItem {
358 378 }
359 379  
360 380 function _performUpgrade() {
361   -// global $default;
362 381 $dbType = 'mysql';
363 382 $sqlupgradedir = KT_DIR . 'sql/' . $dbType . '/upgrade/';
364 383 $queries = SQLFile::sqlFromFile($sqlupgradedir . $this->name);
365   - exit('add code');
366   -// return DBUtil::runQueries($queries, $default->_admindb);
  384 + return $this->dbUtilities->runQueries($queries);
367 385 }
368 386  
369   -
  387 +
370 388 }
371 389  
372 390 class KTRebuildPermissionObserver {
... ... @@ -426,8 +444,8 @@ class RecordUpgradeItem extends UpgradeItem {
426 444 $query = "UPDATE system_settings SET value = '$systemVersion' WHERE name = 'knowledgetreeVersion'";
427 445 $this->runDBQuery($query);
428 446 $query = "UPDATE system_settings SET value = '{$this->version}' WHERE name = 'databaseVersion'";
429   - $assArray = $this->runDBQuery($query);
430   - return !is_null($assArray);
  447 + $result = $this->runDBQuery($query);
  448 + return $result;
431 449 }
432 450  
433 451 function _deleteSmartyFiles() {
... ...
setup/upgrade/steps/upgradeComplete.php
... ... @@ -48,6 +48,7 @@ class upgradeComplete extends Step {
48 48  
49 49 public function doStep() {
50 50 $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
  51 +
51 52 $this->doRun();
52 53 return 'landing';
53 54 }
... ... @@ -61,6 +62,8 @@ class upgradeComplete extends Step {
61 62 *
62 63 */
63 64 private function storeSilent() {
  65 + $v = $this->getDataFromSession('upgradeProperties');
  66 + $this->temp_variables['sysVersion'] = $v['upgrade_version'];
64 67 }
65 68  
66 69 }
... ...
setup/upgrade/steps/upgradeDatabase.php
... ... @@ -42,6 +42,7 @@
42 42  
43 43 define('KT_DIR', SYSTEM_DIR);
44 44 define('KT_LIB_DIR', SYSTEM_DIR.'lib');
  45 +require_once(WIZARD_LIB . 'upgrade.inc.php');
45 46  
46 47 class upgradeDatabase extends Step
47 48 {
... ... @@ -94,8 +95,8 @@ class upgradeDatabase extends Step
94 95 protected $silent = false;
95 96 protected $temp_variables = array();
96 97 public $paths = '';
97   -
98   - /**
  98 +
  99 + /**
99 100 * Main control of database setup
100 101 *
101 102 * @author KnowledgeTree Team
... ... @@ -141,16 +142,8 @@ class upgradeDatabase extends Step
141 142 }
142 143  
143 144 private function doRun($action = null) {
144   -// $this->readConfig(KTConfig::getConfigFilename());
145   -
146 145 $this->readConfig();
147   -// if($this->dbSettings['dbPort'] == '') {
148   -// $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'], '', $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
149   -// } else {
150   - $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],
151   - $this->dbSettings['dbPass'], $this->dbSettings['dbName']);
152   -// }
153   -
  146 + $con = $this->util->dbUtilities->load($this->dbSettings['dbHost'], $this->dbSettings['dbPort'], $this->dbSettings['dbUser'],$this->dbSettings['dbPass'], $this->dbSettings['dbName']);
154 147 $this->temp_variables['action'] = $action;
155 148 if (is_null($action) || ($action == 'preview')) {
156 149 $this->temp_variables['title'] = 'Preview Upgrade';
... ... @@ -256,21 +249,30 @@ class upgradeDatabase extends Step
256 249 require_once("../wizard/steps/configuration.php"); // configuration to read the ini path
257 250 $wizConfigHandler = new configuration();
258 251 $path = $wizConfigHandler->readConfigPathIni();
259   - $this->util->iniUtilities->load($path);
260   - $dbSettings = $this->util->iniUtilities->getSection('db');
261   - $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'],
  252 + $this->util->iniUtilities->load($path);
  253 + $dbSettings = $this->util->iniUtilities->getSection('db');
  254 + $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'],
262 255 'dbName'=> $dbSettings['dbName'],
263 256 'dbUser'=> $dbSettings['dbUser'],
264 257 'dbPass'=> $dbSettings['dbPass'],
265 258 'dbPort'=> $dbSettings['dbPort'],
266 259 'dbAdminUser'=> $dbSettings['dbAdminUser'],
267 260 'dbAdminPass'=> $dbSettings['dbAdminPass'],
268   - );
269   - $this->paths = $this->util->iniUtilities->getSection('urls');
270   - $this->paths = array_merge($this->paths, $this->util->iniUtilities->getSection('cache'));
271   - $this->temp_variables['dbSettings'] = $this->dbSettings;
272   - $this->sysVersion = $this->readVersion();
273   - $this->cachePath = $wizConfigHandler->readCachePath();
  261 + );
  262 + $this->paths = $this->util->iniUtilities->getSection('urls');
  263 + $this->paths = array_merge($this->paths, $this->util->iniUtilities->getSection('cache'));
  264 + $this->sysVersion = $this->readVersion();
  265 + $this->cachePath = $wizConfigHandler->readCachePath();
  266 + $this->proxyPath = $this->cachePath."/.."; // Total guess.
  267 + $this->proxyPath = realpath($this->proxyPath."/proxies");
  268 + $this->storeSilent();
  269 + }
  270 +
  271 + public function storeSilent() {
  272 + $this->temp_variables['paths'] = $this->paths;
  273 + $this->temp_variables['sysVersion'] = $this->sysVersion;
  274 + $this->temp_variables['sysVersion'] = $this->sysVersion;
  275 + $this->temp_variables['dbSettings'] = $this->dbSettings;
274 276 }
275 277  
276 278 private function upgradeConfirm()
... ... @@ -285,8 +287,6 @@ class upgradeDatabase extends Step
285 287  
286 288 private function doDatabaseUpgrade()
287 289 {
288   -// global $default;
289   -
290 290 $errors = false;
291 291  
292 292 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to
... ... @@ -294,18 +294,10 @@ class upgradeDatabase extends Step
294 294  
295 295 $pre_res = $this->performPreUpgradeActions();
296 296  
297   - if (PEAR::isError($pre_res)) {
298   - $errors = true;
299   - $this->temp_variables['preUpgrade'] = '<font color="red">Pre-Upgrade actions failed.</font>';
300   - }
301   - else {
302   - $this->temp_variables['preUpgrade'] = '<font color="green">Pre-Upgrade actions succeeded.</font>';
303   -
304   - }
305   -
306 297 $res = $this->performAllUpgrades();
307   - if (PEAR::isError($res) || PEAR::isError($pres)) {
  298 + if (!$res) {
308 299 $errors = true;
  300 + $this->error[] = 'An Error has occured';
309 301 // TODO instantiate error details hideable section?
310 302 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font>
311 303 <br/><br/>
... ... @@ -319,13 +311,7 @@ class upgradeDatabase extends Step
319 311 }
320 312  
321 313 $post_pres = $this->performPostUpgradeActions();
322   - if (PEAR::isError($post_res)) {
323   - $errors = true;
324   - $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>';
325   - }
326   - else {
327   - $this->temp_variables['postUpgrade'] = '<font color="green">Post-Upgrade actions succeeded.</font>';
328   - }
  314 +
329 315  
330 316 return !$errors;
331 317 }
... ... @@ -334,40 +320,63 @@ class upgradeDatabase extends Step
334 320  
335 321 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works.
336 322 // It should idealy work the same as the upgrades.
337   -
338   -// global $default;
339   -// print_r($this->paths);die;
340 323 // Lock the scheduler
341   - $lockFile = $default->cacheDirectory . DIRECTORY_SEPARATOR . 'scheduler.lock';
342   - touch($lockFile);
  324 + $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock';
  325 + @touch($lockFile);
343 326 return true;
344 327  
345 328 }
346 329  
  330 + private function deleteDirectory($sPath) {
  331 + if (!WINDOWS_OS) {
  332 + if (file_exists('/bin/rm')) {
  333 + $this->util->pexec(array('/bin/rm', '-rf', $sPath));
  334 + return;
  335 + }
  336 + }
  337 + if (WINDOWS_OS) {
  338 + // Potentially kills off all the files in the path, speeding
  339 + // things up a bit
  340 + exec("del /q /s " . escapeshellarg($sPath));
  341 + }
  342 + $hPath = @opendir($sPath);
  343 + while (($sFilename = readdir($hPath)) !== false) {
  344 + if (in_array($sFilename, array('.', '..'))) {
  345 + continue;
  346 + }
  347 + $sFullFilename = sprintf("%s/%s", $sPath, $sFilename);
  348 + if (is_dir($sFullFilename)) {
  349 + $this->deleteDirectory($sFullFilename);
  350 + continue;
  351 + }
  352 + @chmod($sFullFilename, 0666);
  353 + @unlink($sFullFilename);
  354 + }
  355 + closedir($hPath);
  356 + @rmdir($sPath);
  357 + }
  358 +
347 359 private function performPostUpgradeActions() {
348 360  
349 361 // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works.
350 362 // It should idealy work the same as the upgrades.
351 363  
352   -// global $default;
353   -
354 364 // Ensure all plugins are re-registered.
355 365 $sql = "TRUNCATE plugin_helper";
356   - $res = DBUtil::runQuery($sql);
357   -
  366 + //$res = DBUtil::runQuery($sql);
  367 + $res = $this->util->dbUtilities->query($sql);
  368 +
358 369 // Clear out all caches and proxies - they need to be regenerated with the new code
359   - $proxyDir = $default->proxyCacheDirectory;
360   - KTUtil::deleteDirectory($proxyDir);
361   -
362   - $oKTCache = new KTCache();
363   - $oKTCache->deleteAllCaches();
364   -
  370 + $this->deleteDirectory($this->proxyPath);
  371 +// $oKTCache = new KTCache();
  372 +// $oKTCache->deleteAllCaches();
  373 + $this->deleteDirectory($this->cachePath);
365 374 // Clear the configuration cache, it'll regenerate on next load
366   - $oKTConfig = new KTConfig();
367   - $oKTConfig->clearCache();
  375 +// $oKTConfig = new KTConfig();
  376 +// $oKTConfig->clearCache();
368 377  
369 378 // Unlock the scheduler
370   - $lockFile = $default->cacheDirectory . DIRECTORY_SEPARATOR . 'scheduler.lock';
  379 + $lockFile = $this->cachePath . DIRECTORY_SEPARATOR . 'scheduler.lock';
371 380 if(file_exists($lockFile)){
372 381 @unlink($lockFile);
373 382 }
... ... @@ -377,18 +386,15 @@ class upgradeDatabase extends Step
377 386 }
378 387  
379 388 private function performAllUpgrades () {
380   -// global $default;
381   -
382 389 $row = 1;
383   -
384   - $query = sprintf('SELECT value FROM %s WHERE name = "databaseVersion"', $default->system_settings_table);
385   - $lastVersion = DBUtil::getOneResultKey($query, 'value');
386   - $currentVersion = $default->systemVersion;
387   -
  390 + $table = 'system_settings';
  391 + $query = "SELECT value FROM $table WHERE name = 'databaseVersion'";
  392 + $result = $this->util->dbUtilities->query($query);
  393 + $assArr = $this->util->dbUtilities->fetchAssoc($result);
  394 + $lastVersion = $assArr[0]['value'];
  395 + $currentVersion = $this->sysVersion;
388 396 $upgrades = describeUpgrade($lastVersion, $currentVersion);
389   -
390 397 $this->temp_variables['upgradeTable'] = '';
391   -
392 398 foreach ($upgrades as $upgrade) {
393 399 if (($row % 2) == 1) {
394 400 $class = "odd";
... ... @@ -402,15 +408,17 @@ class upgradeDatabase extends Step
402 408 $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res));
403 409 $this->temp_variables['upgradeTable'] .= '<br>' . "\n";
404 410 $this->temp_variables['upgradeTable'] .= "</div>\n";
405   - if (PEAR::isError($res)) {
406   - if (!is_a($res, 'Upgrade_Already_Applied')) {
407   - break;
408   - } else {
409   - $res = true;
410   - }
411   - }
  411 +// if (!$res) {
  412 +// if (!is_a($res, 'Upgrade_Already_Applied')) {
  413 +// $res = false;
  414 +// } else {
  415 +// $res = true;
  416 +// }
  417 +// }
412 418 if ($res === false) {
413   - $res = PEAR::raiseError("Upgrade returned false");
  419 + die;
  420 + $this->error = $this->util->dbUtilities->getErrors();
  421 +// print_r($this->error);
414 422 break;
415 423 }
416 424 }
... ... @@ -419,11 +427,11 @@ class upgradeDatabase extends Step
419 427 }
420 428  
421 429 private function showResult($res) {
422   - if (PEAR::isError($res)) {
  430 + if ($res) {
423 431 if (is_a($res, 'Upgrade_Already_Applied')) {
424 432 return '<span style="color: orange">Already applied</span>';
425 433 }
426   - return sprintf('<span style="color: red">%s</span>', htmlspecialchars($res->toString()));
  434 +// return sprintf('<span style="color: red">%s</span>', htmlspecialchars($res));
427 435 }
428 436 if ($res === true) {
429 437 return '<span style="color: green">Success</span>';
... ... @@ -433,6 +441,5 @@ class upgradeDatabase extends Step
433 441 }
434 442 return $res;
435 443 }
436   -
437 444 }
438 445 ?>
439 446 \ No newline at end of file
... ...
setup/upgrade/steps/upgradeWelcome.php
... ... @@ -45,7 +45,8 @@ class upgradeWelcome extends step {
45 45 protected $silent = true;
46 46 protected $temp_variables = array();
47 47 protected $error = array() ;
48   -
  48 + protected $storeInSession = true;
  49 +
49 50 public function doStep() {
50 51 $this->temp_variables = array("step_name"=>"welcome");
51 52 if($this->next()) {
... ... @@ -88,8 +89,6 @@ class upgradeWelcome extends step {
88 89 $configPath = $wizConfigHandler->readConfigPathIni();
89 90 $this->util->iniUtilities->load($configPath);
90 91 $dconf = $this->util->iniUtilities->getSection('db');
91   - if($dconf['dbPort'] == 'default')
92   - $dconf['dbPort'] = 3306;
93 92 $this->util->dbUtilities->load($dconf['dbHost'],$dconf['dbPort'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']);
94 93 $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '$username' AND password = '".md5($password)."'";
95 94 $res = $this->util->dbUtilities->query($sQuery);
... ...
setup/upgrade/templates/complete.tpl
... ... @@ -6,8 +6,8 @@
6 6 <!-- Services -->
7 7 <br/><br/>
8 8 <div>
9   - Your database has been upgraded to <?php //echo $default->systemVersion; ?>
  9 + Your database has been upgraded to <?php echo $sysVersion; ?>
10 10 </div>
11 11 </div>
12   - <a href="../../" class="back button_next" style="width:90px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
  12 + <a href="../../login.php" class="back button_next" style="width:90px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
13 13 </form>
14 14 \ No newline at end of file
... ...
setup/upgrade/templates/database.tpl
... ... @@ -3,6 +3,13 @@
3 3 <div id="database" class="step1" style="display:block;">
4 4 <div class="description">
5 5 This step performs the necessary Database Upgrades.
  6 + <?php
  7 + echo "<br/>";
  8 + foreach ($errors as $error) {
  9 + if($error != '')
  10 + echo "<span class = 'error'>$error</span><br/>";
  11 + }
  12 + ?>
6 13 </div>
7 14 <div id="step_content_database" class="step">
8 15 <br/><br/>
... ...
setup/upgrade/upgradeSession.php deleted
1   -<?php
2   -/**
3   -* Session 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 Upgrader
40   -* @version Version 0.1
41   -*/
42   -class UpgradeSession
43   -{
44   - private $salt = 'upgrade';
45   - /**
46   - * Constructs session object
47   - *
48   - * @author KnowledgeTree Team
49   - * @access public
50   - * @param none
51   - */
52   - public function __construct() {
53   - $this->startSession();
54   - }
55   -
56   - /**
57   - * Starts a session if one does not exist
58   - *
59   - * @author KnowledgeTree Team
60   - * @param none
61   - * @access public
62   - * @return void
63   - */
64   - public function startSession() {
65   - if(!isset($_SESSION[$this->salt]['ready'])) {
66   - session_start();
67   - $_SESSION[$this->salt] ['ready'] = TRUE;
68   - }
69   - }
70   -
71   - /**
72   - * Sets a value key pair in session
73   - *
74   - * @author KnowledgeTree Team
75   - * @param string $fld
76   - * @param string $val
77   - * @access public
78   - * @return void
79   - */
80   - public function set($fld, $val) {
81   - $this->startSession();
82   - $_SESSION[$this->salt] [$fld] = $val;
83   - }
84   -
85   - /**
86   - * Sets a value key pair in a class in session
87   - *
88   - * @author KnowledgeTree Team
89   - * @param string $class
90   - * @param string $fld
91   - * @param string $val
92   - * @access public
93   - * @return void
94   - */
95   - public function setClass($class , $k, $v) {
96   - $this->startSession();
97   - $classArray = $this->get($class);
98   - if(isset($classArray[$k])) {
99   - $classArray[$k] = $v;
100   - } else {
101   - $classArray[$k] = $v;
102   - }
103   - $_SESSION[$this->salt] [ $class] = $classArray;
104   - }
105   -
106   - /**
107   - * Sets a error value key pair in a class in session
108   - *
109   - * @author KnowledgeTree Team
110   - * @param string $class
111   - * @param string $fld
112   - * @param string $val
113   - * @access public
114   - * @return void
115   - */
116   - public function setClassError($class, $k, $v) {
117   - $this->startSession();
118   - $classArray = $this->get($class);
119   - if(isset($classArray[$k])) {
120   - $classArray[$k] = $v;
121   - } else {
122   - $classArray[$k] = $v;
123   - }
124   - $_SESSION[$this->salt] [ $class] = $classArray;
125   - }
126   -
127   - /**
128   - * Clear error values in a class session
129   - *
130   - * @author KnowledgeTree Team
131   - * @param string $class
132   - * @param string $fld
133   - * @param string $val
134   - * @access public
135   - * @return void
136   - */
137   - public function clearErrors($class) {
138   - $classArray = $this->get($class);
139   - unset($classArray['errors']);
140   - $_SESSION[$this->salt] [ $class] = $classArray;
141   - }
142   -
143   - /**
144   - * Unset a value in session
145   - *
146   - * @author KnowledgeTree Team
147   - * @param string $fld
148   - * @access public
149   - * @return void
150   - */
151   - public function un_set($fld) {
152   - $this->startSession();
153   - unset($_SESSION[$this->salt] [$fld]);
154   - }
155   -
156   - /**
157   - * Unset a class value in session
158   - *
159   - * @author KnowledgeTree Team
160   - * @param string $class
161   - * @access public
162   - * @return void
163   - */
164   - public function un_setClass($class) {
165   - $this->startSession();
166   - if(isset($_SESSION[$this->salt] [$class]))
167   - unset($_SESSION[$this->salt] [$class]);
168   - }
169   -
170   - /**
171   - * Destroy the session
172   - *
173   - * @author KnowledgeTree Team
174   - * @param none
175   - * @access public
176   - * @return void
177   - */
178   - public function destroy() {
179   - $this->startSession();
180   - unset($_SESSION[$this->salt]);
181   - session_destroy();
182   - }
183   -
184   - /**
185   - * Get a session value
186   - *
187   - * @author KnowledgeTree Team
188   - * @param string $fld
189   - * @access public
190   - * @return string
191   - */
192   - public function get($fld) {
193   - $this->startSession();
194   - if(isset($_SESSION[$this->salt] [$fld]))
195   - return $_SESSION[$this->salt] [$fld];
196   - return false;
197   - }
198   -
199   - /**
200   - * Check if a field exists in session
201   - *
202   - * @author KnowledgeTree Team
203   - * @param string $fld
204   - * @access public
205   - * @return string
206   - */
207   - public function is_set($fld) {
208   - $this->startSession();
209   - return isset($_SESSION[$this->salt] [$fld]);
210   - }
211   -
212   - /**
213   - * Return a class from session
214   - *
215   - * @author KnowledgeTree Team
216   - * @param string $fld
217   - * @access public
218   - * @return string
219   - */
220   - public function getClass($class) {
221   - return $_SESSION[$this->salt][$class];
222   - }
223   -}
224   -?>
225 0 \ No newline at end of file
setup/wizard/dbUtilities.php
... ... @@ -267,5 +267,15 @@ class dbUtilities {
267 267 public function rollback() {
268 268 $this->query("ROLLBACK");
269 269 }
  270 +
  271 + public function runQueries($aQueries) {
  272 + foreach ($aQueries as $sQuery) {
  273 + $res = $this->query($sQuery);
  274 + if (!$res) {
  275 + return $res;
  276 + }
  277 + }
  278 + return true;
  279 + }
270 280 }
271 281 ?>
272 282 \ No newline at end of file
... ...
setup/wizard/iniUtilities.php
... ... @@ -45,11 +45,11 @@ class iniUtilities {
45 45  
46 46  
47 47 function load($iniFile) {
48   - if($this->iniFile != $iniFile) {
49   - $this->cleanArray = array();
50   - $this->lineNum = 0;
51   - $this->exists = '';
52   - }
  48 +// if($this->iniFile != $iniFile) {
  49 +// $this->cleanArray = array();
  50 +// $this->lineNum = 0;
  51 +// $this->exists = '';
  52 +// }
53 53 $this->iniFile = $iniFile;
54 54 $this->backupIni($iniFile);
55 55 $this->read($iniFile);
... ...
setup/wizard/lib/services/unixLucene.php
... ... @@ -201,7 +201,7 @@ class unixLucene extends unixService {
201 201 public function start() {
202 202 $state = $this->status();
203 203 if($state != 'STARTED') {
204   - $logFile = $this->outputDir."log".DS."lucene.log";
  204 + $logFile = $this->outputDir.DS."lucene.log";
205 205 @unlink($logFile);
206 206 $cmd = "cd ".$this->getLuceneDir()."; ";
207 207 $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!";
... ...
setup/wizard/lib/services/unixScheduler.php
... ... @@ -180,7 +180,7 @@ class unixScheduler extends unixService {
180 180 // TODO : Write sh on the fly? Not sure the reasoning here
181 181 $source = $this->getSchedulerSourceLoc();
182 182 $this->writeSchedulerTask();
183   - $logFile = $this->outputDir."log".DS."scheduler.log";
  183 + $logFile = $this->outputDir.DS."scheduler.log";
184 184 @unlink($logFile);
185 185 if($source) { // Source
186 186 $cmd = "nohup ".$source." > ".$logFile." 2>&1 & echo $!";
... ...
setup/wizard/resources/graphics/greenit.jpg 0 → 100644

35 KB

setup/wizard/templates/install.tpl
... ... @@ -5,10 +5,7 @@
5 5 <p class="empty_space">
6 6 We would greatly appreciate it if you would allow us to collect anonymous usage statistics to help us provide a better quality product. The information includes a unique identification number, number of users you have created, your operating system type and your IP address. Your privacy is protected by the <a href="http://www.knowledgetree.com/about/legal" target="_blank">KnowledgeTree Privacy and Data Protection Agreements.</a>
7 7 </p>
8   - <p class="empty_space"">
9   - KnowledgeTree, in partnership with <a href="http://www.trees.co.za/" target="_blank">Food & Trees for Africa</a>, and as a contributor to the National Tree Distribution Program, will also commit to planting one tree in Africa for every 1000 vertified installations of the product.
10   - </p>
11   - <div class="demo"><?php echo $html->image('img_fatlogo.jpg'); ?></div>
  8 + <div class="demo"><?php echo $html->image('greenit.jpg'); ?></div>
12 9 <br/><br/>
13 10 <p> <input class="" type='checkbox' name='call_home' value='enable' checked style="float:left;"/>&nbsp;&nbsp;
14 11 Help to improve KnowledgeTree by providing anonymous usage statistics</p>
... ...