Mercurial > hg > lukkari
comparison index.php @ 183:dda30eff3266
Fix handling of data modification timestamps.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 30 Sep 2015 08:39:24 +0300 |
parents | a59bb75aa0ec |
children | 04490fe590ec |
comparison
equal
deleted
inserted
replaced
182:a59bb75aa0ec | 183:dda30eff3266 |
---|---|
320 } | 320 } |
321 return 0; | 321 return 0; |
322 } | 322 } |
323 | 323 |
324 | 324 |
325 function lukReadClassFile($filename, &$mtimestamp) | 325 function lukReadClassFile($filename) |
326 { | 326 { |
327 // Attempt to open file for reading | 327 // Attempt to open file for reading |
328 if (($fp = @fopen($filename, "rb")) === false) | 328 if (($fp = @fopen($filename, "rb")) === false) |
329 return false; | 329 return false; |
330 | 330 |
331 $mtimestamp = filemtime($filename); | |
332 $mclasses = FALSE; | 331 $mclasses = FALSE; |
333 | 332 |
334 // Lock file so that we do not get clashes | 333 // Lock file so that we do not get clashes |
335 if (flock($fp, LOCK_SH)) | 334 if (flock($fp, LOCK_SH)) |
336 { | 335 { |
523 fclose($fp); | 522 fclose($fp); |
524 } | 523 } |
525 | 524 |
526 | 525 |
527 // Read classfile | 526 // Read classfile |
528 if (($classIDs = lukReadClassFile($classIDFile[$nextPeriod], $timestamp)) === false) | 527 if (($classIDs = lukReadClassFile($classIDFile[$nextPeriod])) === false) |
529 stError(cmQM("classListNotFound")); | 528 stError(cmQM("classListNotFound")); |
530 | 529 |
531 | 530 |
532 // Read class data | 531 // Read class data |
533 $dataFile = $cachePath.$classID.".data"; | 532 $dataFile = $cachePath.$classID.".data"; |
534 if (!file_exists($dataFile)) | 533 if (!file_exists($dataFile)) |
535 { | 534 { |
536 stError(cmQM("classDataNotFound", chentities($classID))); | 535 stError(cmQM("classDataNotFound", chentities($classID))); |
537 $haveData = FALSE; | 536 $haveData = FALSE; |
537 $timestamp = time(); | |
538 } | 538 } |
539 else | 539 else |
540 { | 540 { |
541 require($dataFile); | 541 require($dataFile); |
542 $haveData = isset($classInfo); | 542 $haveData = isset($classInfo); |
543 $timestamp = filemtime($dataFile); | |
543 } | 544 } |
544 | 545 |
545 | 546 |
546 // Create references to mobile device (Apple touch) icons | 547 // Create references to mobile device (Apple touch) icons |
547 $extra = ""; | 548 $extra = ""; |