Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New system check diagnostic for max_execution_time (#11050) #12576

Merged
merged 4 commits into from Aug 6, 2018
Merged

New system check diagnostic for max_execution_time (#11050) #12576

merged 4 commits into from Aug 6, 2018

Conversation

simivar
Copy link
Contributor

@simivar simivar commented Feb 21, 2018

New system check diagnostic for max_execution_time (#11050)

I don't know if I didn't overdid it. If so and you don't like the new PhpSettingsCheckService class feel free to close that PR and I'll make new PR with different approach.

If PhpSettingsCheckService is fine should I move it to DI like Translator?

@mattab mattab added this to the 3.6.0 milestone Apr 24, 2018
Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @simivar for your first contribution! Everything looks good, I left two minor comments. And 👍 for creating the PhpSettingsCheckService class!


namespace Piwik\Plugins\Diagnostics\Diagnostic;

class PhpSettingsCheckService
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this class is meant to be constructed for each required setting, it's not really a 'service class' (who are meant to be stateless or at least immutable). This is more like the https://github.com/matomo-org/matomo/blob/3.x-dev/core/Settings/Plugin/UserSetting.php or https://github.com/matomo-org/matomo/blob/3.x-dev/core/Settings/Plugin/SystemSetting.php class. I think a better name would be RequiredPhpSetting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed.

$checks[] = $requiredValue['operator'] . ' ' . $requiredValue['requiredValue'];
}

return $this->setting . ' ' . implode(' || ', $checks);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is displayed to the user, I think it would be better to use OR here instead of ||.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped. Also, I've changed isOk to isValid.


$maxExecutionTime = new RequiredPhpSetting('max_execution_time', 0);
$maxExecutionTime->addRequiredValue(30, '>=');
$requiredSettings[] = $maxExecutionTime;
Copy link
Member

@diosmosis diosmosis Jun 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and I noticed that since required settings are added as an ERROR status, this will block installation if max_execution_time is not > 30 (eg, if it's set to 10 on some shared hosting provider, you wouldn't be able to install matomo).

@mattab do you think this is ok? If not, maybe we can make it a warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis +1 to make it a warning.

@sgiehl
Copy link
Member

sgiehl commented Jun 18, 2018

@simivar do you have some time to adjust this PR so the check for max_execution_time only produces a warning instead of an error?

@simivar
Copy link
Contributor Author

simivar commented Jun 18, 2018

@sgiehl Yes, I'll do that on Wednesday / Thursday.

@diosmosis
Copy link
Member

hi @simivar, will you have time to apply the requested changes this week?

@simivar
Copy link
Contributor Author

simivar commented Jul 31, 2018

hi @diosmosis, sorry for such late reply but I was away on vacation and just came back today. I'll apply them this week.

@mattab mattab modified the milestones: 3.6.0, 3.7.0 Aug 6, 2018
@simivar
Copy link
Contributor Author

simivar commented Aug 6, 2018

@mattab @diosmosis Updated, sorry that it took so long.
image

@diosmosis diosmosis modified the milestones: 3.7.0, 3.6.0 Aug 6, 2018
@diosmosis
Copy link
Member

diosmosis commented Aug 6, 2018

fyi @mattab merging this in 3.6.0 since it's done & working

@diosmosis diosmosis merged commit bb1b1b4 into matomo-org:3.x-dev Aug 6, 2018
@diosmosis
Copy link
Member

@simivar thanks for the awesome contribution!

InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…matomo-org#12576)

* New system check diagnostic for max_execution_time (matomo-org#11050)

* PhpSettingsCheck: getRequiredSettings() returns array instead building it in property

* Rename PhpSettingsCheckService to RequiredPhpSetting and swap || with OR in string

* PhpSettingsCheck: method to set whether setting should raise an error or warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants