Observed: [INFO] Database: khoipro (prefix: ;) — TABLE_PREFIX is being parsed as a literal semicolon.
Root cause
TABLE_PREFIX=$(grep '^\$table_prefix' "$SRC_PATH/wp-config.php" \
| sed "s/.*'//; s/'.*//" || echo "wp_")
For a normal line $table_prefix = 'wp_';, the first sed s/.*'// is greedy — .*' matches the longest string ending in ', which is everything up through the closing quote. So output becomes ;. The second sed has nothing to match.
Effect
Step 6 (URL update) builds the query as SELECT option_value FROM ${TABLE_PREFIX}options ... → ;options. mysql errors silently (stderr suppressed), CURRENT_URL stays empty, the search-replace fallback also fails (uses the same prefix). User sees Updating site URL log line but the DB never changes.
Fix
Use awk -F"'" '/^\$table_prefix[[:space:]]*=/ {print $2; exit}'. Plus validate the result is non-empty and matches [A-Za-z0-9_]+ to avoid SQL injection in the step-6 queries.
Observed:
[INFO] Database: khoipro (prefix: ;)— TABLE_PREFIX is being parsed as a literal semicolon.Root cause
For a normal line
$table_prefix = 'wp_';, the first seds/.*'//is greedy —.*'matches the longest string ending in', which is everything up through the closing quote. So output becomes;. The second sed has nothing to match.Effect
Step 6 (URL update) builds the query as
SELECT option_value FROM ${TABLE_PREFIX}options ...→;options. mysql errors silently (stderr suppressed), CURRENT_URL stays empty, the search-replace fallback also fails (uses the same prefix). User seesUpdating site URLlog line but the DB never changes.Fix
Use
awk -F"'" '/^\$table_prefix[[:space:]]*=/ {print $2; exit}'. Plus validate the result is non-empty and matches[A-Za-z0-9_]+to avoid SQL injection in the step-6 queries.