From: Steve Sutton Date: Fri, 17 Feb 2017 16:29:35 +0000 (-0500) Subject: Update Sample Script with new question for setting dbPrefix X-Git-Tag: v1.0.1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=2a28605d47b56d7bd30551ce95dceff7ecdd7477;p=WP-Plugins%2Fglm-member-db-sample.git Update Sample Script with new question for setting dbPrefix The database prefix was being set with the camelCase one. Adding new question to get the user to enter in a database prefix with example of one that matches the other db prefixes for the other plugins. --- diff --git a/SETUP_SCRIPT b/SETUP_SCRIPT index c9311ec..c2d159e 100755 --- a/SETUP_SCRIPT +++ b/SETUP_SCRIPT @@ -23,9 +23,9 @@ fi slugString=$THISDIR :' - + Strings that are replaced - + Replaceable String Example of text that might go here ----------------------- --------------------------------------------------------------- {descrName} Gaslight Media Members Database Sample Add-On Plugin @@ -35,7 +35,7 @@ slugString=$THISDIR {definedPrefix} GLM_MEMBERS_SAMPLE {camelcasePrefix} glmMembersSample Also use for database prefix {databaseEnable} (Used to enable database tables by removing comment slashes) - + ' okToProceed="" @@ -59,26 +59,28 @@ New GLM Associate Add-On Setup ------------------------------ " read -e -i "$slugString" -p "Slug string.................(eg glm-member-db-sample)....................: " slugString - read -e -i "$descrName" -p "Descriptive name............(eg Gaslight Media Members Database Sample)..: " descrName + read -e -i "$descrName" -p "Descriptive name............(eg GLM Members Database Sample).............: " descrName read -e -i "$shortName" -p "Short name..................(eg Sample)..................................: " shortName read -e -i "$descrString" -p "Description.................(eg This is a sample add-on.)................: " descrString read -e -i "$definedPrefix" -p "Defined param prefix........(eg GLM_MEMBERS_SAMPLE)......................: " definedPrefix read -e -i "$camelcasePrefix" -p "CamelCase prefix............(eg glmMembersSample)........................: " camelcasePrefix + read -e -i "$dbPrefix" -p "Database prefix.............(eg glm_membersSample_)......................: " dbPrefix read -e -i "$databaseEnable" -p "Enable Add-On DB tables.....(Yes/No).....................................: " databaseEnable done - + echo " Slug string........................: $slugString - Descriptive name...................: $descrName + Descriptive name...................: $descrName Short name.........................: $shortName Description........................: $descrString Defined param prefix...............: $definedPrefix CamelCase prefix...................: $camelcasePrefix + Database prefix....................: $dbPrefix Add-on will have Database tables...: $databaseEnable - + " read -p "Is this all OK? (Yes/No): " okToProceed - + if [ "$slugString" != "$THISDIR" ] ; then echo read -p "The slug string does not match the name of this directory. Are you sure you want to continue? (Yes/No): " okToProceed @@ -93,7 +95,7 @@ Running setup script with the above parameters if [ -d ".git" ] ; then echo "Git directory exists, removing to disconnect from repository ..." rm -Rf .git -else +else echo "No Git directory detected ..." fi @@ -115,6 +117,9 @@ find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) echo "Replace {camelcasePrefix} ..." find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{camelcasePrefix}/$camelcasePrefix/g" {} \; +echo "Replace {dbPrefix} ..." +find . \( -name '*.phtml' -o -name '*.php' -o -name '*.inc' -o -name '*.txt' \) -exec sed -i "s/{dbPrefix}/$dbPrefix/g" {} \; + # If add-on is contributing database tables if [ "$databaseEnable" = "Yes" ] ; then echo "Enabling database support for this add-on ..." diff --git a/defines.php b/defines.php index b7d73e8..79ebe50 100644 --- a/defines.php +++ b/defines.php @@ -13,7 +13,7 @@ define('{definedPrefix}_PLUGIN_SLUG', '{slugString}'); // Database table prefixes - change if using add-on tables global $wpdb; -define('{definedPrefix}_PLUGIN_DB_PREFIX', $wpdb->prefix.'{camelcasePrefix}'); +define('{definedPrefix}_PLUGIN_DB_PREFIX', $wpdb->prefix.'{dbPrefix}'); define('{definedPrefix}_PLUGIN_ACTIVE_DB_OPTION', '{camelcasePrefix}DbVersion'); // Determine which system we're running on - If not provided, assume PRODUCTION