I'm writing a photo gallery script in PHP and have a single directory where the user will store their pictures. I'm attempting to set up page caching and have the cache refresh only if the contents of the directory has changed. I thought I could do this by caching the last modified time of the directory using the filemtime() function a...
I just got PHP-CLI working on my Windows machine so I could create scripts using PHP. However, I'm trying to write a script to cleanup my Firefox downloads folder of files older than X number of days, but I can't seem to get the filemtime() function working.
Here is the function I wrote:
function deleteOldFiles($dir, $days) {
$mydir...
Hi all
I'm trying to watch for a file being modified in a long running php script. The basic algorithm is this:
...
$mtime = filemtime($filename);
sleep($delay);
if($mtime < filemtime($filename))
... // do something because file was changed elsewhere
Problem is filemtime returns the same value withing same script, e.g. if a scr...
Have an example piece of (Python) code to check if a directory has changed:
import os
def watch(path, fdict):
"""Checks a directory and children for changes"""
changed = []
for root, dirs, files in os.walk(path):
for f in files:
abspath = os.path.abspath(os.path.join(root, f))
new_mtime = os.sta...
What command line tool can I use to automatically insert mtimes into urls in my css files for the purposes of breaking the cache?
/* before */
.example { background: url(example.jpg); }
/* after */
.example { background: url(example.jpg?1271298451); }
Also, I would like this tool to spit out the latest mtime as the css files mtime. (...
Is there a known issue leading to file modification times of cache files on Windows XP SP 3 getting arbitrarily updated, but without any actual change?
Is there some service on a standard Windows XP - Backup, Sync, Versioning, Virus scanner - known to touch files? They all have a .txt extension.
If there isn't, forget it. Then I'm gett...
I there, I am currently writing a unit test which asserts that a file did not get modified. The test code execution takes less than one second and therefore I would like to know if it is possible to retrieve the file modification time in milliseconds. filemtime() function returns the UNIX timestamp in seconds.
My current solution is usi...
What I am trying to do is check the age of an image, if its older than 60 minutes then run another php page to fetch images otherwise do nothing if less than 60 minutes old....
The script isn't opening the 2nd page (radartest.php) and running it to update the images, so need a command to tell it to run as a script please.
<?php
$imagen...