1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Provide a default non-NULL timezone in the PhabricatorUser class

Summary:
Without this, user creation throws an exception when trying to insert NULL into
a non-NULL field.

Test Plan:
Created a new user.

Reviewed By: fratrik
Reviewers: fratrik, toulouse, aran, jungejason, tuomaspelkonen
CC: aran, fratrik
Differential Revision: 480
This commit is contained in:
epriestley 2011-06-20 13:00:31 -07:00
parent 3272008aef
commit 25bbe741f4
2 changed files with 9 additions and 2 deletions

View file

@ -1,2 +1,2 @@
ALTER TABLE phabricator_user.user ALTER TABLE phabricator_user.user
ADD timezoneIdentifier varchar(255) NOT NULL DEFAULT "America/Los_Angeles"; ADD timezoneIdentifier varchar(255) NOT NULL;

View file

@ -27,7 +27,7 @@ class PhabricatorUser extends PhabricatorUserDAO {
protected $passwordSalt; protected $passwordSalt;
protected $passwordHash; protected $passwordHash;
protected $profileImagePHID; protected $profileImagePHID;
protected $timezoneIdentifier; protected $timezoneIdentifier = '';
protected $consoleEnabled = 0; protected $consoleEnabled = 0;
protected $consoleVisible = 0; protected $consoleVisible = 0;
@ -298,4 +298,11 @@ class PhabricatorUser extends PhabricatorUserDAO {
return $preferences; return $preferences;
} }
public function getTimezoneIdentifier() {
// If the user hasn't set one, guess the server's time.
return nonempty(
$this->timezoneIdentifier,
date_default_timezone_get());
}
} }