wp/wp-admin/includes/translation-install.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    57 		}
    57 		}
    58 
    58 
    59 		$request = wp_remote_post( $url, $options );
    59 		$request = wp_remote_post( $url, $options );
    60 
    60 
    61 		if ( $ssl && is_wp_error( $request ) ) {
    61 		if ( $ssl && is_wp_error( $request ) ) {
    62 			trigger_error(
    62 			wp_trigger_error(
       
    63 				__FUNCTION__,
    63 				sprintf(
    64 				sprintf(
    64 					/* translators: %s: Support forums URL. */
    65 					/* translators: %s: Support forums URL. */
    65 					__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    66 					__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
    66 					__( 'https://wordpress.org/support/forums/' )
    67 					__( 'https://wordpress.org/support/forums/' )
    67 				) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
    68 				) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
   235 		return false;
   236 		return false;
   236 	}
   237 	}
   237 	$translation = (object) $translation;
   238 	$translation = (object) $translation;
   238 
   239 
   239 	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   240 	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   240 	$skin              = new Automatic_Upgrader_Skin;
   241 	$skin              = new Automatic_Upgrader_Skin();
   241 	$upgrader          = new Language_Pack_Upgrader( $skin );
   242 	$upgrader          = new Language_Pack_Upgrader( $skin );
   242 	$translation->type = 'core';
   243 	$translation->type = 'core';
   243 	$result            = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
   244 	$result            = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
   244 
   245 
   245 	if ( ! $result || is_wp_error( $result ) ) {
   246 	if ( ! $result || is_wp_error( $result ) ) {
   261 	if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) {
   262 	if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) {
   262 		return false;
   263 		return false;
   263 	}
   264 	}
   264 
   265 
   265 	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   266 	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   266 	$skin     = new Automatic_Upgrader_Skin;
   267 	$skin     = new Automatic_Upgrader_Skin();
   267 	$upgrader = new Language_Pack_Upgrader( $skin );
   268 	$upgrader = new Language_Pack_Upgrader( $skin );
   268 	$upgrader->init();
   269 	$upgrader->init();
   269 
   270 
   270 	$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
   271 	$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
   271 
   272