Commit 45dace18a05ce63b02e8f8a73825a8a253168b18

Authored by Paul Barrett
2 parents 24c2575c 1bd50bdd

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

Showing 58 changed files with 1386 additions and 184 deletions
bin/dbmaint.php
... ... @@ -54,5 +54,5 @@ if(!empty($tables)){
54 54 }
55 55  
56 56 $default->log->info('Done.');
57   -
  57 +exit;
58 58 ?>
59 59 \ No newline at end of file
... ...
bin/expungeall.php
... ... @@ -8,31 +8,31 @@
8 8 * Document Management Made Simple
9 9 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
10 10 * Portions copyright The Jam Warehouse Software (Pty) Limited
11   - *
  11 + *
12 12 * This program is free software; you can redistribute it and/or modify it under
13 13 * the terms of the GNU General Public License version 3 as published by the
14 14 * Free Software Foundation.
15   - *
  15 + *
16 16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 19 * details.
20   - *
  20 + *
21 21 * You should have received a copy of the GNU General Public License
22 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,
  23 + *
  24 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
25 25 * California 94120-7775, or email info@knowledgetree.com.
26   - *
  26 + *
27 27 * The interactive user interfaces in modified source and object code versions
28 28 * of this program must display Appropriate Legal Notices, as required under
29 29 * Section 5 of the GNU General Public License version 3.
30   - *
  30 + *
31 31 * In accordance with Section 7(b) of the GNU General Public License version 3,
32 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
  33 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
34 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
  35 + * must display the words "Powered by KnowledgeTree" and retain the original
36 36 * copyright notice.
37 37 * Contributor( s): ______________________________________
38 38 */
... ... @@ -100,4 +100,5 @@ $end_time = time();
100 100 $diff = $end_time - $start_time;
101 101  
102 102 $session->logout();
  103 +exit;
