More upload path tweaks. fixes #2271
git-svn-id: http://svn.automattic.com/wordpress/trunk@3437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
150fb02aa0
commit
db03553bf2
|
@ -17,7 +17,7 @@ include('admin-header.php');
|
|||
<table class="editform optiontable">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Store uploads in this folder'); ?>:</th>
|
||||
<td><input name="fileupload_realpath" type="text" id="fileupload_realpath" class="code" value="<?php echo str_replace(ABSPATH, '', get_settings('fileupload_realpath')); ?>" size="40" />
|
||||
<td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo str_replace(ABSPATH, '', get_settings('upload_path')); ?>" size="40" />
|
||||
<br />
|
||||
<?php _e('Default is <code>wp-content/uploads</code>'); ?>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@ include('admin-header.php');
|
|||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,fileupload_realpath" />
|
||||
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> »" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -220,11 +220,16 @@ function populate_options() {
|
|||
add_option('default_role', 'subscriber');
|
||||
add_option('rich_editing', 'true');
|
||||
add_option('db_version', $wp_db_version);
|
||||
// 2.1
|
||||
add_option('uploads_use_yearmonth_folders', 1);
|
||||
add_option('fileupload_realpath', ABSPATH . 'wp-content/uploads');
|
||||
add_option('fileupload_url', ''); //if this is empty it will be obtained from fileupload_realpath
|
||||
|
||||
// 2.0.1
|
||||
if ( ini_get('safe_mode') ) {
|
||||
// Safe mode screws up mkdir(), so we must use a flat structure.
|
||||
add_option('uploads_use_yearmonth_folders', 0);
|
||||
add_option('upload_path', 'wp-content');
|
||||
} else {
|
||||
add_option('uploads_use_yearmonth_folders', 1);
|
||||
add_option('upload_path', 'wp-content/uploads');
|
||||
}
|
||||
|
||||
// Delete unused options
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog');
|
||||
foreach ($unusedoptions as $option) :
|
||||
|
|
|
@ -878,22 +878,20 @@ function wp_mkdir_p($target) {
|
|||
function wp_upload_dir() {
|
||||
$siteurl = get_settings('siteurl');
|
||||
//prepend ABSPATH to $dir and $siteurl to $url if they're not already there
|
||||
$dir = ABSPATH . str_replace(ABSPATH, '', trim(get_settings('fileupload_realpath')));
|
||||
$url = $siteurl . str_replace($siteurl, '', trim(get_settings('fileupload_url')));
|
||||
$path = str_replace(ABSPATH, '', trim(get_settings('upload_path')));
|
||||
$dir = ABSPATH . $path;
|
||||
$url = trailingslashit($siteurl) . $path;
|
||||
|
||||
if ( $dir == ABSPATH ) { //the option was empty
|
||||
$dir = ABSPATH . 'wp-content/uploads';
|
||||
}
|
||||
if ( $url == $siteurl ) { //the option was empty
|
||||
$url = get_option('siteurl') . '/' . str_replace(ABSPATH, '', $dir);
|
||||
}
|
||||
|
||||
if ( defined('UPLOADS') ) {
|
||||
$dir = ABSPATH . UPLOADS;
|
||||
$url = get_option('siteurl') . '/' . UPLOADS;
|
||||
$url = trailingslashit($siteurl) . UPLOADS;
|
||||
}
|
||||
|
||||
if ( get_settings('uploads_yearmonth_folders')) {
|
||||
if ( get_settings('uploads_use_yearmonth_folders')) {
|
||||
// Generate the yearly and monthly dirs
|
||||
$time = current_time( 'mysql' );
|
||||
$y = substr( $time, 0, 4 );
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
// This just holds the version number, in a separate file so we can bump it without cluttering the SVN
|
||||
|
||||
$wp_version = '2.0.1-alpha';
|
||||
$wp_db_version = 3414;
|
||||
$wp_db_version = 3437;
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue