@@ -352,13 +352,7 @@ private function Jetpack() {
352
352
* here, before we potentially fail out.
353
353
*/
354
354
add_filter ( 'jetpack_require_lib_dir ' , array ( $ this , 'require_lib_dir ' ) );
355
- /**
356
- * Update the main_network_site on .com
357
- */
358
- add_filter ( 'pre_option_jetpack_main_network_site ' , array ( $ this , 'jetpack_main_network_site_option ' ) );
359
- add_action ( 'update_option_siteurl ' , array ( $ this , 'update_jetpack_main_network_site_option ' ) );
360
- // Update jetpack_is_main_network on .com
361
- add_filter ( 'pre_option_jetpack_is_main_network ' , array ( $ this , 'is_main_network_option ' ) );
355
+
362
356
/*
363
357
* Load things that should only be in Network Admin.
364
358
*
@@ -385,11 +379,22 @@ private function Jetpack() {
385
379
'siteurl ' ,
386
380
'blogname ' ,
387
381
'gmt_offset ' ,
388
- 'timezone_string ' ,
389
- 'jetpack_main_network_site ' ,
390
- 'jetpack_is_main_network '
382
+ 'timezone_string '
391
383
);
392
384
385
+ /**
386
+ * Sometimes you want to sync data to .com without adding options to .org sites.
387
+ * The mock option allows you to do just that.
388
+ */
389
+ $ this ->sync ->mock_option ( 'is_main_network ' , array ( $ this , 'is_main_network_option ' ) );
390
+ $ this ->sync ->mock_option ( 'main_network_site ' , array ( $ this , 'jetpack_main_network_site_option ' ) );
391
+
392
+ /**
393
+ * Trigger an update to the main_network_site when we update the blogname of a site.
394
+ *
395
+ */
396
+ add_action ( 'update_option_blogname ' , array ( $ this , 'update_jetpack_main_network_site_option ' ) );
397
+
393
398
add_action ( 'update_option ' , array ( $ this , 'log_settings_change ' ), 10 , 3 );
394
399
395
400
if ( defined ( 'XMLRPC_REQUEST ' ) && XMLRPC_REQUEST && isset ( $ _GET ['for ' ] ) && 'jetpack ' == $ _GET ['for ' ] ) {
@@ -645,7 +650,7 @@ function require_lib_dir( $lib_dir ) {
645
650
* @param bool $option
646
651
* @return string
647
652
*/
648
- function jetpack_main_network_site_option ( $ option ) {
653
+ public function jetpack_main_network_site_option ( $ option ) {
649
654
return network_site_url ();
650
655
}
651
656
@@ -659,7 +664,7 @@ function jetpack_main_network_site_option( $option ) {
659
664
*
660
665
* @return boolean
661
666
*/
662
- public static function is_main_network_option ( $ option ) {
667
+ public function is_main_network_option ( $ option ) {
663
668
// return '1' or ''
664
669
return (string ) (bool ) Jetpack::is_multi_network ();
665
670
}
@@ -692,7 +697,7 @@ public static function is_multi_network() {
692
697
* @return null
693
698
*/
694
699
function update_jetpack_main_network_site_option () {
695
- do_action ( 'add_option_jetpack_main_network_site ' , 'main_network_site ' , network_site_url () );
700
+ do_action ( 'add_option_jetpack_main_network_site ' , 'jetpack_main_network_site ' , network_site_url () );
696
701
do_action ( 'add_option_jetpack_is_main_network ' , 'jetpack_is_main_network ' , (string ) (bool ) Jetpack::is_multi_network () );
697
702
}
698
703
0 commit comments