WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9706 closed defect (bug) (fixed)

fishy looking query on a wp 2.8 front page

Reported by: Denis-de-Bernardy Owned by:
Milestone: 2.8 Priority: low
Severity: minor Version: 2.8
Component: Optimization Keywords: has-patch commit
Focuses: Cc:

Description

SELECT option_value
FROM wp_options
WHERE option_name = 'timezone_string'
LIMIT 1

it's no longer around after updating options / general. is it not added in the installer/upgrader?

Attachments (1)

9706.patch (459 bytes) - added by hakre 5 years ago.
Populate timezone_string as well.

Download all attachments as: .zip

Change History (12)

comment:1 Denis-de-Bernardy5 years ago

  • Priority changed from normal to low
  • Severity changed from normal to minor

comment:2 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added

comment:3 hakre5 years ago

related files:
/wp-admin/options-general.php
/wp-admin/options.php
/wp-includes/functions.php

this must be added sometime and should be ready to removed then. maybe the reverse of a patch or a chnageset? if it is not needed any longer then it should be removed.

comment:4 Denis-de-Bernardy5 years ago

I think it's used in the timezone offset scripts. it would need to be initialized (add_option()) in the installer or upgrader scripts.

comment:5 hakre5 years ago

To which value is this initialized. Empty string per Default?

comment:6 Denis-de-Bernardy5 years ago

not 100% certain. server time zone, I think. (should be clear upon visiting settings / general on a clean install)

comment:7 hakre5 years ago

it (timezone_string) is just not set on install. It can be set on the options page (general), currently there is the timezone select element ( wp_timezone_choice() ) that will set this option.

default would be null, false or an empty string. that is at if it would not be in the db.

and while that being empty:

$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
if (empty($tzstring)) { // set the Etc zone if no timezone string exists
	if ($current_offset < 0) $offnum = - ceil($current_offset);
	else $offnum = - floor($current_offset);
	$tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;
}

gmt_offset is set automatically on install while populating the options ( populate_options() ). this is the important line (~238): 'gmt_offset' => date('Z') / 3600,.

hakre5 years ago

Populate timezone_string as well.

comment:8 hakre5 years ago

  • Keywords has-patch added; needs-patch removed

comment:9 Denis-de-Bernardy5 years ago

  • Keywords commit added

comment:10 ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11264]) Add timezone_string to populate_options. Props hakre. fixes #9706

comment:11 ryan5 years ago

(In [11265]) Revert accidental bits. see #9706

Note: See TracTickets for help on using tickets.