Skip to content

Commit fd6b826

Browse files
committed
Move fulltext check earlier
Signed-off-by: Shawn Bulen <bulens@pacbell.net>
1 parent b27da1b commit fd6b826

5 files changed

Lines changed: 113 additions & 56 deletions

File tree

Themes/default/css/install.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ul.steps_list .stepcurrent ~ li {
9191
color: #d05800;
9292
}
9393
.panel form div {
94-
max-height: 560px;
94+
height: auto;
9595
}
9696
.panel p, .panel h3, .panel ul {
9797
margin: 0 0 1em 0;

Themes/default/languages/Install.english.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@
293293

294294
$txt['upgrade_completed_table'] = 'Completed Table:';
295295
$txt['upgrade_current_table'] = 'Current Table:';
296-
$txt['upgrade_fulltext'] = 'Please note that your fulltext index was dropped to facilitate the conversion and will need to be recreated in the admin area after the upgrade is complete.';
297296
$txt['upgrade_conversion_proceed'] = 'Conversion Complete! Click Continue to Proceed.';
298297
$txt['upgrade_convert_datajson'] = 'Converting data from serialize to JSON...';
299298
$txt['upgrade_json_completed'] = 'Convert to JSON Complete! Click Continue to Proceed.';

other/upgrade.php

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,51 +3052,6 @@ function ConvertUtf8()
30523052
list($upcontext['database_charset']) = explode('_', $column_info['Collation']);
30533053
$upcontext['database_charset'] = in_array($upcontext['database_charset'], $charsets) ? array_search($upcontext['database_charset'], $charsets) : $upcontext['database_charset'];
30543054

3055-
// Detect whether a fulltext index is set.
3056-
$request = $smcFunc['db_query']('', '
3057-
SHOW INDEX
3058-
FROM {db_prefix}messages',
3059-
array(
3060-
)
3061-
);
3062-
3063-
$upcontext['dropping_index'] = false;
3064-
3065-
// If there's a fulltext index, we need to drop it first...
3066-
if ($request !== false || $smcFunc['db_num_rows']($request) != 0)
3067-
{
3068-
while ($row = $smcFunc['db_fetch_assoc']($request))
3069-
if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT'))
3070-
$upcontext['fulltext_index'][] = $row['Key_name'];
3071-
$smcFunc['db_free_result']($request);
3072-
3073-
if (isset($upcontext['fulltext_index']))
3074-
$upcontext['fulltext_index'] = array_unique($upcontext['fulltext_index']);
3075-
}
3076-
3077-
// Drop it and make a note...
3078-
if (!empty($upcontext['fulltext_index']))
3079-
{
3080-
$upcontext['dropping_index'] = true;
3081-
3082-
$smcFunc['db_query']('', '
3083-
ALTER TABLE {db_prefix}messages
3084-
DROP INDEX ' . implode(',
3085-
DROP INDEX ', $upcontext['fulltext_index']),
3086-
array(
3087-
'db_error_skip' => true,
3088-
)
3089-
);
3090-
3091-
// Update the settings table
3092-
$smcFunc['db_insert']('replace',
3093-
'{db_prefix}settings',
3094-
array('variable' => 'string', 'value' => 'string'),
3095-
array('db_search_index', ''),
3096-
array('variable')
3097-
);
3098-
}
3099-
31003055
// Figure out what charset we should be converting from...
31013056
$lang_charsets = array(
31023057
'arabic' => 'windows-1256',
@@ -3470,7 +3425,7 @@ function ConvertUtf8()
34703425
}
34713426
$smcFunc['db_free_result']($request);
34723427

3473-
if ($upcontext['dropping_index'] && $command_line)
3428+
if (!empty($_SESSION['dropping_index']) && $command_line)
34743429
{
34753430
echo "\n" . '', $txt['upgrade_fulltext_error'], '';
34763431
flush();
@@ -4905,11 +4860,6 @@ function template_convert_utf8()
49054860
', $txt['upgrade_current_table'], ' &quot;<span id="current_table">', $upcontext['cur_table_name'], '</span>&quot;
49064861
</h3>';
49074862

4908-
// If we dropped their index, let's let them know
4909-
if ($upcontext['dropping_index'])
4910-
echo '
4911-
<p id="indexmsg" class="', $upcontext['cur_table_num'] == $upcontext['table_count'] ? 'inline_block' : 'hidden', '>', $txt['upgrade_fulltext'], '</p>';
4912-
49134863
// Completion notification
49144864
echo '
49154865
<p id="commess" class="', $upcontext['cur_table_num'] == $upcontext['table_count'] ? 'inline_block' : 'hidden', '">', $txt['upgrade_conversion_proceed'], '</p>';
@@ -4957,9 +4907,6 @@ function onConversionUpdate(oXMLDoc)
49574907
if (iTableNum == ', $upcontext['table_count'], ')
49584908
{
49594909
document.getElementById(\'commess\').classList.remove(\'hidden\');
4960-
if (document.getElementById(\'indexmsg\') != null) {
4961-
document.getElementById(\'indexmsg\').classList.remove(\'hidden\');
4962-
}
49634910
document.getElementById(\'current_tab\').classList.add(\'hidden\');
49644911
document.getElementById(\'contbutt\').disabled = 0;
49654912
document.getElementById(\'utf8_done\').value = 1;
@@ -5123,6 +5070,11 @@ function doTheDelete(theCheck)
51235070
', $txt['upgrade_luck'], '<br>
51245071
Simple Machines
51255072
</p>';
5073+
5074+
// If we dropped their index, let's let them know
5075+
if (!empty($_SESSION['dropping_index']))
5076+
echo '
5077+
<p id="indexmsg">', $txt['upgrade_fulltext_error'], '</p>';
51265078
}
51275079

51285080
/**

other/upgrade_2-1_mysql.sql

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,59 @@ if (!empty($upcontext['empty_error']))
105105
---}
106106
---#
107107

108+
/******************************************************************************/
109+
--- Checking for fulltext index
110+
/******************************************************************************/
111+
112+
---# If index exists drop it and make a note
113+
---{
114+
// Detect whether a fulltext index is set.
115+
$request = $smcFunc['db_query']('', '
116+
SHOW INDEX
117+
FROM {db_prefix}messages',
118+
array(
119+
)
120+
);
121+
122+
$_SESSION['dropping_index'] = false;
123+
124+
// If there's a fulltext index, we need to drop it first...
125+
if ($request !== false || $smcFunc['db_num_rows']($request) != 0)
126+
{
127+
while ($row = $smcFunc['db_fetch_assoc']($request))
128+
if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT'))
129+
$upgrtmp['fulltext_index'][] = $row['Key_name'];
130+
$smcFunc['db_free_result']($request);
131+
132+
if (isset($upgrtmp['fulltext_index']))
133+
$upgrtmp['fulltext_index'] = array_unique($upgrtmp['fulltext_index']);
134+
}
135+
136+
// Drop it and make a note...
137+
if (!empty($upgrtmp['fulltext_index']))
138+
{
139+
$_SESSION['dropping_index'] = true;
140+
141+
$smcFunc['db_query']('', '
142+
ALTER TABLE {db_prefix}messages
143+
DROP INDEX ' . implode(',
144+
DROP INDEX ', $upgrtmp['fulltext_index']),
145+
array(
146+
'db_error_skip' => true,
147+
)
148+
);
149+
150+
// Update the settings table
151+
$smcFunc['db_insert']('replace',
152+
'{db_prefix}settings',
153+
array('variable' => 'string', 'value' => 'string'),
154+
array('db_search_index', ''),
155+
array('variable')
156+
);
157+
}
158+
---}
159+
---#
160+
108161
/******************************************************************************/
109162
--- Adding new settings...
110163
/******************************************************************************/

other/upgrade_2-1_postgresql.sql

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,59 @@ if (!empty($upcontext['empty_error']))
7070
---}
7171
---#
7272

73+
/******************************************************************************/
74+
--- Checking for fulltext index
75+
/******************************************************************************/
76+
77+
---# If index exists drop it and make a note
78+
---{
79+
// Detect whether a fulltext index is set.
80+
$request = $smcFunc['db_query']('', '
81+
SHOW INDEX
82+
FROM {db_prefix}messages',
83+
array(
84+
)
85+
);
86+
87+
$_SESSION['dropping_index'] = false;
88+
89+
// If there's a fulltext index, we need to drop it first...
90+
if ($request !== false || $smcFunc['db_num_rows']($request) != 0)
91+
{
92+
while ($row = $smcFunc['db_fetch_assoc']($request))
93+
if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT'))
94+
$upgrtmp['fulltext_index'][] = $row['Key_name'];
95+
$smcFunc['db_free_result']($request);
96+
97+
if (isset($upgrtmp['fulltext_index']))
98+
$upgrtmp['fulltext_index'] = array_unique($upgrtmp['fulltext_index']);
99+
}
100+
101+
// Drop it and make a note...
102+
if (!empty($upgrtmp['fulltext_index']))
103+
{
104+
$_SESSION['dropping_index'] = true;
105+
106+
$smcFunc['db_query']('', '
107+
ALTER TABLE {db_prefix}messages
108+
DROP INDEX ' . implode(',
109+
DROP INDEX ', $upgrtmp['fulltext_index']),
110+
array(
111+
'db_error_skip' => true,
112+
)
113+
);
114+
115+
// Update the settings table
116+
$smcFunc['db_insert']('replace',
117+
'{db_prefix}settings',
118+
array('variable' => 'string', 'value' => 'string'),
119+
array('db_search_index', ''),
120+
array('variable')
121+
);
122+
}
123+
---}
124+
---#
125+
73126
/******************************************************************************/
74127
--- Fixing sequences
75128
/******************************************************************************/

0 commit comments

Comments
 (0)