WordPress.org

Make WordPress Core

Changeset 7165


Ignore:
Timestamp:
03/06/2008 06:07:53 AM (14 years ago)
Author:
ryan
Message:

Use constant instead of DB option for setting autosave_interval. Props mdawaffe. fixes #6075

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/admin.php

    r6754 r7165  
    11<?php
     2
     3if ( !defined( 'AUTOSAVE_INTERVAL' ) )
     4    define( 'AUTOSAVE_INTERVAL', 60 );
    25
    36require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
  • trunk/wp-admin/includes/post.php

    r7162 r7165  
    1919        $now = time();
    2020        $then = strtotime($post->post_date_gmt . ' +0000');
    21         $delta = get_option( 'autosave_interval' ) / 2;
     21        $delta = AUTOSAVE_INTERVAL / 2;
    2222        if ( ($now - $then) < $delta )
    2323            return $post_ID;
     
    655655    $last = get_post_meta( $post->ID, '_edit_last', true );
    656656
    657     $time_window = apply_filters( 'wp_check_post_lock_window', get_option( 'autosave_interval' ) * 2 );
     657    $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
    658658
    659659    if ( $lock && $lock > time() - $time_window && $last != $current_user->ID )
  • trunk/wp-admin/includes/schema.php

    r7154 r7165  
    250250    add_option('medium_size_w', 300);
    251251    add_option('medium_size_h', 300);
    252     add_option('autosave_interval', 60);
    253252
    254253    // Delete unused options
    255     $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', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing');
     254    $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', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval');
    256255    foreach ($unusedoptions as $option) :
    257256        delete_option($option);
  • trunk/wp-includes/script-loader.php

    r7160 r7165  
    4949
    5050        $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080221' . mt_rand());
    51         if ( ! $autosave_interval = get_option( 'autosave_interval' ) )
    52             $autosave_interval = 60;
    53         $this->localize( 'autosave', 'autosaveL10n', array(
    54             'autosaveInterval' => $autosave_interval,
    55             'previewPageText' => __('View this Page'),
    56             'previewPostText' => __('View this Post'),
    57             'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
    58             'savingText' => __('Saving Draft&#8230;')
    59         ) );
    6051
    6152        $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
     
    488479function wp_just_in_time_script_localization() {
    489480    wp_localize_script( 'tiny_mce', 'wpTinyMCEConfig', array( 'defaultEditor' => wp_default_editor() ) );
     481    wp_localize_script( 'autosave', 'autosaveL10n', array(
     482        'autosaveInterval' => AUTOSAVE_INTERVAL,
     483        'previewPageText' => __('View this Page'),
     484        'previewPostText' => __('View this Post'),
     485        'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
     486        'savingText' => __('Saving Draft&#8230;')
     487    ) );
    490488}
    491489
Note: See TracChangeset for help on using the changeset viewer.