103 104 ?>
... ...
bin/scheduler.php
... ... @@ -210,7 +210,9 @@ if (empty($aList))
210 210  
211 211 if ($ext == 'php')
212 212 {
213   - $phpPath = KTUtil::findCommand('externalBinary/php');
  213 + $oKTConfig = KTConfig::getSingleton();
  214 + $phpPath = $oKTConfig->get('externalBinary/php', 'php');
  215 + //$phpPath = KTUtil::findCommand('externalBinary/php');
214 216  
215 217 // being protective as some scripts work on relative paths
216 218 $dirname = dirname($file);
... ...
control.php
... ... @@ -37,7 +37,7 @@
37 37 */
38 38  
39 39 // check if system has been installed
40   -require_once("setup/wizard/install_util.php");
  40 +require_once("setup/wizard/installUtil.php");
41 41 // Check if system has been installed
42 42 $iu = new InstallUtil();
43 43 if(!$iu->isSystemInstalled()) {
... ...
plugins/housekeeper/bin/UpdateStats.php
... ... @@ -44,4 +44,5 @@ require_once(&#39;../HouseKeeper.inc.php&#39;);
44 44 HouseKeeper::getDiskUsageStats();
45 45 HouseKeeper::getKTUsageStats();
46 46  
47   -?>
  47 +exit;
  48 +?>
48 49 \ No newline at end of file
... ...
resources/graphics/menu_corner_left.png

667 Bytes | W: | H:

3.18 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/menubg.png

247 Bytes | W: | H:

2.81 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_bg_collapsed.gif

816 Bytes | W: | H:

4.36 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_bg_collapsed.png

193 Bytes | W: | H:

2.75 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topleft_collapsed.gif

1.14 KB | W: | H:

4.41 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topleft_collapsed.png

518 Bytes | W: | H:

1.06 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topright.gif

1.27 KB | W: | H:

1.25 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topright.png

785 Bytes | W: | H:

1.18 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topright_collapsed.gif

958 Bytes | W: | H:

4.42 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
resources/graphics/portlet_corner_topright_collapsed.png

299 Bytes | W: | H:

708 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
search2/bin/cronCleanup.php
... ... @@ -81,5 +81,5 @@ function cleanupTempDirectory($dir, $force = false)
81 81 }
82 82  
83 83  
84   -
85   -?>
  84 +exit;
  85 +?>
86 86 \ No newline at end of file
... ...
search2/bin/cronIndexStats.php
... ... @@ -49,3 +49,6 @@ if ($verbose) print _kt(&quot;Cache index stats and diagnostics&quot;) . &quot;...\n&quot;;
49 49  
50 50 $indexer = Indexer::get();
51 51 $indexer->updateIndexStats();
  52 +
  53 +exit;
  54 +?>
52 55 \ No newline at end of file
... ...
search2/bin/cronIndexer.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -42,5 +42,5 @@ require_once(realpath(&#39;../../config/dmsDefaults.php&#39;));
42 42  
43 43 KTUtil::call_page('search2/indexing/bin/cronIndexer.php');
44 44  
45   -
46   -?>
  45 +exit;
  46 +?>
47 47 \ No newline at end of file
... ...
search2/bin/cronMigration.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -42,4 +42,5 @@ require_once(realpath(&#39;../../config/dmsDefaults.php&#39;));
42 42  
43 43 KTUtil::call_page('search2/indexing/bin/cronMigration.php');
44 44  
45   -?>
  45 +exit;
  46 +?>
46 47 \ No newline at end of file
... ...
search2/bin/cronOptimize.php
... ... @@ -39,5 +39,5 @@
39 39  
40 40 require_once('optimise.php');
41 41  
42   -
43   -?>
  42 +exit;
  43 +?>
44 44 \ No newline at end of file
... ...
search2/bin/cronResources.php
... ... @@ -95,4 +95,5 @@ class ResourceChecker
95 95 $checker = new ResourceChecker();
96 96 $checker->check();
97 97  
98   -?>
  98 +exit;
  99 +?>
99 100 \ No newline at end of file
... ...
search2/bin/optimise.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -42,5 +42,5 @@ require_once(realpath(&#39;../../config/dmsDefaults.php&#39;));
42 42  
43 43 KTUtil::call_page('search2/indexing/bin/optimise.php');
44 44  
45   -
46   -?>
  45 +exit;
  46 +?>
47 47 \ No newline at end of file
... ...
search2/indexing/bin/cronIndexer.php
... ... @@ -50,5 +50,6 @@ require_once(&#39;indexing/indexerCore.inc.php&#39;);
50 50 $indexer = Indexer::get();
51 51 $indexer->indexDocuments();
52 52 $indexer->updateIndexStats();
  53 +
53 54 exit;
54 55 -?>
  56 +?>
55 57 \ No newline at end of file
... ...
search2/indexing/bin/cronMigration.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -51,4 +51,4 @@ $indexer = Indexer::get();
51 51 $indexer->migrateDocuments();
52 52  
53 53 exit;
54 54 -?>
  55 +?>
55 56 \ No newline at end of file
... ...
search2/indexing/bin/cronOptimize.php
... ... @@ -39,4 +39,5 @@
39 39  
40 40 require_once('optimise.php');
41 41  
42   -?>
  42 +exit;
  43 +?>
43 44 \ No newline at end of file
... ...
search2/indexing/bin/optimise.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -58,4 +58,5 @@ $indexer-&gt;optimise();
58 58  
59 59 if ($verbose) print _kt("Done.") . "\n";
60 60  
61   -?>
  61 +exit;
  62 +?>
62 63 \ No newline at end of file
... ...
search2/indexing/bin/recreateIndex.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -107,5 +107,5 @@ if ($indexall)
107 107  
108 108 print _kt("Done.") . "\n";
109 109  
110   -
111   -?>
  110 +exit;
  111 +?>
112 112 \ No newline at end of file
... ...
search2/indexing/bin/registerTypes.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -84,4 +84,5 @@ $indexer = Indexer::get();
84 84 $indexer->registerTypes($clear);
85 85  
86 86 print _kt("Done.") . "\n";
  87 +exit;
87 88 ?>
... ...
search2/indexing/bin/reportUnindexedDocuments.php
... ... @@ -125,4 +125,5 @@ else
125 125 print "-----END-----\n\nDone\n";
126 126 }
127 127  
128   -?>
  128 +exit;
  129 +?>
129 130 \ No newline at end of file
... ...
search2/indexing/bin/shutdown.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -86,5 +86,5 @@ print &quot;\n* &quot; . _kt(&quot;The request to shutdown has been sent to the server. It may
86 86  
87 87 print _kt("Done.") . "\n";
88 88  
89   -
90   -?>
  89 +exit;
  90 +?>
91 91 \ No newline at end of file
... ...
setup/wizard/config/config.xml
... ... @@ -10,10 +10,11 @@
10 10 <install version="3.3">
11 11 <steps>
12 12 <step name="Welcome">welcome</step>
  13 + <step name="PHP Dependencies">dependencies</step>
  14 + <step name="Service Dependencies" order="3">services</step>
  15 + <step name="System Configuration" order="1">configuration</step>
13 16 <step name="License Agreement">license</step>
14   - <step name="PHP Dependencies">dependency_check</step>
15   - <step name="System Configuration" order="2">configuration</step>
16   - <step name="Database Configuration" order="1">database</step>
  17 + <step name="Database Configuration" order="2">database</step>
17 18 <step name="Install">install</step>
18 19 <step name="Complete">complete</step>
19 20 </steps>
... ...
setup/wizard/database.inc renamed to setup/wizard/dbUtil.php 100644 โ†’ 100755
... ... @@ -39,7 +39,7 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -class DBUtil {
  42 +class dbUtil {
43 43 /**
44 44 * Host
45 45 *
... ... @@ -112,7 +112,7 @@ class DBUtil {
112 112 * @access public
113 113 * @return boolean
114 114 */
115   - public function DBUtil($dhost = 'localhost', $duname, $dpassword, $dbname = '') {
  115 + public function dbUtil($dhost = 'localhost', $duname, $dpassword, $dbname = '') {
116 116 $this->dbhost = $dhost;
117 117 $this->dbuname = $duname;
118 118 $this->dbpassword = $dpassword;
... ...
setup/wizard/index.php
... ... @@ -39,5 +39,5 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once("installwizard.php");
  42 +require_once("installWizard.php");
43 43 ?>
44 44 \ No newline at end of file
... ...
setup/wizard/Ini.inc renamed to setup/wizard/ini.php 100644 โ†’ 100755
setup/wizard/install_util.php renamed to setup/wizard/installUtil.php 100644 โ†’ 100755
... ... @@ -59,9 +59,9 @@ class InstallUtil {
59 59 */
60 60 public function isSystemInstalled() {
61 61 if (file_exists(dirname(__FILE__)."/install")) {
62   - return false;
  62 + return true;
63 63 }
64   - return true;
  64 + return false;
65 65 }
66 66  
67 67 /**
... ... @@ -312,13 +312,77 @@ class InstallUtil {
312 312 return true;
313 313 }
314 314  
315   - function execInBackground($cmd) {
316   - if (substr(php_uname(), 0, 7) == "Windows"){
317   - pclose(popen("start /B ". $cmd, "r"));
318   - }
319   - else {
320   - exec($cmd . " > /dev/null &");
321   - }
322   - }
  315 + /**
  316 + * Portably execute a command on any of the supported platforms.
  317 + */
  318 + function pexec($aCmd, $aOptions = null) {
  319 + if (is_array($aCmd)) {
  320 + $sCmd = $this->safeShellString($aCmd);
  321 + } else {
  322 + $sCmd = $aCmd;
  323 + }
  324 + $sAppend = $this->arrayGet($aOptions, 'append');
  325 + if ($sAppend) {
  326 + $sCmd .= " >> " . escapeshellarg($sAppend);
  327 + }
  328 + $sPopen = $this->arrayGet($aOptions, 'popen');
  329 + if ($sPopen) {
  330 + if (WINDOWS_OS) {
  331 + $sCmd = "start /b \"kt\" " . $sCmd;
  332 + }
  333 + return popen($sCmd, $sPopen);
  334 + }
  335 + // for exec, check return code and output...
  336 + $aRet = array();
  337 + $aOutput = array();
  338 + $iRet = '';
  339 + if(WINDOWS_OS) {
  340 + $sCmd = 'call '.$sCmd;
  341 + }
  342 + exec($sCmd, $aOutput, $iRet);
  343 + $aRet['ret'] = $iRet;
  344 + $aRet['out'] = $aOutput;
  345 +
  346 + return $aRet;
  347 + }
  348 +
  349 + function arrayGet($aArray, $sKey, $mDefault = null, $bDefaultIfEmpty = true) {
  350 + if (!is_array($aArray)) {
  351 + $aArray = (array) $aArray;
  352 + }
  353 +
  354 + if ($aArray !== 0 && $aArray !== '0' && empty($aArray)) {
  355 + return $mDefault;
  356 + }
  357 + if (array_key_exists($sKey, $aArray)) {
  358 + $mVal =& $aArray[$sKey];
  359 + if (empty($mVal) && $bDefaultIfEmpty) {
  360 + return $mDefault;
  361 + }
  362 + return $mVal;
  363 + }
  364 + return $mDefault;
  365 + }
  366 +
  367 + function safeShellString () {
  368 + $aArgs = func_get_args();
  369 + $aSafeArgs = array();
  370 + if (is_array($aArgs[0])) {
  371 + $aArgs = $aArgs[0];
  372 + }
  373 + $aSafeArgs[] = escapeshellarg(array_shift($aArgs));
  374 + if (is_array($aArgs[0])) {
  375 + $aArgs = $aArgs;
  376 + }
  377 + foreach ($aArgs as $sArg) {
  378 + if (empty($sArg)) {
  379 + $aSafeArgs[] = "''";
  380 + } else {
  381 + $aSafeArgs[] = escapeshellarg($sArg);
  382 + }
  383 + }
  384 + return join(" ", $aSafeArgs);
  385 + }
  386 +
323 387 }
324 388 ?>
325 389 \ No newline at end of file
... ...
setup/wizard/installwizard.php renamed to setup/wizard/installWizard.php 100644 โ†’ 100755
... ... @@ -40,10 +40,17 @@
40 40 * @version Version 0.1
41 41 */
42 42 include("path.php"); // Paths
43   -require_once("install_util.php"); // Utility functions
44   -require_once("session.php"); // Session management
45   -require_once("template.inc"); // Template management
46   -require_once("step_action.php"); // Step actions control
  43 +
  44 +function __autoload($class) { // Attempt and autoload classes
  45 + $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
  46 + if(file_exists(WIZARD_DIR."$class.php")) {
  47 + require(WIZARD_DIR."$class.php");
  48 + } elseif (file_exists(STEP_DIR."$class.php")) {
  49 + require(STEP_DIR."$class.php");
  50 + } else {
  51 + return false;
  52 + }
  53 +}
47 54  
48 55 class InstallWizard {
49 56 /**
... ... @@ -63,7 +70,7 @@ class InstallWizard {
63 70 * @var boolean
64 71 */
65 72 protected $iutil = null;
66   -
  73 +
67 74 /**
68 75 * Constructs installation wizard object
69 76 *
... ... @@ -93,7 +100,6 @@ class InstallWizard {
93 100 * @return void
94 101 */
95 102 public function displayInstaller($response = null) {
96   - require("installer.php");
97 103 if($response) {
98 104 $ins = new Installer(); // Instantiate the installer
99 105 $ins->resolveErrors($response); // Run step
... ... @@ -227,9 +233,9 @@ class InstallWizard {
227 233 public function dispatch() {
228 234 $this->load();
229 235 if($this->getBypass() === "1") {
230   - $this->createInstallFile();
231   - } elseif ($this->getBypass() === "0") {
232 236 $this->removeInstallFile();
  237 + } elseif ($this->getBypass() === "0") {
  238 + $this->createInstallFile();
233 239 }
234 240 if(!$this->isSystemInstalled()) { // Check if the systems not installed
235 241 $response = $this->systemChecks();
... ...
setup/wizard/installer.php
... ... @@ -109,7 +109,7 @@ class Installer {
109 109 *
110 110 * @author KnowledgeTree Team
111 111 * @access protected
112   - * @var array boolean
  112 + * @var boolean
113 113 */
114 114 protected $stepConfirmation = false;
115 115  
... ... @@ -125,21 +125,6 @@ class Installer {
125 125 }
126 126  
127 127 /**
128   - * Sets any variables passed through for testing purposes
129   - *
130   - * @author KnowledgeTree Team
131   - * @access private
132   - * @param none
133   - * @return void
134   - */
135   - private function _setSessionVars() {
136   - if(isset($_GET['bypass'])) {
137   - $bypass = $_GET['bypass'];
138   - $this->session->set('bypass', $bypass);
139   - }
140   - }
141   -
142   - /**
143 128 * Read xml configuration file
144 129 *
145 130 * @author KnowledgeTree Team
... ... @@ -282,6 +267,7 @@ class Installer {
282 267 * @return string
283 268 */
284 269 private function _runStepAction($stepName) {
  270 + //echo $stepName."==";
285 271 $this->stepAction = new stepAction($stepName);
286 272 $this->stepAction->setSteps($this->getSteps());
287 273 $this->stepAction->setStepNames($this->getStepNames());
... ... @@ -314,13 +300,44 @@ class Installer {
314 300 private function _xmlStepsToArray() {
315 301 foreach($this->simpleXmlObj->steps->step as $d_step) {
316 302 $step_name = (string) $d_step[0];
317   - $this->stepClassNames[] = $step_name; // Store steps as strings
318   - $this->stepNames[$step_name] = (string) $d_step['name']; // Store steps as human readable strings
319   - if(isset($d_step['order'])) {
  303 + $this->stepClassNames[] = $step_name;
  304 + }
  305 + $this->_loadToSession('stepClassNames', $this->stepClassNames);
  306 + }
  307 +
  308 + /**
  309 + * Set steps as human readable strings
  310 + *
  311 + * @author KnowledgeTree Team
  312 + * @param none
  313 + * @access private
  314 + * @return void
  315 + */
  316 + private function _xmlStepsNames() {
  317 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  318 + $step_name = (string) $d_step[0];
  319 + $this->stepNames[$step_name] = (string) $d_step['name'];
  320 + }
  321 + $this->_loadToSession('stepNames', $this->stepNames);
  322 + }
  323 +
  324 + /**
  325 + * Set steps install order
  326 + *
  327 + * @author KnowledgeTree Team
  328 + * @param none
  329 + * @access private
  330 + * @return void
  331 + */
  332 + private function _xmlStepsOrders() {
  333 + foreach($this->simpleXmlObj->steps->step as $d_step) {
  334 + if(isset($d_step['order'])) {
  335 + $step_name = (string) $d_step[0];
320 336 $order = (string) $d_step['order'];
321 337 $this->installOrders[$order] = $step_name; // Store step install order
322 338 }
323 339 }
  340 + $this->_loadToSession('installOrders', $this->installOrders);
324 341 }
325 342  
326 343 /**
... ... @@ -349,7 +366,7 @@ class Installer {
349 366 * @return void
350 367 */
351 368 private function _completeInstall() {
352   - unlink("install");
  369 + touch("install");
353 370 }
354 371  
355 372 /**
... ... @@ -371,7 +388,7 @@ class Installer {
371 388 // TODO : Break on error response
372 389 }
373 390 } else {
374   - die("$className : Class Files Missing");
  391 + die("$className : Class Files Missing : Install Helper");
375 392 }
376 393 }
377 394  
... ... @@ -389,10 +406,32 @@ class Installer {
389 406 foreach ($this->getSteps() as $class) {
390 407 $this->session->un_setClass($class);
391 408 }
  409 + foreach ($this->getStepNames() as $class) {
  410 + $this->session->un_setClass($class);
  411 + }
  412 + foreach ($this->_getInstallOrders() as $class) {
  413 + $this->session->un_setClass($class);
  414 + }
392 415 }
393 416 }
394 417 }
395 418  
  419 + private function loadNeeded() {
  420 + $this->_readXml(); // Xml steps
  421 + $this->_resetSessions(); // Make sure
  422 + $this->stepClassNames = $this->session->get('stepClassNames');
  423 + if(!$this->stepClassNames) {
  424 + $this->_xmlStepsToArray(); // String steps
  425 + }
  426 + $this->stepNames = $this->session->get('stepNames');
  427 + if(!$this->stepNames) {
  428 + $this->_xmlStepsNames();
  429 + }
  430 + $this->installOrders = $this->session->get('installOrders');
  431 + if(!$this->installOrders) {
  432 + $this->_xmlStepsOrders();
  433 + }
  434 + }
396 435 /**
397 436 * Main control to handle the flow of install
398 437 *
... ... @@ -402,10 +441,7 @@ class Installer {
402 441 * @return void
403 442 */
404 443 public function step() {
405   - $this->_readXml(); // Xml steps
406   - $this->_xmlStepsToArray(); // String steps
407   - $this->_resetSessions(); // Make sure
408   - $this->_setSessionVars();
  444 + $this->loadNeeded();
409 445 $response = $this->_landing();
410 446 switch($response) {
411 447 case 'next':
... ... @@ -518,7 +554,13 @@ class Installer {
518 554 public function resolveErrors($errors) {
519 555 echo $errors;
520 556 exit();
521   - }
  557 + }
  558 +
  559 + private function _loadToSession($type, $values) {
  560 + if($values) {
  561 + $this->session->set($type , $values);
  562 + }
  563 + }
522 564 }
523 565  
524 566 ?>
525 567 \ No newline at end of file
... ...
setup/wizard/output deleted
setup/wizard/path.php
... ... @@ -39,13 +39,30 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   - define('DS', '/');
  42 + // Define installer environment
  43 + if (substr(php_uname(), 0, 7) == "Windows"){
  44 + define('WINDOWS_OS', true);
  45 + define('UNIX_OS', false);
  46 + } else {
  47 + define('WINDOWS_OS', false);
  48 + define('UNIX_OS', true);
  49 + }
  50 + if(WINDOWS_OS) {
  51 + define('DS', '\\');
  52 + } else {
  53 + define('DS', '/');
  54 + }
43 55 define('WIZARD_DIR', dirname(__FILE__).DS);
44   - define('SYSTEM_DIR', WIZARD_DIR."../../");
  56 + define('SYSTEM_DIR', WIZARD_DIR."..".DS."..".DS);
  57 + define('SYS_BIN_DIR', WIZARD_DIR."..".DS."..".DS."bin".DS);
  58 + define('SYS_LOG_DIR', WIZARD_DIR."..".DS."..".DS."var".DS."log".DS);
45 59 define('SQL_DIR', WIZARD_DIR.DS."sql".DS);
46   - define('SQL_UPGRADE_DIR', SQL_DIR.DS."/upgrades/".DS);
  60 + define('SQL_UPGRADE_DIR', SQL_DIR.DS."upgrades".DS);
47 61 define('CONF_DIR', WIZARD_DIR.DS."config".DS);
48 62 define('RES_DIR', WIZARD_DIR.DS."resources".DS);
49 63 define('STEP_DIR', WIZARD_DIR.DS."steps".DS);
50 64 define('TEMP_DIR', WIZARD_DIR.DS."templates".DS);
  65 +
  66 +
  67 +
51 68 ?>
... ...
setup/wizard/resources/graphics/background.gif 100644 โ†’ 100755

914 Bytes | W: | H:

914 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
setup/wizard/resources/graphics/cross_orange.png 100644 โ†’ 100755

1.43 KB | W: | H:

1.43 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
setup/wizard/resources/wizard.css 100644 โ†’ 100755
setup/wizard/resources/wizard.js 100644 โ†’ 100755
setup/wizard/service.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Service 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 Installer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class Service {
  44 + private static $on = 1;
  45 + private static $off = 0;
  46 + public $pid;
  47 + public $status;
  48 +
  49 + public function start() {
  50 +
  51 +// $this->status = $this->on;
  52 + }
  53 +
  54 + public function stop() {
  55 +
  56 +// $this->status = $this->off;
  57 + }
  58 +
  59 + public function install() {
  60 +
  61 + }
  62 +
  63 + public function restart() {
  64 +// $this->status = $this->off;
  65 +
  66 +// $this->status = $this->on;
  67 + }
  68 +
  69 + public function uninstall() {
  70 +
  71 + }
  72 +
  73 + public function status() {
  74 +// return $this->status;
  75 + }
  76 +}
  77 +?>
0 78 \ No newline at end of file
... ...
setup/wizard/step_action.php renamed to setup/wizard/stepAction.php
... ... @@ -109,7 +109,7 @@ class stepAction {
109 109 if($this->stepName != '') {
110 110 $this->action = $this->createStep();
111 111 if(!$this->action) {
112   - die("{$this->stepName} : Class Files Missing");
  112 + die("{$this->stepName} : Class Files Missing : Create Step");
113 113 }
114 114 $response = $this->action->doStep();
115 115 if($this->action->storeInSession()) { // Check if class values need to be stored in session
... ... @@ -122,7 +122,7 @@ class stepAction {
122 122 }
123 123 return $response;
124 124 } else {
125   - die("{$this->stepName} : Class Files Missing");
  125 + die("{$this->stepName} : Class Files Missing : Do Action");
126 126 }
127 127 }
128 128  
... ... @@ -135,13 +135,8 @@ class stepAction {
135 135 * @return object Step
136 136 */
137 137 public function createStep() {
138   - $filename = STEP_DIR."{$this->stepName}.php";
139   - if (file_exists($filename)) {
140   - require_once($filename);
141   - $step_class = $this->makeCamelCase($this->stepName);
142   - return new $step_class();
143   - }
144   - return false;
  138 + $step_class = $this->makeCamelCase($this->stepName);
  139 + return new $step_class();
145 140 }
146 141  
147 142 /**
... ... @@ -219,7 +214,7 @@ class stepAction {
219 214 * @return string
220 215 */
221 216 public function getCurrentStepName() {
222   - return$this->step_names[$this->stepName];
  217 + return $this->step_names[$this->stepName];
223 218 }
224 219  
225 220 /**
... ...
setup/wizard/steps/complete.php
... ... @@ -39,7 +39,6 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once(WIZARD_DIR.'step.php');
43 42  
44 43 class complete extends Step
45 44 {
... ... @@ -48,5 +47,8 @@ class complete extends Step
48 47 $this->temp_variables = array("step_name"=>"complete");
49 48 }
50 49  
  50 + function doStep() {
  51 + return 'landing';
  52 + }
51 53 }
52 54 ?>
53 55 \ No newline at end of file
... ...
setup/wizard/steps/configuration.php
... ... @@ -39,7 +39,6 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once(WIZARD_DIR.'step.php');
43 42  
44 43 class configuration extends Step
45 44 {
... ... @@ -171,8 +170,6 @@ class configuration extends Step
171 170 */
172 171 public function installStep()
173 172 {
174   - include_once('database.inc');
175   - include_once('Ini.inc');
176 173 // get data from the server
177 174 $conf = $this->getDataFromSession("configuration");
178 175 $server = $conf['server'];
... ... @@ -187,13 +184,13 @@ class configuration extends Step
187 184 }
188 185  
189 186 // initialise the db connection
190   - $db = new DBUtil();
  187 + $db = new dbUtil();
191 188  
192 189 // retrieve database information from session
193 190 $dbconf = $this->getDataFromSession("database");
194 191  
195 192 // make db connection
196   - $db->DBUtil($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']);
  193 + $db->dbUtil($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']);
197 194  
198 195 // add db config to server variables
199 196 $server = $this->registerDBConfig($server, $dbconf);
... ...
setup/wizard/steps/database.php
... ... @@ -39,8 +39,6 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once(WIZARD_DIR.'step.php');
43   -require_once(WIZARD_DIR.'database.inc');
44 42  
45 43 class database extends Step
46 44 {
... ... @@ -223,7 +221,7 @@ class database extends Step
223 221 * @param none
224 222 */
225 223 public function __construct() {
226   - $this->_dbhandler = new DBUtil();
  224 + $this->_dbhandler = new dbUtil();
227 225 }
228 226  
229 227 /**
... ... @@ -300,9 +298,9 @@ class database extends Step
300 298 return false;
301 299 }
302 300 if($this->dport == '')
303   - $con = $this->_dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
  301 + $con = $this->_dbhandler->dbUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
304 302 else
305   - $con = $this->_dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
  303 + $con = $this->_dbhandler->dbUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
306 304 if (!$con) {
307 305 $this->error[] = "Could not connect: " . $this->_dbhandler->getErrors();
308 306 return false;
... ... @@ -533,7 +531,7 @@ class database extends Step
533 531 * @return object mysql connection
534 532 */
535 533 private function connectMysql() {
536   - $con = $this->_dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
  534 + $con = $this->_dbhandler->dbUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
537 535 if (!$con) {
538 536 $this->error[] = "Could not connect: " . $this->_dbhandler->getErrors();
539 537  
... ...
setup/wizard/steps/dependencies.php 0 โ†’ 100755
  1 +<?php
  2 +/**
  3 +* Dependency Step 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 Installer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class dependencies extends Step
  44 +{
  45 + private $maxPHPVersion = '6.0.0';
  46 + private $minPHPVersion = '5.0.0';
  47 + private $done;
  48 +
  49 + /**
  50 + * Flag to store class information in session
  51 + *
  52 + * @author KnowledgeTree Team
  53 + * @access public
  54 + * @var array
  55 + */
  56 + public $storeInSession = true;
  57 +
  58 + /**
  59 + * Constructor
  60 + *
  61 + * @author KnowledgeTree Team
  62 + * @access public
  63 + */
  64 + public function __construct() {
  65 + $this->temp_variables = array("step_name"=>"dependencyCheck");
  66 + $this->error = array();
  67 + $this->done = true;
  68 + }
  69 +
  70 + /**
  71 + * Control function for position within the step
  72 + *
  73 + * @author KnowledgeTree Team
  74 + * @access public
  75 + * @return string The position in the step
  76 + */
  77 + public function doStep()
  78 + {
  79 + // Check dependencies
  80 + $passed = $this->doRun();
  81 + if($this->next()) {
  82 + if($passed)
  83 + return 'next';
  84 + else
  85 + return 'error';
  86 + } else if($this->previous()) {
  87 +
  88 + return 'previous';
  89 + }
  90 +
  91 + return 'landing';
  92 + }
  93 +
  94 + /**
  95 + * Execute the step
  96 + *
  97 + * @author KnowledgeTree Team
  98 + * @access public
  99 + * @return boolean True to continue | False if errors occurred
  100 + */
  101 + public function doRun()
  102 + {
  103 + $check = $this->checkPhpVersion();
  104 + $this->temp_variables['version'] = $check;
  105 +
  106 + $configs = $this->checkPhpConfiguration();
  107 + $this->temp_variables['configurations'] = $configs;
  108 +
  109 + // get the list of extensions
  110 + $list = $this->getRequiredExtensions();
  111 + $extensions = array();
  112 +
  113 + foreach($list as $ext){
  114 +
  115 + $ext['available'] = 'no';
  116 + if($this->checkExtension($ext['extension'])){
  117 + $ext['available'] = 'yes';
  118 + }else {
  119 + if($ext['required'] == 'no'){
  120 + $ext['available'] = 'optional';
  121 + }else{
  122 + $this->done = false;
  123 + $this->error[] = 'Missing required extension: '.$ext['name'];
  124 + }
  125 + }
  126 +
  127 + $extensions[] = $ext;
  128 + }
  129 +
  130 + $this->temp_variables['extensions'] = $extensions;
  131 +
  132 + return $this->done;
  133 + }
  134 +
  135 + /**
  136 + * Get any errors that occurred
  137 + *
  138 + * @author KnowledgeTree Team
  139 + * @access public
  140 + * @return array The error list
  141 + */
  142 + public function getErrors() {
  143 + return $this->error;
  144 + }
  145 +
  146 + /**
  147 + * Get the variables to be passed to the template
  148 + *
  149 + * @author KnowledgeTree Team
  150 + * @access public
  151 + * @return array
  152 + */
  153 + public function getStepVars()
  154 + {
  155 + return $this->temp_variables;
  156 + }
  157 +
  158 + /**
  159 + * Check the php configuration
  160 + *
  161 + * @author KnowledgeTree Team
  162 + * @access private
  163 + * @return array The configurations list
  164 + */
  165 + private function checkPhpConfiguration()
  166 + {
  167 + $configs = $this->getConfigurations();
  168 +
  169 + foreach($configs as $key => $config) {
  170 + $setting = ini_get($config['configuration']);
  171 +
  172 + switch($config['type']){
  173 + case 'bool':
  174 + $value = ($setting == 1) ? 'ON' : 'OFF';
  175 + break;
  176 +
  177 + case 'empty':
  178 + $value = ($setting === false || $setting === '') ? 'unset' : $setting;
  179 + break;
  180 +
  181 + default:
  182 + $value = $setting;
  183 + }
  184 +
  185 + $class = ($value == $config['recommended']) ? 'green' : 'orange';
  186 + $configs[$key]['setting'] = $value;
  187 + $configs[$key]['class'] = $class;
  188 + }
  189 +
  190 + $limits = $this->getLimits();
  191 +
  192 + foreach($limits as $key => $limit) {
  193 + $setting = ini_get($limit['configuration']);
  194 +
  195 + $setting = $this->prettySizeToActualSize($setting);
  196 + $recommended = $this->prettySizeToActualSize($limit['recommended']);
  197 + $class = ($recommended < $setting || $setting = -1) ? 'green' : 'orange';
  198 +
  199 + $limits[$key]['setting'] = $this->prettySize($setting);
  200 + $limits[$key]['class'] = $class;
  201 + }
  202 + $configs = array_merge($configs, $limits);
  203 +
  204 + return $configs;
  205 + }
  206 +
  207 + /**
  208 + * Check that the version of php is correct
  209 + *
  210 + * @author KnowledgeTree Team
  211 + * @access private
  212 + * @return array Version check result
  213 + */
  214 + private function checkPhpVersion()
  215 + {
  216 + $phpversion = phpversion();
  217 +
  218 + $phpversion5 = version_compare($phpversion, $this->minPHPVersion, '>=');
  219 + $phpversion6 = version_compare($phpversion, $this->maxPHPVersion, '<');
  220 +
  221 + $check['class'] = 'cross';
  222 + if($phpversion5 != 1){
  223 + $this->done = false;
  224 + $check['version'] = "Your PHP version needs to be PHP 5.0 or higher. You are running version <b>{$phpversion}</b>.";
  225 + return $check;
  226 + }
  227 +
  228 + if($phpversion6 != 1){
  229 + $this->done = false;
  230 + $check['version'] = "KnowledgeTree is not supported on PHP 6.0 and higher. You are running version <b>{$phpversion}</b>.";
  231 + return $check;
  232 + }
  233 + $check['class'] = 'tick';
  234 + $check['version'] = "You are running version <b>{$phpversion}</b>.";
  235 + return $check;
  236 + }
  237 +
  238 + /**
  239 + * Check whether the given extension is loaded
  240 + *
  241 + * @author KnowledgeTree Team
  242 + * @access private
  243 + * @param string $extension
  244 + * @return boolean
  245 + */
  246 + private function checkExtension($extension)
  247 + {
  248 + if(extension_loaded($extension)){
  249 + return true;
  250 + }
  251 + $this->continue = false;
  252 + return false;
  253 + }
  254 +
  255 + /**
  256 + * Convert a formatted string to a size integer
  257 + *
  258 + * @author KnowledgeTree Team
  259 + * @access string
  260 + * @param integer $pretty
  261 + * @return integer
  262 + */
  263 + private function prettySizeToActualSize($pretty) {
  264 + if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'G') {
  265 + return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024 * 1024;
  266 + }
  267 + if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'M') {
  268 + return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;
  269 + }
  270 + if (strtoupper(substr($pretty, strlen($pretty) - 1)) == 'K') {
  271 + return (int)substr($pretty, 0, strlen($pretty)) * 1024 * 1024;
  272 + }
  273 + return (int)$pretty;
  274 + }
  275 +
  276 + /**
  277 + * Convert a size integer to a formatted string
  278 + *
  279 + * @author KnowledgeTree Team
  280 + * @access private
  281 + * @param integer $v
  282 + * @return string
  283 + */
  284 + private function prettySize($v) {
  285 + $v = (float)$v;
  286 + foreach (array('B', 'K', 'M', 'G') as $unit) {
  287 + if ($v < 1024) {
  288 + return $v . $unit;
  289 + }
  290 + $v = $v / 1024;
  291 + }
  292 + }
  293 +
  294 + /**
  295 + * Get the list of extensions used by the system
  296 + *
  297 + * @author KnowledgeTree Team
  298 + * @access private
  299 + * @return array
  300 + */
  301 + private function getRequiredExtensions()
  302 + {
  303 + return array(
  304 + array('extension' => 'fileinfo', 'required' => 'no', 'name' => 'Fileinfo', 'details' => 'Provides better file identification support - not necessary if you use file extensions.'),
  305 + array('extension' => 'iconv', 'required' => 'no', 'name' => 'IconV', 'details' => 'Used for conversion between character sets.'),
  306 + array('extension' => 'mysql', 'required' => 'yes', 'name' => 'MySQL', 'details' => 'Used for accessing a MySQL database.'),
  307 + array('extension' => 'curl', 'required' => 'yes', 'name' => 'cURL', 'details' => 'Allows the connection and communication between different servers types using various protocols.'),
  308 + array('extension' => 'xmlrpc', 'required' => 'yes', 'name' => 'XMLRPC', 'details' => 'Used with XML-RPC servers and clients.'),
  309 + array('extension' => 'win32', 'required' => 'no', 'name' => 'Win32', 'details' => 'Allows control of Microsoft Windows services.'),
  310 + array('extension' => 'mbstring', 'required' => 'no', 'name' => 'Multi Byte Strings', 'details' => 'Used in the manipulation of multi-byte strings.'),
  311 + array('extension' => 'ldap', 'required' => 'no', 'name' => 'LDAP', 'details' => 'Used to access LDAP directory servers.'),
  312 + array('extension' => 'json', 'required' => 'yes', 'name' => 'JSON', 'details' => 'Implements the javascript object notation (json) data-interchange format.'),
  313 + array('extension' => 'openssl', 'required' => 'no', 'name' => 'Open SSL', 'details' => 'Used for the generation and verification of signatures and the encrypting and decrypting of data'),
  314 + );
  315 + }
  316 +
  317 + /**
  318 + * Get the recommended configuration settings
  319 + *
  320 + * @author KnowledgeTree Team
  321 + * @access private
  322 + * @return array
  323 + */
  324 + private function getConfigurations()
  325 + {
  326 + return array(
  327 + array('name' => 'Safe Mode', 'configuration' => 'safe_mode', 'recommended' => 'ON', 'type' => 'bool'),
  328 + array('name' => 'Display Errors', 'configuration' => 'display_errors', 'recommended' => 'OFF', 'type' => 'bool'),
  329 + array('name' => 'Display Startup Errors', 'configuration' => 'display_startup_errors', 'recommended' => 'ON', 'type' => 'bool'),
  330 + array('name' => 'File Uploads', 'configuration' => 'file_uploads', 'recommended' => 'ON', 'type' => 'bool'),
  331 + array('name' => 'Magic Quotes GPC', 'configuration' => 'magic_quotes_gpc', 'recommended' => 'OFF', 'type' => 'bool'),
  332 + array('name' => 'Magic Quotes Runtime', 'configuration' => 'magic_quotes_runtime', 'recommended' => 'OFF', 'type' => 'bool'),
  333 + array('name' => 'Register Globals', 'configuration' => 'register_globals', 'recommended' => 'OFF', 'type' => 'bool'),
  334 + array('name' => 'Output Buffering', 'configuration' => 'output_buffering', 'recommended' => 'OFF', 'type' => 'bool'),
  335 + array('name' => 'Session auto start', 'configuration' => 'session.auto_start', 'recommended' => 'OFF', 'type' => 'bool'),
  336 + array('name' => 'Automatic prepend file', 'configuration' => 'auto_prepend_file', 'recommended' => 'unset', 'type' => 'empty'),
  337 + array('name' => 'Automatic append file', 'configuration' => 'auto_append_file', 'recommended' => 'unset', 'type' => 'empty'),
  338 + array('name' => 'Open base directory', 'configuration' => 'open_basedir', 'recommended' => 'unset', 'type' => 'empty'),
  339 + array('name' => 'Default MIME type', 'configuration' => 'default_mimetype', 'recommended' => 'text/html', 'type' => 'string'),
  340 + );
  341 + }
  342 +
  343 + /**
  344 + * Get the recommended limits settings
  345 + *
  346 + * @author KnowledgeTree Team
  347 + * @access private
  348 + * @return array
  349 + */
  350 + private function getLimits()
  351 + {
  352 + return array(
  353 + array('name' => 'Maximum POST size', 'configuration' => 'post_max_size', 'recommended' => '32M', 'type' => 'int'),
  354 + array('name' => 'Maximum upload size', 'configuration' => 'upload_max_filesize', 'recommended' => '32M', 'type' => 'int'),
  355 + array('name' => 'Memory limit', 'configuration' => 'memory_limit', 'recommended' => '32M', 'type' => 'int'),
  356 + );
  357 + }
  358 +}
  359 +?>
0 360 \ No newline at end of file
... ...
setup/wizard/steps/install.php
... ... @@ -40,8 +40,6 @@
40 40 * @version Version 0.1
41 41 */
42 42  
43   -require_once(WIZARD_DIR.'step.php');
44   -
45 43 class install extends step
46 44 {
47 45  
... ...
setup/wizard/steps/license.php
... ... @@ -39,7 +39,6 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once(WIZARD_DIR.'step.php');
43 42  
44 43 class license extends step {
45 44  
... ...
setup/wizard/steps/services.php 0 โ†’ 100755
  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 Installer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +
  44 +//require_once('../../thirdparty/xmlrpc-2.2/xmlrpc.inc');
  45 +
  46 +class services extends Step
  47 +{
  48 + /**
  49 + * List of errors encountered
  50 + *
  51 + * @author KnowledgeTree Team
  52 + * @access public
  53 + * @var array
  54 + */
  55 + public $error = array();
  56 +
  57 + /**
  58 + * Flag if step needs to be installed
  59 + *
  60 + * @author KnowledgeTree Team
  61 + * @access public
  62 + * @var array
  63 + */
  64 + protected $runInstall = true;
  65 +
  66 +
  67 + /**
  68 + * Constructs database object
  69 + *
  70 + * @author KnowledgeTree Team
  71 + * @access public
  72 + * @param none
  73 + */
  74 + public function __construct() {
  75 +
  76 + }
  77 +
  78 + /**
  79 + * Main control of services setup
  80 + *
  81 + * @author KnowledgeTree Team
  82 + * @param none
  83 + * @access public
  84 + * @return string
  85 + */
  86 + public function doStep()
  87 + {
  88 + // Check dependencies
  89 + $passed = $this->doRun();
  90 + if($this->next()) {
  91 + if($passed)
  92 + return 'next';
  93 + else
  94 + return 'error';
  95 + } else if($this->previous()) {
  96 +
  97 + return 'previous';
  98 + }
  99 +
  100 + return 'landing';
  101 + }
  102 +
  103 + private function doRun() {
  104 + $util = new InstallUtil();
  105 +// $response = $util->pexec("java"); // Java Runtime Check
  106 + $response = $util->pexec("java -version"); // Java Runtime Check
  107 + if(empty($response['out'])) {
  108 + $this->error[] = "Java runtime environment required";
  109 +// return false;
  110 + }
  111 + $this->installStep();
  112 + return true;
  113 + }
  114 +
  115 +
  116 + /**
  117 + * Runs step install if required
  118 + *
  119 + * @author KnowledgeTree Team
  120 + * @param none
  121 + * @access public
  122 + * @return void
  123 + */
  124 + public function installStep() {
  125 + $util = new InstallUtil();
  126 + if(WINDOWS_OS) { // Add service to tasks list if needed
  127 + $lucene = new windowsLucene();
  128 + // Start service
  129 + } else { // Unix based systems
  130 + $lucene = new unixLucene();
  131 + $lucene->load();
  132 + }
  133 +
  134 +
  135 +
  136 +
  137 + }
  138 +
  139 +
  140 +
  141 + /**
  142 + * Returns database errors
  143 + *
  144 + * @author KnowledgeTree Team
  145 + * @access public
  146 + * @params none
  147 + * @return array
  148 + */
  149 + public function getErrors() {
  150 + return $this->error;
  151 + }
  152 +}
  153 +?>
0 154 \ No newline at end of file
... ...
setup/wizard/steps/welcome.php
... ... @@ -39,11 +39,9 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -require_once(WIZARD_DIR.'step.php');
43 42  
44 43 class welcome extends step {
45 44  
46   -
47 45 function __construct() {
48 46 $this->temp_variables = array("step_name"=>"license");
49 47 }
... ...
setup/wizard/template.inc renamed to setup/wizard/template.php
setup/wizard/templates/dependencies.tpl 0 โ†’ 100755
  1 +<h1>PHP Dependencies Check</h1>
  2 +
  3 +<p class="description">
  4 +This checkup ensures that your environment is ready to support a KnowledgeTree installation. Settings marked in green are available,
  5 +settings marked in orange are optional and settings marked in red are required.
  6 +</p>
  7 +
  8 +<?php
  9 +if($errors){
  10 + echo '<div class="error">';
  11 + foreach ($errors as $msg){
  12 + echo $msg . "<br />\n";
  13 + }
  14 + echo '</div>';
  15 +}
  16 +?>
  17 +
  18 +<h3>PHP Version Check</h3>
  19 +
  20 +<p class="description">
  21 +The PHP version must be higher than 5.0 and lower than 6.0. It is not recommended to run a version higher than 5.3.2.
  22 +</p>
  23 +
  24 +<?php echo "<span class='{$version['class']}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>{$version['version']}"; ?>
  25 +<br /><br />
  26 +<h3>PHP Extensions</h3>
  27 +
  28 +<p class="description">
  29 +The following determines your PHP installation environment. The extensions are required for KnowledgeTree to perform at an optimal level.
  30 +</p>
  31 +
  32 +<table>
  33 +<?php
  34 +
  35 + foreach($extensions as $ext) {
  36 + $row = '<tr>';
  37 +
  38 + switch($ext['available']){
  39 + case 'yes':
  40 + $class = 'tick';
  41 + break;
  42 + case 'optional':
  43 + $class = 'cross_orange';
  44 + break;
  45 + case 'no':
  46 + default:
  47 + $class = 'cross';
  48 + }
  49 + $row .= "<td><div class='{$class}'></div></td>";
  50 + $row .= "<td>{$ext['name']}</td>";
  51 + $row .= ($ext['available'] != 'yes') ? "<td>{$ext['details']}</td>" : '<td></td>';
  52 +
  53 + $row .= '</tr>';
  54 +
  55 + echo $row."\n";
  56 + }
  57 +
  58 +?>
  59 +</table>
  60 +<br /><br />
  61 +<h3>PHP Configuration</h3>
  62 +
  63 +<p class="description">
  64 +The following is the recommended PHP configuration for KnowledgeTree to perform at an optimal level.
  65 +</p>
  66 +
  67 +<table>
  68 +
  69 +<tr>
  70 + <th>Setting</th>
  71 + <th>Recommended value</th>
  72 + <th>Current value</th>
  73 +</tr>
  74 +
  75 +<?php
  76 + foreach($configurations as $config) {
  77 + $row = '<tr>';
  78 +
  79 + $row .= "<td>{$config['name']}</td>";
  80 + $row .= "<td>{$config['recommended']}</td>";
  81 + $row .= "<td class='{$config['class']}'>{$config['setting']}</td>";
  82 +
  83 + $row .= '</tr>';
  84 +
  85 + echo $row."\n";
  86 + }
  87 +?>
  88 +
  89 +</table>
  90 +<form action="index.php?step_name=dependencies" method="post">
  91 +
  92 +<div class="buttons">
  93 + <input type="submit" name="Previous" value="Previous"/>
  94 + <input type="submit" name="Next" value="Next"/>
  95 +</div>
  96 +</form>
0 97 \ No newline at end of file
... ...
setup/wizard/templates/services.tpl 0 โ†’ 100755
  1 +<h1>Services Dependencies Check</h1>
  2 +
  3 +<p class="description">
  4 +This checkup ensures that your environment is ready to support a KnowledgeTree background services.
  5 +</p>
  6 +
  7 +<?php
  8 +if($errors){
  9 + echo '<div class="error">';
  10 + foreach ($errors as $msg){
  11 + echo $msg . "<br />\n";
  12 + }
  13 + echo '</div>';
  14 +}
  15 +?>
  16 +
  17 +
  18 +<form action="index.php?step_name=services" method="post">
  19 +
  20 +<div class="buttons">
  21 + <input type="submit" name="Previous" value="Previous"/>
  22 + <input type="submit" name="Next" value="Next"/>
  23 +</div>
  24 +</form>
0 25 \ No newline at end of file
... ...
setup/wizard/unixLucene.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 +* Lucene Service 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 Installer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +define('LUCENE_SOURCE_DIR', SYSTEM_DIR."bin".DS."luceneserver".DS);
  44 +define('LUCENE_SOURCE_FILE', SYSTEM_DIR."bin".DS."luceneserver".DS."ktlucene.jar");
  45 +require_once("service.php");
  46 +
  47 +class unixLucene extends Service {
  48 + private $name;
  49 +// private $javaBin;
  50 +// private $javaSystem;
  51 +// protected $lucene_pid_file="";
  52 +// protected $lucene_dir="";
  53 +// protected $lucene_message="";
  54 + protected $lucene_options = " -Xms512M -Xmx512M -jar ";
  55 + private $util = null;
  56 +
  57 + public function __construct() {
  58 + }
  59 +
  60 + function load() {
  61 + $this->name = "KTLuceneTest";
  62 + $this->util = new InstallUtil();
  63 +// $this->javaSystem = new Java('java.lang.System');
  64 +// $this->setJavaBin($this->javaSystem->getProperty('java.home').DS."bin");
  65 + }
  66 +
  67 + private function setJavaBin($javaBin) {
  68 + $this->javaBin = $javaBin;
  69 + }
  70 +
  71 + public function getJavaBin() {
  72 + return $this->javaBin;
  73 + }
  74 +
  75 + // Load default settings
  76 +// public function load() {
  77 +// $this->util = new InstallUtil();
  78 +// $this->lucene_dir = SYSTEM_DIR."bin".DS."luceneserver".DS;
  79 +// $this->lucene_pid_file = SYSTEM_DIR."bin".DS."luceneserver".DS."lucene.pid";
  80 +// $this->lucene_pid = '';
  81 +// }
  82 +
  83 + // Stop lucene
  84 + public function stop() {
  85 + // TODO:Still need to figure out xmlrpc shutdown()
  86 + $cmd = "pkill -f lucene<br/>";
  87 + $response = $util->pexec($cmd);
  88 + echo 'Stop lucene';
  89 + }
  90 +
  91 + public function install() {
  92 +
  93 + }
  94 +
  95 + // Start lucene
  96 + public function start() {
  97 + // TODO:A shot in the dark here
  98 + $this->util = new InstallUtil();
  99 + $cmd = "nohup java".$this->lucene_options.LUCENE_SOURCE_FILE." &> ".SYS_LOG_DIR."lucene.log";
  100 + $response = $this->util->pexec($cmd);
  101 + $this->status = $this->on;
  102 + echo 'Start lucene';
  103 + }
  104 +
  105 +
  106 + public function _start_lucene() {
  107 + if($this->is_lucene_running()) { // Is service running
  108 + echo 'Already Running<br/>';
  109 + } else {
  110 + // Get to
  111 + //echo 'Install service';
  112 + $this->is_lucene_running();
  113 + //nohup $LUCENE &> $INSTALL_PATH/var/log/dmsctl.log &
  114 +
  115 + }
  116 +
  117 +/*
  118 + is_lucene_running
  119 + RUNNING=$?
  120 +
  121 + if [ $RUNNING -eq 1 ]; then
  122 + echo "$0 $ARG: lucene (pid $LUCENE_PID) already running"
  123 + else
  124 + cd $INSTALL_PATH/knowledgeTree/bin/luceneserver
  125 + nohup $LUCENE &> $INSTALL_PATH/var/log/dmsctl.log &
  126 + if [ $? -eq 0 ]; then
  127 + echo "$0 $ARG: lucene started"
  128 + ps ax | grep ktlucene.jar | awk {'print $1'} > $LUCENE_PIDFILE
  129 + sleep 2
  130 + else
  131 + echo "$0 $ARG: lucene could not be started"
  132 + ERROR=3
  133 + fi
  134 + cd $INSTALL_PATH
  135 +fi
  136 +*/
  137 + }
  138 +
  139 + public function is_lucene_running() {
  140 +
  141 + $pid = $this->get_lucene_pid();
  142 + if($this->is_service_running($pid)) {
  143 + echo 'Service is running';
  144 + } else {
  145 +
  146 + }
  147 +
  148 +/* is_lucene_running() {
  149 + get_lucene_pid
  150 + is_service_running $LUCENE_PID
  151 + RUNNING=$?
  152 + if [ $RUNNING -eq 0 ]; then
  153 + LUCENE_STATUS="lucene not running"
  154 + else
  155 + LUCENE_STATUS="lucene already running"
  156 + fi
  157 + return $RUNNING*/
  158 + }
  159 +
  160 + public function is_service_running($pid) {
  161 + $cmd = "kill -0 $pid 2>/dev/null";
  162 + $response = $this->util->pexec($cmd);
  163 +
  164 + /*
  165 +is_service_running() {
  166 + PID=$1
  167 + if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
  168 + RUNNING=1
  169 + else
  170 + RUNNING=0
  171 + fi
  172 + return $RUNNING
  173 +}
  174 +*/
  175 + }
  176 +
  177 + public function get_lucene_pid() {
  178 + // TODO: PID FILE
  179 +/*get_lucene_pid() {
  180 + get_pid $LUCENE_PIDFILE
  181 + if [ ! $PID ]; then
  182 + return
  183 + fi
  184 + if [ $PID -gt 0 ]; then
  185 + LUCENE_PID=$PID
  186 + fi
  187 +}*/
  188 + }
  189 +
  190 + public function get_pid() {
  191 +
  192 +/*get_pid() {
  193 + PID=""
  194 + PIDFILE=$1
  195 + # check for pidfile
  196 + if [ -f $PIDFILE ] ; then
  197 + exec 6<&0
  198 + exec < $PIDFILE
  199 + read pid
  200 + PID=$pid
  201 + exec 0<&6 6<&-
  202 + fi
  203 +}*/
  204 + }
  205 +
  206 + function shutdown()
  207 + {
  208 +
  209 + $function=new xmlrpcmsg('control.shutdown',array(
  210 + php_xmlrpc_encode((string) $this->ktid),
  211 + php_xmlrpc_encode((string) $this->authToken)));
  212 +
  213 + $result=&$this->client->send($function);
  214 + if($result->faultCode())
  215 + {
  216 + $this->error($result, 'shutdown');
  217 + return false;
  218 + }
  219 + return true;
  220 + }
  221 +}
  222 +
  223 +//$luc = new Lucene();
  224 +//$luc->load();
  225 +//$luc->start();
  226 +//$luc->stop();
  227 +?>
0 228 \ No newline at end of file
... ...
setup/wizard/windowsLucene.php 0 โ†’ 100644
  1 +<?php
  2 +require_once("service.php");
  3 +
  4 +class Lucene {
  5 + private $javaBin;
  6 + private $javaJVM;
  7 + private $javaSystem;
  8 + private $name;
  9 + private $luceneExe;
  10 + private $luceneSource;
  11 + private $luceneServer;
  12 + private $luceneOut;
  13 + private $luceneError;
  14 + private $luceneDir;
  15 + private $util = null;
  16 +
  17 + public function __construct() {
  18 + }
  19 +
  20 + function load() {
  21 + $this->name = "KTLuceneTest";
  22 + $this->javaSystem = new Java('java.lang.System');
  23 + $this->setJavaBin($this->javaSystem->getProperty('java.home').DS."bin");
  24 + $this->setLuceneDIR(SYS_DIR.DS."bin".DS."luceneserver");
  25 + $this->setLuceneExe("KTLuceneService.exe");
  26 + $this->setJavaJVM();
  27 + $this->setLuceneSource("ktlucene.jar");
  28 + $this->setLuceneServer("com.knowledgetree.lucene.KTLuceneServer");
  29 + $this->setLuceneOut("lucene-out.txt");
  30 + $this->setLuceneError("lucene-err.txt");
  31 +
  32 + }
  33 +
  34 + private function setJavaBin($javaBin) {
  35 + $this->javaBin = $javaBin;
  36 + }
  37 +
  38 + public function getJavaBin() {
  39 + return $this->javaBin;
  40 + }
  41 +
  42 + private function setLuceneDIR($luceneDir) {
  43 + $this->luceneDir = $luceneDir;
  44 + }
  45 +
  46 + public function getluceneDir() {
  47 + return $this->luceneDir;
  48 + }
  49 +
  50 + private function setLuceneExe($luceneExe) {
  51 + $this->luceneExe = $this->getluceneDir().DS.$luceneExe;
  52 + }
  53 +
  54 + public function getLuceneExe() {
  55 + return $this->luceneExe;
  56 + }
  57 +
  58 + private function setLuceneSource($luceneSource) {
  59 + $this->luceneSource = $this->getluceneDir().DS.$luceneSource;
  60 + }
  61 +
  62 + public function getLuceneSource() {
  63 + return $this->luceneSource;
  64 + }
  65 +
  66 + private function setLuceneServer($luceneServer) {
  67 + $this->luceneServer = $luceneServer;
  68 + }
  69 +
  70 + public function getLuceneServer() {
  71 + return $this->luceneServer;
  72 + }
  73 +
  74 + private function setLuceneOut($luceneOut) {
  75 + $this->luceneOut = SYS_LOG_DIR.DS.$luceneOut;
  76 + }
  77 +
  78 + public function getLuceneOut() {
  79 + return $this->luceneOut;
  80 + }
  81 +
  82 + private function setLuceneError($luceneError) {
  83 + $this->luceneError = SYS_LOG_DIR.DS.$luceneError;
  84 + }
  85 +
  86 + public function getLuceneError() {
  87 + return $this->luceneError;
  88 + }
  89 +
  90 + private function setJavaJVM() {
  91 + if(file_exists($this->getJavaBin().DS."client".DS."jvm.dll")) {
  92 + $this->javaJVM = $this->getJavaBin().DS."client".DS."jvm.dll";
  93 + } elseif (file_exists($this->getJavaBin().DS."server".DS."jvm.dll")) {
  94 + $this->javaJVM = $this->getJavaBin().DS."server".DS."jvm.dll";
  95 + }
  96 + }
  97 +
  98 + public function getJavaJVM() {
  99 + return $this->javaJVM;
  100 + }
  101 +
  102 + function start() {
  103 + // windows
  104 + $cmd = "sc start {$this->name}";
  105 +// echo "start\n$cmd<br/>";
  106 + $response = exec($cmd);
  107 + // linux
  108 + // zend
  109 + }
  110 +
  111 + function stop() {
  112 + $cmd = "sc stop {$this->name}";
  113 + echo "stop\n$cmd<br/>";
  114 + $response = exec($cmd);
  115 + }
  116 +
  117 + function install() {
  118 + $cmd = $this->luceneExe." -install \"".$this->name."\" \"".$this->javaJVM. "\" -Djava.class.path=\"". $this->luceneSource."\"". " -start ".$this->luceneServer. " -out \"".$this->luceneOut."\" -err \"".$this->luceneError."\" -current \"".$this->luceneDir."\" -auto";
  119 +// echo "install\n$cmd<br/>";
  120 + $response = exec($cmd);
  121 + }
  122 +
  123 + function uninstall() {
  124 + $cmd = "sc delete {$this->name}";
  125 +// echo "uninstall\n$cmd<br/>";
  126 + $response = exec($cmd);
  127 + }
  128 +}
  129 +$lucene = new Lucene();
  130 +$lucene->load();
  131 +$lucene->install();
  132 +$lucene->start();
  133 +$lucene->stop();
  134 +$lucene->uninstall();
  135 +?>
0 136 \ No newline at end of file
... ...