minor #2670 Fix partial template caching after update when auto_reload is on (ay-git)
minor #2670 Fix partial template caching after update when auto_reload is on (ay-git)

This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2670).

Discussion
----------

Fix partial template caching after update when auto_reload is on

**Description of the bug:**
This bug manifests itself on production servers.
And with a high load the probability of getting on this bug tends to 100%
The bug results in the caching of a partial template and the failure of a part of the site working with this template. Can only be corrected by deleting the cache.

**What's happening:**
If in the process of uploading the template file, a render() is called, the partially uploaded file gets into the cache and after the template file is fully uploaded, the cache is not updated anymore.

**How to demonstrate:**
To demonstrate the bug, you can create 2 files:
File simulating the download of a file to the server (twig_test_write.php):

```
$classTwig = new Twig_Environment( new Twig_Loader_Filesystem(__DIR__."/../../site_templates/"), array(
	'cache' => __DIR__.'/../../site_templates_cache',
	'auto_reload'=>true
));

file_put_contents(__DIR__."/../../site_templates/"."test.twig","\n<br>Template start write to filesystem");

echo $classTwig->render("test.twig", array());

file_put_contents(__DIR__."/../../site_templates/"."test.twig"," - Template end write to filesystem",FILE_APPEND);

```

File for template rendering (twig_test_read.php):
```
$classTwig = new Twig_Environment( new Twig_Loader_Filesystem(__DIR__."/../../site_templates/"), array(
	'cache' => __DIR__.'/../../site_templates_cache',
	'auto_reload'=>true
));

echo $classTwig->render("test.twig", array());
```

Result executeing file twig_test_write.php:
```
Template start write to filesystem
```

Result executeing file twig_test_read.php:
```
Template start write to filesystem
```

**After this fix:**
Result executeing file twig_test_read.php:
```
Template start write to filesystem - Template end write to filesystem
```

Commits
-------

50d990e2 Fix cache update after uploading the template file (when auto-update is enabled).

nicolas-grekas/Twig,twigphp/Twig,twigphp/Twig,nicolas-grekas/Twig,nicolas-grekas/Twig,nicolas-grekas/Twig,nicolas-grekas/Twig,twigphp/Twig