/srv/www/jetty/current/content/plugins/jetty-core/src/GlobalDatabase/DynamoDBConnection.php
{
$response = \Jetty\GlobalDatabase::getItem(
$this->getTableName(),
[
'host' => [
'S' => $this->getHostName()
]
]
);
}
catch ( \Exception $exception )
{
LoggerManager::GetGeneralLogger()->addCritical(
'Unable to successfully connect to DynamoDB.',
[ 'exception' => $exception ]
);
die();
}
$this->siteData = $response[ 'Item' ];
}
/** Create Singleton instance of a DynamoDBConnection */
public static function getInstance(): DynamoDBConnection
{
if ( ! self::$instance )
{
self::$instance = new DynamoDBConnection();
}
return self::$instance;
}
/**
* Returns the DynamoDB value for this Site stored in 'dbname' - currently used for historical purposes
* TODO refactor after the whole update to getDBName, using 'DB_NAME' as the key
*
* @return string The name of the database that Wordpress should use for this Site
/srv/www/jetty/current/content/plugins/jetty-core/src/GlobalDatabase/DynamoDBConnection.php
}
catch ( \Exception $exception )
{
LoggerManager::GetGeneralLogger()->addCritical(
'Unable to successfully connect to DynamoDB.',
[ 'exception' => $exception ]
);
die();
}
$this->siteData = $response[ 'Item' ];
}
/** Create Singleton instance of a DynamoDBConnection */
public static function getInstance(): DynamoDBConnection
{
if ( ! self::$instance )
{
self::$instance = new DynamoDBConnection();
}
return self::$instance;
}
/**
* Returns the DynamoDB value for this Site stored in 'dbname' - currently used for historical purposes
* TODO refactor after the whole update to getDBName, using 'DB_NAME' as the key
*
* @return string The name of the database that Wordpress should use for this Site
*/
public function getdbname(): string
{
return $this->getKeyString( 'dbname' );
}
/**
* Returns the DynamoDB value for this Site stored in 'DB_PASSWORD'
/srv/www/jetty/current/content/plugins/jetty-core/src/GlobalDatabase/DynamoDBUpdateRouter.php
use Jetty\Core\Routers\Router;
use Jetty\Logs\LoggerManager;
/** Allows each site to add additional values to its DynamoDB entry, using the DynamoDB 'host' value as key */
class DynamoDBUpdateRouter extends Router {
/** @var DynamoDBConnection $dynamoDBConnection The Singleton Connection instance */
private $dynamoDBConnection;
/**
* Set the DynamoDBConnection in the constructor for shared functionality within this class.
*/
public function __construct()
{
$this->dynamoDBConnection = DynamoDBConnection::getInstance();
}
protected function addGlobalHandlers()
{
add_action( 'init', function ()
{
// Bail if DynamoDB already has values for the wordpress constants added - and if they're not empty strings
if ( ! $this->dynamoDBConnection->isDynamoDBUpdated() )
{
$this->updateDynamoDBTable();
}
} );
}
/**
* Does the work of updating the DynamoDB table used to determine which database to access for a given site
/srv/www/jetty/current/content/plugins/jetty-core/src/Core/CoreRouter.php
class CoreRouter extends Router
{
public function __construct(
IRequestInfo $requestInfo,
private UsersRouter $usersRouter,
private PermissionRouter $permissionRouter,
)
{
parent::__construct($requestInfo);
}
protected function addGlobalHandlers() : void
{
$this->usersRouter->start();
( new EmailRouter() )->start();
( new PostStatusRouter() )->start();
( new UserRoleRouter() )->start();
$this->permissionRouter->start();
( new GravityFormsRouter() )->start();
( new DynamoDBUpdateRouter() )->start();
}
}
/srv/www/jetty/current/vendor/jetty-libraries/core/src/Router/Router.php
namespace Jetty\Core\Router;
use Jetty\Core\Request\Port\Out\IRequestInfo;
/**
* A basic router class.
*/
abstract class Router
{
public function __construct(
private IRequestInfo $requestInfo
) {
}
/**
* Start the router
*/
final public function start(): void
{
$this->addGlobalHandlers();
if ($this->requestInfo->isAdmin())
{
$this->addAdminHandlers();
if ($this->requestInfo->isNetworkAdmin())
{
$this->addNetworkAdminHandlers();
}
}
else
{
$this->addPublicHandlers();
}
}
/**
* Handlers that will be run on every request.
*/
protected function addGlobalHandlers(): void
{
/srv/www/jetty/current/content/plugins/jetty-core/src/jetty-core.php
DependencyManager::getInstance()->get(UsersRouter::class)->start();
require_once __DIR__ . '/UserManager/init.php';
\Jetty\Libraries::Initialize();
/*----------------------------------------------------------------------------*
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------*/
/**
* Global
*/
// Disable the WordPress admin email confirmation dialog
add_filter( 'admin_email_check_interval', static fn() => false);
// Start global routers
DependencyManager::getInstance()->get(JettyCoreUpdateRouter::class)->start();
DependencyManager::getInstance()->get(MigrationRouter::class)->start();
DependencyManager::getInstance()->get(CoreRouter::class)->start();
DependencyManager::getInstance()->get(DomainsRouter::class)->start();
(new \Jetty\Ajax\JettyAjaxRouter())->start();
(new \Jetty\AssetClasses\AssetClassesRouter())->start();
DependencyManager::getInstance()->get(AccountControlRouter::class)->start();
DependencyManager::getInstance()->get(BulkEmailRouter::class)->start();
(new \Jetty\Forms\GravityFormsRouter())->start();
(new Jetty\Network\NetworkRouter())->start();
DependencyManager::getInstance()->get(SubscriptionsRouter::class)->start();
(new Jetty\Posts\PostRouter())->start();
(new Jetty\Webhooks\WebhooksRouter())->start();
(new \Jetty\UI\UiRouter())->start();
DependencyManager::getInstance()->get(AdminRouter::class)->start();
DependencyManager::getInstance()->get(MultiSiteCloneDuplicatorRouter::class)->start();
DependencyManager::getInstance()->get(LoginRouter::class)->start();
DependencyManager::getInstance()->get(SessionRouter::class)->start();
/**
* Public-only
*/
if (!is_admin())
/srv/www/jetty/current/content/plugins/jetty-core/jetty-core.php
/**
* @package Jetty_Core
*
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Jetty Core
* Plugin URI: http://jettyapp.com
* Description: Foundational minimal viable product for the Jetty platform, on which other Jetty plugins depend and are built
* Version: 5.7.30
* Author URI: http://jettyapp.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
* Dependencies: disable-wordpress-updates, folders, gravityforms, gravityformsuserregistration, jetty-crm, jetty-ui, jetty-password-policy-manager, jetty-user-manager, wp-nested-pages, wp-security-audit-log-premium
*/
// Include the Jetty Core bootstrap loader for this plugin
require_once __DIR__ . '/src/jetty-core.php';
// Register Jetty Core activation hooks
register_activation_hook( __FILE__, static function( bool $networkWide ): void {
require_once __DIR__ . '/src/public/class-jetty-core.php';
Jetty_Core::get_instance()->activate( $networkWide );
});
register_deactivation_hook( __FILE__, static function( bool $networkWide ): void {
require_once __DIR__ . '/src/public/class-jetty-core.php';
Jetty_Core::get_instance()->deactivate( $networkWide );
});
/srv/www/jetty/current/public/wp-settings.php
$mu_plugin = $_wp_plugin_file; // Avoid stomping of the $mu_plugin variable in a plugin.
/**
* Fires once a single must-use plugin has loaded.
*
* @since 5.1.0
*
* @param string $mu_plugin Full path to the plugin's main file.
*/
do_action( 'mu_plugin_loaded', $mu_plugin );
}
unset( $mu_plugin, $_wp_plugin_file );
// Load network activated plugins.
if ( is_multisite() ) {
foreach ( wp_get_active_network_plugins() as $network_plugin ) {
wp_register_plugin_realpath( $network_plugin );
$_wp_plugin_file = $network_plugin;
include_once $network_plugin;
$network_plugin = $_wp_plugin_file; // Avoid stomping of the $network_plugin variable in a plugin.
/**
* Fires once a single network-activated plugin has loaded.
*
* @since 5.1.0
*
* @param string $network_plugin Full path to the plugin's main file.
*/
do_action( 'network_plugin_loaded', $network_plugin );
}
unset( $network_plugin, $_wp_plugin_file );
}
/**
* Fires once all must-use and network-activated plugins have loaded.
*
* @since 2.8.0
*/
do_action( 'muplugins_loaded' );
/srv/www/jetty/current/wp-config.php
<?php
require __DIR__ . '/config/app.php';
require_once ABSPATH . 'wp-settings.php';
/srv/www/jetty/current/public/wp-load.php
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
}
/*
* If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
* doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
* of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
* and /blog/ is WordPress(b).
*
* If neither set of conditions is true, initiate loading the setup process.
*/
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
/** The config file resides in ABSPATH */
require_once ABSPATH . 'wp-config.php';
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
/** The config file resides one level above ABSPATH but is not part of another installation */
require_once dirname( ABSPATH ) . '/wp-config.php';
} else {
// A config file doesn't exist.
define( 'WPINC', 'wp-includes' );
require_once ABSPATH . WPINC . '/load.php';
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
require_once ABSPATH . WPINC . '/functions.php';
$path = wp_guess_url() . '/wp-admin/setup-config.php';
/*
* We're going to redirect to setup-config.php. While this shouldn't result
* in an infinite loop, that's a silly thing to assume, don't you think? If
* we're traveling in circles, our last-ditch effort is "Need more help?"
*/
/srv/www/jetty/current/public/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
/srv/www/jetty/current/public/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';