Explorar o código

Fix bug with getExtension()

getExtension() is not available on PHP < 5.3.7
Replaced by pathinfo(..., PATHINFO_EXTENSION)

See https://github.com/marienfressinaud/FreshRSS/issues/649
Marien Fressinaud %!s(int64=11) %!d(string=hai) anos
pai
achega
ba163baa84
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      app/Controllers/indexController.php

+ 2 - 1
app/Controllers/indexController.php

@@ -330,7 +330,8 @@ class FreshRSS_index_Controller extends Minz_ActionController {
 	private static function purgeTokens() {
 	private static function purgeTokens() {
 		$oldest = time() - 2629744;	//1 month	//TODO: Use a configuration instead
 		$oldest = time() - 2629744;	//1 month	//TODO: Use a configuration instead
 		foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $fileInfo) {
 		foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $fileInfo) {
-			if ($fileInfo->getExtension() === 'txt' && $fileInfo->getMTime() < $oldest) {
+			$extension = pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION);
+			if ($extension === 'txt' && $fileInfo->getMTime() < $oldest) {
 				@unlink($fileInfo->getPathname());
 				@unlink($fileInfo->getPathname());
 			}
 			}
 		}
 		}