10000 Ticket 25999 by dmifedorenko · Pull Request #26013 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Ticket 25999 #26013

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
DependencyInjection fixed docker-for-mac fs permance issue ticket_25999
  • Loading branch information
dmifedorenko committed Feb 2, 2018
commit 14cb5f338f8724f3fd17e44d7a9feedb3fb3a517
3 changes: 2 additions & 1 deletion src/Symfony/Component/Config/Resource/FileResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function getResource()
*/
public function isFresh($timestamp)
{
return file_exists($this->resource) && @filemtime($this->resource) <= $timestamp;
$filemtime = @filemtime($this->resource);
return $filemtime && $filemtime <= $timestamp;

Copy link
Contributor

Choose a reason for hiding this comment

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

These changes can probably be fixed in a lower branch.

Copy link
Contributor
@sroze sroze Feb 2, 2018

Choose a reason for hiding this comment

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

You can probably inline the definition as well, i.e.

return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;

}

public function serialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ public function isFresh($timestamp)
}

foreach ($this->files as $file => $v) {
if (!file_exists($file)) {
$filemtime = @filemtime($file);
if (!$filemtime) {
Copy link
Contributor

Choose a reason for hiding this comment

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

inline?

if (false === ($filemtime = @filemtime($file))) {

return false;
}

if (@filemtime($file) > $timestamp) {
if ($filemtime > $timestamp) {
return $this->hash === $this->computeHash();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ public function __construct($class, $path, array $autowiringMetadata)

public function isFresh($timestamp)
{
if (!file_exists($this->filePath)) {
$filemtime = @filemtime($this->filePath);
if (!$filemtime) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The changes in this file can probably also be applied on a lower branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

same as @sroze you can inline all this condition

return false;
}

// has the file *not* been modified? Definitely fresh
if (@filemtime($this->filePath) <= $timestamp) {
if ($filemtime <= $timestamp) {
return true;
}

Expand Down
0