Req #66639 [Opn]: Use ctime for file verification

From: Date: Tue, 04 Feb 2014 01:48:40 +0000
Subject: Req #66639 [Opn]: Use ctime for file verification
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184149@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66639&edit=1 ID: 66639 User updated by: nmerdan at reflected dot net Reported by: nmerdan at reflected dot net Summary: Use ctime for file verification Status: Open Type: Feature/Change Request Package: opcache Operating System: Linux PHP Version: 5.5.8 Block user comment: N Private report: N New Comment: The current behavior is to only check mtime only of course, if that wasn't clear. Previous Comments: ------------------------------------------------------------------------ [2014-02-04 01:40:39] nmerdan at reflected dot net Description: ------------ In order to avoid problems when preserving timestamps using rsync and similar tools it might be desirable to check ctime instead of mtime when checking if script needs to be invalidated. APC has this option and it comes quite useful. Attached is a patch that enables this, it is lacking documentation and tests (?), but I can create them too if this gets accepted. Test script: --------------- <?php print_r(opcache_get_status(true)); echo "foo"; ?> Expected result: ---------------- If you set opcache.stat_ctime and run the script for the first time, it should not be cached. If you then run it again you should see it cached like this: ( [full_path] => /tmp/test.php [hits] => 0 [memory_consumption] => 1240 [last_used] => Mon Feb 3 20:37:05 2014 [last_used_timestamp] => 1391477825 [timestamp] => 1391477689 ) Then just 'chmod' the script so it changes ctime, but not mtime, then run it again and you will get the empty array. Next time you run it, it will be cached. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66639&edit=1

« previous php.bugs (#184149) next »