mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-05 17:00:03 +00:00
Install: Only show the language chooser when we have access to the filesystem without asking for credentials.
fixes #29397. git-svn-id: https://develop.svn.wordpress.org/trunk@29673 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -204,9 +204,37 @@ function wp_download_language_pack( $download ) {
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$upgrader = new Language_Pack_Upgrader( $skin );
|
||||
$translation->type = 'core';
|
||||
/**
|
||||
* @todo failures (such as non-direct FS)
|
||||
*/
|
||||
$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
|
||||
|
||||
if ( ! $result || is_wp_error( $result ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $translation->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if WordPress has access to the filesystem without asking for
|
||||
* credentials.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @return bool Returns true on success, false on failure.
|
||||
*/
|
||||
function wp_can_install_language_pack() {
|
||||
if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$upgrader = new Language_Pack_Upgrader( $skin );
|
||||
|
||||
$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
|
||||
|
||||
if ( ! $check || is_wp_error( $check ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user