Detecting Access When the Generator Creates Artifacts

When creating artifacts, Shifter Static accesses your site using the User-Agent ShifterGenerator/{version}. By using this User-Agent, you can detect whether WordPress is running or whether Shifter is generating an artifact.

For example, in a PHP script, you can set up a function to check whether $_SERVER[‘HTTP_USER_AGENT’] contains the User-Agent mentioned above.

PHP Code Example

if ( isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'ShifterGenerator') !== false ) {

    // some processing
    // Shifter is generating the artifact

} else {

    // some processing
    // Shifter is not generating the artifact

}