File: autosetup.patch

package info (click to toggle)
textpattern 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,888 kB
  • ctags: 4,970
  • sloc: php: 27,609; sh: 175; makefile: 20
file content (93 lines) | stat: -rw-r--r-- 2,733 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Patch setup procedure to take into consideration the fact that the
database is created empty by dbconfig-common.

diff --git a/textpattern/setup/index.php b/textpattern/setup/index.php
index efcb9aa..2e7c462 100644
--- a/textpattern/setup/index.php
+++ b/textpattern/setup/index.php
@@ -104,13 +104,6 @@ eod;
 			@include txpath.'/config.php';
 		}
 
-		if (!empty($txpcfg['db']))
-		{
-			exit(graf(
-				gTxt('already_installed', array('{txpath}' => txpath))
-			));
-		}
-
 		if (@$_SERVER['SCRIPT_NAME'] && (@$_SERVER['SERVER_NAME'] || @$_SERVER['HTTP_HOST']))
 		{
 			$guess_siteurl = (@$_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
@@ -126,7 +119,10 @@ eod;
 		tr(
 			tda(
 			  hed(gTxt('welcome_to_textpattern'),3).
-			  graf(gTxt('need_details'),' style="margin-bottom:3em"').
+			  graf(gTxt('need_details'),' style="margin-bottom:3em"')));
+		if (empty($txpcfg['db'])) {
+			echo tr(
+					tda(
 			  hed('MySQL',3).
 			  graf(gTxt('db_must_exist'))
 			,' width="400" height="50" colspan="4" align="left"')
@@ -143,7 +139,9 @@ eod;
 			fLabelCell(gTxt('table_prefix')).fInputCell('dprefix','',5).
 			tdcs(small(gTxt('prefix_warning')),2)
 		),
-		tr(tdcs(' ',4)),
+		tr(tdcs(' ',4));
+		}
+		echo
 		tr(
 			tdcs(
 				hed(gTxt('site_url'),3).
@@ -188,12 +185,13 @@ eod;
 
 		if (!empty($txpcfg['db']))
 		{
-			exit(graf(
-				gTxt('already_installed', array(
-					'{txpath}' => txpath
-				))
-			));
+			$carry['ddb'] = $txpcfg['db'];
+			$carry['duser'] = $txpcfg['user'];
+			$carry['dpass'] = $txpcfg['pass'];
+			$carry['dhost'] = $txpcfg['host'];
+			$carry['dprefix'] = '';
 		}
+		extract($carry);
 
 		// FIXME, remove when all languages are updated with this string
 		if (!isset($GLOBALS['textarray']['prefix_bad_characters']))
@@ -253,17 +251,24 @@ eod;
 		echo graf(
 			gTxt('using_db', array('{dbname}' => strong($ddb)))
 			.' ('. $carry['dbcharset'] .')'
-		),
+		);
+		if (empty($txpcfg['db'])) {
+			echo
 		graf(
 			strong(gTxt('before_you_proceed')).', '.gTxt('create_config', array('{txpath}' => txpath))
 		),
 
 		'<textarea name="config" cols="40" rows="5" style="width: 400px; height: 200px">',
 		makeConfig($carry),
-		'</textarea>',
-		'<form action="'.$_SERVER['PHP_SELF'].'" method="post">',
-		fInput('submit','submit',gTxt('did_it'),'smallbox'),
-		sInput('getTxpLogin'),hInput('carry',postEncode($carry)),
+		'</textarea>';
+		}
+		echo
+			'<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
+		if (empty($txpcfg['db']))
+			echo
+				fInput('submit','submit',gTxt('did_it'),'smallbox');
+		else echo fInput('submit', 'submit', 'Go', 'smallbox');
+		echo sInput('getTxpLogin'),hInput('carry',postEncode($carry)),
 		'</form>';
 	}