Commit 4d2178d8c00fa107d6bf9941a55407918418814d

Authored by unknown
2 parents 3516c618 8714916d

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

setup/migrate/path.php deleted
1   -<?php
2   -/**
3   -* Migrater Paths.
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   - // Define installer environment
43   - define('DEBUG', 0);
44   - define('AJAX', 0);
45   - // Define migrater environment
46   - if (substr(php_uname(), 0, 7) == "Windows"){
47   - define('WINDOWS_OS', true);
48   - define('UNIX_OS', false);
49   - define('OS', 'windows');
50   - } else {
51   - define('WINDOWS_OS', false);
52   - define('UNIX_OS', true);
53   - define('OS', 'unix');
54   - }
55   - if(WINDOWS_OS) {
56   - define('DS', '\\');
57   - } else {
58   - define('DS', '/');
59   - }
60   - // Define environment root
61   - $wizard = realpath(dirname(__FILE__));
62   - $xdir = explode(DS, $wizard);
63   - array_pop($xdir);
64   - array_pop($xdir);
65   - $sys = '';
66   - foreach ($xdir as $k=>$v) {
67   - $sys .= $v.DS;
68   - }
69   - // Define paths to wizard
70   - define('MIGRATE_DIR', $wizard.DS);
71   - define('WIZARD_LIB', MIGRATE_DIR."lib".DS);
72   - define('SERVICE_LIB', WIZARD_LIB."services".DS);
73   - define('SQL_DIR', MIGRATE_DIR."sql".DS);
74   - define('SQL_UPGRADE_DIR', SQL_DIR."upgrades".DS);
75   - define('CONF_DIR', MIGRATE_DIR."config".DS);
76   - define('RES_DIR', MIGRATE_DIR."resources".DS);
77   - define('STEP_DIR', MIGRATE_DIR."steps".DS);
78   - define('TEMP_DIR', MIGRATE_DIR."templates".DS);
79   - define('SHELL_DIR', MIGRATE_DIR."shells".DS);
80   - define('OUTPUT_DIR', MIGRATE_DIR."output".DS);
81   - // Define paths to system webroot
82   - define('SYSTEM_DIR', $sys);
83   - define('SYS_VAR_DIR', SYSTEM_DIR."var".DS);
84   - define('SYS_BIN_DIR', SYSTEM_DIR."bin".DS);
85   - define('SYS_LOG_DIR', SYS_VAR_DIR."log".DS);
86   - define('SYS_OUT_DIR', SYS_VAR_DIR);
87   - define('VAR_BIN_DIR', SYS_VAR_DIR."bin".DS);
88   - // Define paths to system
89   - array_pop($xdir);
90   - $asys = '';
91   - foreach ($xdir as $k=>$v) {
92   - $asys .= $v.DS;
93   - }
94   - define('SYSTEM_ROOT', $asys);
95   - // Migrate Type
96   - preg_match('/Zend/', $sys, $matches); // TODO: Dirty
97   - if($matches) {
98   - $sysdir = explode(DS, $sys);
99   - array_pop($sysdir);
100   - array_pop($sysdir);
101   - array_pop($sysdir);
102   - array_pop($sysdir);
103   - $zendsys = '';
104   - foreach ($sysdir as $k=>$v) {
105   - $zendsys .= $v.DS;
106   - }
107   - define('INSTALL_TYPE', 'Zend');
108   - define('PHP_DIR', $zendsys."ZendServer".DS."bin".DS);
109   - } else {
110   - $modules = get_loaded_extensions();
111   - // TODO: Dirty
112   - if(in_array('Zend Download Server', $modules) || in_array('Zend Monitor', $modules) || in_array('Zend Utils', $modules) || in_array('Zend Page Cache', $modules)) {
113   - define('INSTALL_TYPE', 'Zend');
114   - define('PHP_DIR', '');
115   - } else {
116   - define('INSTALL_TYPE', '');
117   - define('PHP_DIR', '');
118   - }
119   - }
120   - // Other
121   - date_default_timezone_set('Africa/Johannesburg');
122   - if(WINDOWS_OS) { // Mysql bin [Windows]
123   - $serverPaths = explode(';',$_SERVER['PATH']);
124   - foreach ($serverPaths as $apath) {
125   - preg_match('/mysql/i', $apath, $matches);
126   - if($matches) {
127   - define('MYSQL_BIN', $apath.DS);
128   - break;
129   - }
130   - }
131   - } else {
132   - define('MYSQL_BIN', ''); // Assume its linux and can be executed from command line
133   - }
134   -
135   -?>
setup/migrate/steps/migrateInstallation.php
... ... @@ -83,7 +83,7 @@ class migrateInstallation extends step
83 83 private $ktSettings = array();
84 84 private $urlPaths = array();
85 85 private $knownWindowsLocations = array("C:\Program Files\ktdms"=>"C:\Program Files\ktdms\knowledgeTree\config\config-path","C:\Program Files x86\ktdms"=>"C:\Program Files x86\ktdms\knowledgeTree\config\config-path","C:\ktdms"=>"C:\ktdms\knowledgeTree\config\config-path");
86   - private $knownUnixLocations = array("/opt/ktdms","/var/www/ktdms");
  86 + private $knownUnixLocations = array("/opt/ktdms"=>"/opt/ktdms/knowledgeTree/config/config-path","/var/www/ktdms"=>"/var/www/ktdms/knowledgeTree/config/config-path");
87 87  
88 88 function __construct() {
89 89 $this->temp_variables = array("step_name"=>"installation", "silent"=>$this->silent);
... ... @@ -120,7 +120,7 @@ class migrateInstallation extends step
120 120 $this->location = $loc;
121 121 }
122 122 } else {
123   - foreach ($this->knownUnixLocations as $loc) {
  123 + foreach ($this->knownUnixLocations as $loc=>$configPath) {
124 124 if(file_exists($configPath))
125 125 $this->location = $loc;
126 126 }
... ...