From a3078a85871708b51ce79977f125a2dc38a9783a Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 15 Apr 2018 07:26:43 +0200
Subject: [PATCH 01/18] Added timezone option.
---
crunz.yml | 7 ++++++-
src/Configuration/Definition.php | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/crunz.yml b/crunz.yml
index 72e7ba3d..703609cf 100644
--- a/crunz.yml
+++ b/crunz.yml
@@ -11,6 +11,11 @@ source: tasks
# to make sure all the existing tasks files are renamed accordingly.
suffix: Tasks.php
+# Timezone used to calculate task run date
+# This option is very important and not setting it is deprecated
+# and will result in exception in 2.0 version.
+timezone: UTC
+
# By default the errors are not logged by Crunz
# You may set the value to true for logging the errors
log_errors: false
@@ -56,4 +61,4 @@ smtp:
port:
username:
password:
- encryption:
\ No newline at end of file
+ encryption:
diff --git a/src/Configuration/Definition.php b/src/Configuration/Definition.php
index c2ddbf38..66f461ac 100644
--- a/src/Configuration/Definition.php
+++ b/src/Configuration/Definition.php
@@ -26,6 +26,10 @@ public function getConfigTreeBuilder()
->info('The suffix for filenames' . PHP_EOL)
->end()
+ ->scalarNode('timezone')
+ ->info('Timezone used to calculate task run date')
+ ->end()
+
->booleanNode('log_errors')
->defaultFalse()
->info('Flag for logging errors' . PHP_EOL)
From 8880b7dc3646c9f10ebb1f52533e9918fe1c3f17 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 17:33:01 +0200
Subject: [PATCH 02/18] Do not require symfony/debug it is not in use.
---
composer.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/composer.json b/composer.json
index 243c0913..be1f97e9 100644
--- a/composer.json
+++ b/composer.json
@@ -47,7 +47,6 @@
"phpdocumentor/reflection-docblock": "^2.0.1",
"phpunit/phpunit": "5.7.27",
"sebastian/comparator": "1.2.4",
- "symfony/debug": "^3.3 || ^4.0",
"symfony/phpunit-bridge": "^2.8 || ^3.3 || ^4.0",
"symfony/var-dumper": "^3.4"
},
From 3f49601e64037a44ce63e1df03742912e2458586 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 17:42:37 +0200
Subject: [PATCH 03/18] Report all error in CLI.
---
Vagrantfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Vagrantfile b/Vagrantfile
index d6978a51..0974b7fa 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -30,6 +30,7 @@ touch "$PHP_INI_PATH";
echo "display_errors = On" >> "$PHP_INI_PATH";
echo "display_startup_errors = On" >> "$PHP_INI_PATH";
+echo "error_reporting = E_ALL" >> "$PHP_INI_PATH";
echo "log_errors = On" >> "$PHP_INI_PATH";
echo "error_log = /var/log/php_error.log" >> "$PHP_INI_PATH";
From 3d390144594cc438265f7845edf103ef28791218 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 17:57:46 +0200
Subject: [PATCH 04/18] Fix type hints.
---
src/Console/Command/Command.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Console/Command/Command.php b/src/Console/Command/Command.php
index a479198e..955c0afc 100644
--- a/src/Console/Command/Command.php
+++ b/src/Console/Command/Command.php
@@ -23,14 +23,14 @@ class Command extends BaseCommand
/**
* Input object.
*
- * @var use Symfony\Component\Console\Input\InputInterface
+ * @var \Symfony\Component\Console\Input\InputInterface
*/
protected $input;
/**
* output object.
*
- * @var use Symfony\Component\Console\Input\OutputInterface
+ * @var \Symfony\Component\Console\Output\OutputInterface
*/
protected $output;
}
From 6d4fb5a20e293bac8c4125ec58cb135ee3ff8552 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 18:27:47 +0200
Subject: [PATCH 05/18] Type hint improved.
---
src/EventRunner.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/EventRunner.php b/src/EventRunner.php
index 338b8b50..4aec7f01 100644
--- a/src/EventRunner.php
+++ b/src/EventRunner.php
@@ -11,7 +11,7 @@ class EventRunner
/**
* Schedule objects.
*
- * @var array
+ * @var Schedule[]
*/
protected $schedules = [];
/**
From 1d471435a9346e05cca471de4b92dde555696051 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 19:26:44 +0200
Subject: [PATCH 06/18] Added configuration to tests env.
---
tests/crunz.yml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 tests/crunz.yml
diff --git a/tests/crunz.yml b/tests/crunz.yml
new file mode 100644
index 00000000..a808646e
--- /dev/null
+++ b/tests/crunz.yml
@@ -0,0 +1,22 @@
+source: tasks
+suffix: Tasks.php
+timezone: UTC
+log_errors: false
+errors_log_file: ~
+log_output: false
+output_log_file: ~
+log_allow_line_breaks: false
+email_output: false
+email_errors: false
+mailer:
+ transport: smtp
+ recipients:
+ sender_name:
+ sender_email:
+
+smtp:
+ host: ~
+ port: ~
+ username: ~
+ password: ~
+ encryption: ~
From 8a5c4a12e4b3f47b43733e642c065ec257864749 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 19:27:26 +0200
Subject: [PATCH 07/18] Added null values.
---
crunz.yml | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/crunz.yml b/crunz.yml
index 703609cf..99b4a23b 100644
--- a/crunz.yml
+++ b/crunz.yml
@@ -11,10 +11,10 @@ source: tasks
# to make sure all the existing tasks files are renamed accordingly.
suffix: Tasks.php
-# Timezone used to calculate task run date
+# Timezone is used to calculate task run time
# This option is very important and not setting it is deprecated
# and will result in exception in 2.0 version.
-timezone: UTC
+timezone: ~
# By default the errors are not logged by Crunz
# You may set the value to true for logging the errors
@@ -22,7 +22,7 @@ log_errors: false
# This is the absolute path to the errors' log file
# You need to make sure you have the required permission to write to this file though.
-errors_log_file:
+errors_log_file: ~
# By default the output is not logged as they are redirected to the
# null output.
@@ -32,7 +32,7 @@ log_output: false
# This is the absolute path to the global output log file
# The events which have dedicated log files (defined with them), won't be
# logged to this file though.
-output_log_file:
+output_log_file: ~
# By default line breaks in logs aren't allowed.
# Set the value to true to allow them.
@@ -45,7 +45,6 @@ email_output: false
email_errors: false
# Global Swift Mailer settings
-#
mailer:
# Possible values: smtp, mail, and sendmail
transport: smtp
@@ -55,10 +54,9 @@ mailer:
# SMTP settings
-#
smtp:
- host:
- port:
- username:
- password:
- encryption:
+ host: ~
+ port: ~
+ username: ~
+ password: ~
+ encryption: ~
From 2c2324b7f8b044fc0ad57c7d8aa39cfd96c12f2c Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 19:28:12 +0200
Subject: [PATCH 08/18] Added timezone provider.
---
config/services.xml | 6 ++++++
src/Timezone/Provider.php | 14 ++++++++++++++
src/Timezone/ProviderInterface.php | 11 +++++++++++
tests/Unit/Timezone/ProviderTest.php | 24 ++++++++++++++++++++++++
4 files changed, 55 insertions(+)
create mode 100644 src/Timezone/Provider.php
create mode 100644 src/Timezone/ProviderInterface.php
create mode 100644 tests/Unit/Timezone/ProviderTest.php
diff --git a/config/services.xml b/config/services.xml
index a2de8b59..2dab5e6f 100644
--- a/config/services.xml
+++ b/config/services.xml
@@ -127,6 +127,12 @@
+
+
defaultTimezone();
+
+ $this->assertSame($timezoneName, $timezone->getName());
+ }
+}
From 48feccbb610e40e2d5163caf8fd8378f2e60bbbe Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 19:42:55 +0200
Subject: [PATCH 09/18] Added tasks timezone.
---
config/services.xml | 9 +++++++++
src/Task/Timezone.php | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
create mode 100644 src/Task/Timezone.php
diff --git a/config/services.xml b/config/services.xml
index 2dab5e6f..d268f507 100644
--- a/config/services.xml
+++ b/config/services.xml
@@ -143,5 +143,14 @@
+
+
+
+
+
diff --git a/src/Task/Timezone.php b/src/Task/Timezone.php
new file mode 100644
index 00000000..4de01054
--- /dev/null
+++ b/src/Task/Timezone.php
@@ -0,0 +1,41 @@
+configuration = $configuration;
+ $this->timezoneProvider = $timezoneProvider;
+ }
+
+ public function timezoneForComparisons()
+ {
+ $newTimezone = $this->configuration
+ ->get('timezone')
+ ;
+
+ if (empty($newTimezone)) {
+ @trigger_error(
+ 'Timezone is not configured and this is deprecated from 1.7 and will result in exception in 2.0 version. Add `timezone` key to your YAML config file.',
+ E_USER_DEPRECATED
+ );
+
+ $newTimezone = $this->timezoneProvider
+ ->defaultTimezone()
+ ->getName()
+ ;
+ }
+
+ return new \DateTimeZone($newTimezone);
+ }
+}
From 5e9bb6cde809072bdafc504aca49816376356fc2 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 20 May 2018 20:10:50 +0200
Subject: [PATCH 10/18] Require symfony/filesystem.
---
composer.json | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/composer.json b/composer.json
index be1f97e9..52a5db83 100644
--- a/composer.json
+++ b/composer.json
@@ -28,18 +28,19 @@
"php": "^5.6 || ^7.0",
"guzzlehttp/guzzle": "^6.1",
"jeremeamia/superclosure": "^2.2",
- "nikic/php-parser": "^2.1.1 || ^3.0 || ^4.0",
"monolog/monolog": "^1.19",
"mtdowling/cron-expression": "^1.1",
"nesbot/carbon": "^1.21",
+ "nikic/php-parser": "^2.1.1 || ^3.0 || ^4.0",
"swiftmailer/swiftmailer": "^5.4 || ^6.0",
"symfony/config": "^2.7 || ^3.3 || ^4.0",
"symfony/console": "^2.7 || ^3.3 || ^4.0",
"symfony/dependency-injection": "^2.7 || ^3.3 || ^4.0",
+ "symfony/filesystem": "^2.7 || ^3.3 || ^4.0",
"symfony/finder": "^2.7 || ^3.3 || ^4.0",
"symfony/process": "^2.7.11 || ^3.3 || ^4.0",
- "symfony/yaml": "^2.7 || ^3.3 || ^4.0",
- "symfony/property-access": "^2.7 || ^3.3 || ^4.0"
+ "symfony/property-access": "^2.7 || ^3.3 || ^4.0",
+ "symfony/yaml": "^2.7 || ^3.3 || ^4.0"
},
"require-dev": {
"ext-mbstring": "*",
From 40d35c350c6715128742abe670596534aaadf435 Mon Sep 17 00:00:00 2001
From: pkowalczyk <11366345+PabloKowalczyk@users.noreply.github.com>
Date: Sun, 27 May 2018 07:00:41 +0200
Subject: [PATCH 11/18] Add composer as a non-privileged user.
---
Vagrantfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Vagrantfile b/Vagrantfile
index 0974b7fa..382876ad 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -38,7 +38,7 @@ SCRIPT
$composer = <