/**
  * Checks if the current user has permission to deploy.
  *
  * Right now, only who has commit access to the staging repository will have this right.
  * This method WON'T work properly when the production theme is loading, so it should only be used on staging.
  *
  * @return bool
  */
 public function user_can_deploy()
 {
     if ($permission = wp_cache_get(get_current_user_id() . '_can_deploy', 'vip-staging')) {
         return apply_filters('vip_staging_can_deploy', $permission);
     }
     // Load the SVN utils functions
     if (!function_exists('svn_get_user_themes')) {
         require_once ABSPATH . 'bin/includes/svn-utils.php';
     }
     $current_user = wp_get_current_user();
     $svn_themes = svn_get_user_themes($current_user->user_login, 'vip');
     $stylesheet = str_replace('vip/', '', get_stylesheet());
     // Check if user has write access to the child theme.
     $has_access = isset($svn_themes[$stylesheet]) && 'rw' == $svn_themes[$stylesheet] || is_automattician();
     wp_cache_set(get_current_user_id() . '_can_deploy', $has_access, 'vip-staging', 5 * MINUTE_IN_SECONDS);
     return apply_filters('vip_staging_can_deploy', $has_access);
 }
/**
 * Is the current user an Automattician, authenticated via the Automattic proxy.
 *
 * Determine if the current request is made via the Automattic proxy,
 * which is only available to Automatticians, AND if the current user
 * is an Automattician.
 *
 * @see is_automattician
 *
 * @return bool True, if the current request is made via the Automattic proxy
 */
function is_proxied_automattician()
{
    return A8C_PROXIED_REQUEST && is_automattician();
}
<?php

// For backwards compatibility - always true. Will have a helper for determining
// the current environment
// @todo This needs to be set on VIP env only, and set to `false` here
if (!defined('WPCOM_IS_VIP_ENV')) {
    define('WPCOM_IS_VIP_ENV', false);
}
// Load our development and environment helpers
require_once __DIR__ . '/vip-helpers/vip-utils.php';
require_once __DIR__ . '/vip-helpers/vip-caching.php';
require_once __DIR__ . '/vip-helpers/vip-roles.php';
require_once __DIR__ . '/vip-helpers/vip-permastructs.php';
require_once __DIR__ . '/vip-helpers/vip-mods.php';
require_once __DIR__ . '/vip-helpers/vip-media.php';
require_once __DIR__ . '/vip-helpers/vip-elasticsearch.php';
require_once __DIR__ . '/vip-helpers/vip-stats.php';
require_once __DIR__ . '/vip-helpers/vip-deprecated.php';
// Load WP_CLI helpers
if (defined('WP_CLI') && WP_CLI) {
    require_once __DIR__ . '/vip-helpers/vip-wp-cli.php';
}
add_action('debug_bar_enable', function ($enable) {
    $enable = is_automattician();
    return $enable;
}, 99);
do_action('vip_loaded');