diff mbox

[v2] php.ini: set date.timezone

Message ID 1430579415-22802-3-git-send-email-bos@je-eigen-domein.nl
State Accepted
Headers show

Commit Message

Floris Bos May 2, 2015, 3:10 p.m. UTC
Set date.timezone in php.ini to match time zone settings.
Prevents a warning being logged about it not being set
each time a PHP date/time method is used.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>

---
v2: follows Arnout's suggestion, using BR2_TARGET_LOCALTIME
---
 package/php/php.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Arnout Vandecappelle May 2, 2015, 3:43 p.m. UTC | #1
On 02/05/15 17:10, Floris Bos wrote:
> Set date.timezone in php.ini to match time zone settings.
> Prevents a warning being logged about it not being set
> each time a PHP date/time method is used.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Regards,
 Arnout

> 
> ---
> v2: follows Arnout's suggestion, using BR2_TARGET_LOCALTIME
> ---
>  package/php/php.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/php/php.mk b/package/php/php.mk
> index 3b9a117..47811ff 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -24,6 +24,12 @@ PHP_CONF_ENV = \
>  	ac_cv_func_strcasestr=yes \
>  	EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
>  
> +ifeq ($(BR2_TARGET_LOCALTIME),)
> +PHP_LOCALTIME = UTC
> +else
> +PHP_LOCALTIME = $(BR2_TARGET_LOCALTIME)
> +endif
> +
>  # PHP can't be AUTORECONFed the standard way unfortunately
>  PHP_DEPENDENCIES += host-autoconf host-automake host-libtool
>  define PHP_BUILDCONF
> @@ -288,6 +294,8 @@ define PHP_INSTALL_FIXUP
>  	rm -f $(TARGET_DIR)/usr/bin/phpize
>  	$(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \
>  		$(TARGET_DIR)/etc/php.ini
> +	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
> +		$(TARGET_DIR)/etc/php.ini
>  endef
>  
>  PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP
>
Thomas Petazzoni May 2, 2015, 5:18 p.m. UTC | #2
Dear Floris Bos,

On Sat,  2 May 2015 17:10:15 +0200, Floris Bos wrote:

> +ifeq ($(BR2_TARGET_LOCALTIME),)
> +PHP_LOCALTIME = UTC
> +else
> +PHP_LOCALTIME = $(BR2_TARGET_LOCALTIME)

I suppose you tested that a qstrip call is not needed here.

So, I applied with Arnout Reviewed-by.

Thanks!

Thomas
Floris Bos May 2, 2015, 5:22 p.m. UTC | #3
On 05/02/2015 07:18 PM, Thomas Petazzoni wrote:
> Dear Floris Bos,
>
> On Sat,  2 May 2015 17:10:15 +0200, Floris Bos wrote:
>
>> +ifeq ($(BR2_TARGET_LOCALTIME),)
>> +PHP_LOCALTIME = UTC
>> +else
>> +PHP_LOCALTIME = $(BR2_TARGET_LOCALTIME)
> I suppose you tested that a qstrip call is not needed here.

Yes.
Quotes are fine in php.ini


Yours sincerely,

Floris Bos
Thomas Petazzoni May 2, 2015, 6:54 p.m. UTC | #4
Hello,

On Sat, 02 May 2015 19:22:05 +0200, Floris Bos wrote:

> Yes.
> Quotes are fine in php.ini

Great, thanks for the confirmation.

Thomas
diff mbox

Patch

diff --git a/package/php/php.mk b/package/php/php.mk
index 3b9a117..47811ff 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -24,6 +24,12 @@  PHP_CONF_ENV = \
 	ac_cv_func_strcasestr=yes \
 	EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
 
+ifeq ($(BR2_TARGET_LOCALTIME),)
+PHP_LOCALTIME = UTC
+else
+PHP_LOCALTIME = $(BR2_TARGET_LOCALTIME)
+endif
+
 # PHP can't be AUTORECONFed the standard way unfortunately
 PHP_DEPENDENCIES += host-autoconf host-automake host-libtool
 define PHP_BUILDCONF
@@ -288,6 +294,8 @@  define PHP_INSTALL_FIXUP
 	rm -f $(TARGET_DIR)/usr/bin/phpize
 	$(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \
 		$(TARGET_DIR)/etc/php.ini
+	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
+		$(TARGET_DIR)/etc/php.ini
 endef
 
 PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP