diff options
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php')
-rw-r--r-- | plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php | 94 |
1 files changed, 23 insertions, 71 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php index 1aaddb9a..09e95e5d 100644 --- a/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php +++ b/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-modules.php @@ -8,6 +8,8 @@ namespace Automattic\Jetpack\Sync; +use Automattic\Jetpack\Sync\Modules\Module; + /** * A class to handle loading of sync modules. */ @@ -21,56 +23,28 @@ class Modules { * @var array */ const DEFAULT_SYNC_MODULES = array( - 'Jetpack_Sync_Modules_Constants', - 'Jetpack_Sync_Modules_Callables', - 'Jetpack_Sync_Modules_Network_Options', - 'Jetpack_Sync_Modules_Options', - 'Jetpack_Sync_Modules_Terms', - 'Jetpack_Sync_Modules_Menus', - 'Jetpack_Sync_Modules_Themes', - 'Jetpack_Sync_Modules_Users', - 'Jetpack_Sync_Modules_Import', - 'Jetpack_Sync_Modules_Posts', - 'Jetpack_Sync_Modules_Protect', - 'Jetpack_Sync_Modules_Comments', - 'Jetpack_Sync_Modules_Updates', - 'Jetpack_Sync_Modules_Attachments', - 'Jetpack_Sync_Modules_Meta', - 'Jetpack_Sync_Modules_Plugins', - 'Jetpack_Sync_Modules_Stats', - 'Jetpack_Sync_Modules_Full_Sync', + 'Automattic\\Jetpack\\Sync\\Modules\\Constants', + 'Automattic\\Jetpack\\Sync\\Modules\\Callables', + 'Automattic\\Jetpack\\Sync\\Modules\\Network_Options', + 'Automattic\\Jetpack\\Sync\\Modules\\Options', + 'Automattic\\Jetpack\\Sync\\Modules\\Terms', + 'Automattic\\Jetpack\\Sync\\Modules\\Menus', + 'Automattic\\Jetpack\\Sync\\Modules\\Themes', + 'Automattic\\Jetpack\\Sync\\Modules\\Users', + 'Automattic\\Jetpack\\Sync\\Modules\\Import', + 'Automattic\\Jetpack\\Sync\\Modules\\Posts', + 'Automattic\\Jetpack\\Sync\\Modules\\Protect', + 'Automattic\\Jetpack\\Sync\\Modules\\Comments', + 'Automattic\\Jetpack\\Sync\\Modules\\Updates', + 'Automattic\\Jetpack\\Sync\\Modules\\Attachments', + 'Automattic\\Jetpack\\Sync\\Modules\\Meta', + 'Automattic\\Jetpack\\Sync\\Modules\\Plugins', + 'Automattic\\Jetpack\\Sync\\Modules\\Stats', + 'Automattic\\Jetpack\\Sync\\Modules\\Full_Sync_Immediately', 'Automattic\\Jetpack\\Sync\\Modules\\Term_Relationships', ); /** - * Maps classnames of sync modules before to v7.5 to classnames of sync modules after v7.5. - * - * @access public - * - * @var array - */ - const LEGACY_SYNC_MODULES_MAP = array( - 'Jetpack_Sync_Modules_Constants' => 'Automattic\\Jetpack\\Sync\\Modules\\Constants', - 'Jetpack_Sync_Modules_Callables' => 'Automattic\\Jetpack\\Sync\\Modules\\Callables', - 'Jetpack_Sync_Modules_Network_Options' => 'Automattic\\Jetpack\\Sync\\Modules\\Network_Options', - 'Jetpack_Sync_Modules_Options' => 'Automattic\\Jetpack\\Sync\\Modules\\Options', - 'Jetpack_Sync_Modules_Terms' => 'Automattic\\Jetpack\\Sync\\Modules\\Terms', - 'Jetpack_Sync_Modules_Menus' => 'Automattic\\Jetpack\\Sync\\Modules\\Menus', - 'Jetpack_Sync_Modules_Themes' => 'Automattic\\Jetpack\\Sync\\Modules\\Themes', - 'Jetpack_Sync_Modules_Users' => 'Automattic\\Jetpack\\Sync\\Modules\\Users', - 'Jetpack_Sync_Modules_Import' => 'Automattic\\Jetpack\\Sync\\Modules\\Import', - 'Jetpack_Sync_Modules_Posts' => 'Automattic\\Jetpack\\Sync\\Modules\\Posts', - 'Jetpack_Sync_Modules_Protect' => 'Automattic\\Jetpack\\Sync\\Modules\\Protect', - 'Jetpack_Sync_Modules_Comments' => 'Automattic\\Jetpack\\Sync\\Modules\\Comments', - 'Jetpack_Sync_Modules_Updates' => 'Automattic\\Jetpack\\Sync\\Modules\\Updates', - 'Jetpack_Sync_Modules_Attachments' => 'Automattic\\Jetpack\\Sync\\Modules\\Attachments', - 'Jetpack_Sync_Modules_Meta' => 'Automattic\\Jetpack\\Sync\\Modules\\Meta', - 'Jetpack_Sync_Modules_Plugins' => 'Automattic\\Jetpack\\Sync\\Modules\\Plugins', - 'Jetpack_Sync_Modules_Stats' => 'Automattic\\Jetpack\\Sync\\Modules\\Stats', - 'Jetpack_Sync_Modules_Full_Sync' => 'Automattic\\Jetpack\\Sync\\Modules\\Full_Sync', - ); - - /** * Keeps track of initialized sync modules. * * @access private @@ -86,7 +60,7 @@ class Modules { * @access public * @static * - * @return array|null + * @return Module[] */ public static function get_modules() { if ( null === self::$initialized_modules ) { @@ -146,11 +120,9 @@ class Modules { */ $modules = apply_filters( 'jetpack_sync_modules', self::DEFAULT_SYNC_MODULES ); - $modules = array_map( array( 'Automattic\\Jetpack\\Sync\\Modules', 'map_legacy_modules' ), $modules ); + $modules = array_map( array( __CLASS__, 'load_module' ), $modules ); - $modules = array_map( array( 'Automattic\\Jetpack\\Sync\\Modules', 'load_module' ), $modules ); - - return array_map( array( 'Automattic\\Jetpack\\Sync\\Modules', 'set_module_defaults' ), $modules ); + return array_map( array( __CLASS__, 'set_module_defaults' ), $modules ); } /** @@ -168,25 +140,6 @@ class Modules { } /** - * For backwards compat, takes the classname of a given module pre Jetpack 7.5, - * and returns the new namespaced classname. - * - * @access public - * @static - * - * @param string $module_class The classname of a Jetpack sync module. - * - * @return string - */ - public static function map_legacy_modules( $module_class ) { - $legacy_map = self::LEGACY_SYNC_MODULES_MAP; - if ( isset( $legacy_map[ $module_class ] ) ) { - return $legacy_map[ $module_class ]; - } - return $module_class; - } - - /** * Sets defaults for the given instance of a Jetpack sync module. * * @access public @@ -203,5 +156,4 @@ class Modules { } return $module; } - } |