public static function removeOldFiles() {
		
		if (!is_dir(static::TEMP_FOLDER)) {
			return;
		}
		
		$app = Application::getInstance();
		$counter = 0;

		$files = Utilities::getDirectoryFilenames(static::TEMP_FOLDER);

		foreach ($files as $file) {

			$pathFile	= APPLICATION_PATH . '/' .static::TEMP_FOLDER . '/' . $file;
			$fileLife	= time() - filemtime($pathFile);
			$maxLife	= static::FILE_EXPIRE * 60;
			
			if ($fileLife > $maxLife) {
				$counter++;
				unlink($pathFile);
			}

		}
		
		if ($counter) {
			$app->logEvent($counter . ' files has been deleted from ' . static::TEMP_FOLDER);
		} else {
			$app->logEvent('No old files deleted from ' . static::TEMP_FOLDER);
		}
		
	}
public static function removeOldFiles() {
		
		if (!is_dir(static::TEMP_FOLDER)) {
			return;
		}
		
		$app = Application::getInstance();
		$counter = 0;

		$files = Utilities::getDirectoryFilenames(static::TEMP_FOLDER);

		foreach ($files as $file) {

			$pathFile	= APPLICATION_PATH . '/' .static::TEMP_FOLDER . '/' . $file;
			$fileLife	= time() - filemtime($pathFile);
			$maxLife	= static::FILE_EXPIRE * 60;
			
			if ($fileLife > $maxLife) {
				$counter++;
				unlink($pathFile);
			}

		}
		
		if ($counter) {
			$app->logEvent($counter . ' files has been deleted from ' . static::TEMP_FOLDER);
		} else {
			$app->logEvent('No old files deleted from ' . static::TEMP_FOLDER);
		}
		
	}
public static function removeOldFiles ( ) { if ( ! is_dir ( static :: TEMP_FOLDER ) ) { return ; } $ app = Application :: getInstance ( ) ; $ counter = 0 ; $ files = Utilities :: getDirectoryFilenames ( static :: TEMP_FOLDER ) ; foreach ( $ files as $ file ) { $ pathFile = APPLICATION_PATH . '/' . static :: TEMP_FOLDER . '/' . $ file ; $ fileLife = time ( ) - filemtime ( $ pathFile ) ; $ maxLife = static :: FILE_EXPIRE * 60 ; if ( $ fileLife > $ maxLife ) { $ counter ++ ; unlink ( $ pathFile ) ; } } if ( $ counter ) { $ app -> logEvent ( $ counter . ' files has been deleted from ' . static :: TEMP_FOLDER ) ; } else { $ app -> logEvent ( 'No old files deleted from ' . static :: TEMP_FOLDER ) ; } }
Deletes file with created date older than EXPIRE_TIME const.
Deletes file with created date older than EXPIRE_TIME const .