Filter Hook: wpcd_script_file_contents
apply_filters( 'wpcd_script_file_contents', $script_name )
This filter hook can be used to do two things:
- Change the contents of the wrapper commands sent to a server
- Change the script that a server will load to do a certain task.
The wrapper command scripts look similar to this:
sudo -i -E cd /root && sudo -E rm -f ##SCRIPT_NAME## && sudo -E wget --no-check-certificate -O ##SCRIPT_NAME## ##SCRIPT_URL## && export action=##ACTION## domain=##DOMAIN## user=##BASIC_AUTH_USER## pass=##BASIC_AUTH_PASS## && sudo -E dos2unix ##SCRIPT_NAME## && sudo -E bash ##SCRIPT_NAME##
You can use this filter to point to a file in a different folder that contains a variant of this script. For example, you can add additional commands to be executed after ##SCRIPT_NAME## executes on the server.
sudo -i -E cd /root && sudo -E rm -f ##SCRIPT_NAME## && sudo -E wget --no-check-certificate -O ##SCRIPT_NAME## ##SCRIPT_URL## && export action=##ACTION## domain=##DOMAIN## user=##BASIC_AUTH_USER## pass=##BASIC_AUTH_PASS## && sudo -E dos2unix ##SCRIPT_NAME## && sudo -E bash ##SCRIPT_NAME## sudo -E mycustomcommand
About ##SCRIPT_URL##
##SCRIPT_URL## is the pointer to the file that does all the real work on the server. When you ask for WordPress to be installed, the filename pointed to by ##SCRIPT_URL## is loaded up from the server where WPCD is running to the server where WordPress needs to be installed.
To override this you can replace ##SCRIPT_URL## with a hard-coded pointer to your own version of the same file.
For example, you can hardcode ##SCRIPT_URL## to something like /html/mywpcdserver/custom_file.txt so that your script is the one that is always executing instead of our script. The only restriction is that your custom_file.txt must have .txt extension AND it must be accessible via a remote wget() command.
sudo -i -E cd /root && sudo -E rm -f ##SCRIPT_NAME## && sudo -E wget --no-check-certificate -O ##SCRIPT_NAME## /html/mywpcdserver/custom_file.txt && export action=##ACTION## domain=##DOMAIN## user=##BASIC_AUTH_USER## pass=##BASIC_AUTH_PASS## && sudo -E dos2unix ##SCRIPT_NAME## && sudo -E bash ##SCRIPT_NAME##
More Topics In Dev Notes
-
Filter Hook: wpcd_wpapp_show_install_wp_button -
Filter Hook: wpcd_wpapp_show_install_wp_link -
Filter Hook: wpcd_settings_help_tab_text -
Filter Hook: wpcd_settings_welcome_text_initial -
Filter Hook: wpcd_settings_welcome_text -
Filter Hook: wpcd_settings_deploy_first_wp_site_text -
Custom Post Types Used By WPCD -
Action Hook: wpcd_server_wordpress-app_server_created -
Action Hook: wpcd_server_wordpress-app_prepare_server_command_done -
Action Hook: wpcd_command_wordpress-app_completed -
Action Hook: wpcd_command_wordpress-app_prepare_server_completed -
Filter Hook: wpcd_wordpress-app_initial_server_attributes -
Filter Hook: wpcd_wordpress-app_create_popup -
Filter Hook: wpcd_wordpress-app_install_app_popup -
Filter Hook: wpcd_wordpress-app_initial_server_attributes_wc -
Filter Hook: wpcd_wordpress-app_install_wp_app_parms -
Action Hook: wpcd_command_wordpress-app_completed_after_cleanup