Verify if file content is outdated based on
the file last modification timestamp.

@return bool
358969
protected function isCacheExpired()
    {
        $ts = filemtime($this->filePath);
        if (!$this->cacheOnly && time() - $ts >= $this->refreshInterval) {
            $this->log->debug("Cache content {$this->filePath} expired ({$this->refreshInterval})");

            return true;
        }

        return false;
    }
915392
public function mustRefresh()
    {
        if ($this->fileExists()) {
            $this->_cleanFilesStack();
            $_dest = new \SplFileInfo($this->getDestinationRealPath());
            if (!empty($this->files_stack)) {
                foreach ($this->files_stack as $_file) {
                    if ($_file->getMTime() > $_dest->getMTime()) {
                        return true;
                    }
                }
                return false;
            }
        }
        return true;
    }
643713
private function isValidForVersioning()
    {
        $dontVersionFields = isset( $this->dontVersionFields ) ? $this->dontVersionFields : [];
        $removeableKeys    = array_merge($dontVersionFields, [$this->getUpdatedAtColumn()]);

        if (method_exists($this, 'getDeletedAtColumn')) {
            $removeableKeys[] = $this->getDeletedAtColumn();
        }

        return ( count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0 );
    }
750435
public function isChanged(): bool
    {
        $this->changedFiles = [];
        do{
            $readResult = \inotify_read($this->handler);
            if(false === $readResult)
            {
                return $result ?? false;
            }
            foreach($readResult as $item)
            {
                $key = array_search($item['wd'], $this->paths);
                if(false === $key)
                {
                    continue;
                }
                $filePath = File::path($key, $item['name']);
                $filePathIsDir = is_dir($filePath);
                if(!$filePathIsDir)
                {
                    $this->changedFiles[] = $filePath;
                }
                if(Bit::has($item['mask'], IN_CREATE) || Bit::has($item['mask'], IN_MOVED_TO))
                {
                    if($filePathIsDir && !$this->isExclude($filePath))
                    {
                        $this->paths[$filePath] = \inotify_add_watch($this->handler, $filePath, $this->mask);
                    }
                }
            }
            $result = isset($readResult[0]);
        }while(true);
    }
1086810
public function isCacheExpired($cachePath, $path)
    {
        if (! $this->files->exists($cachePath)) {
            return true;
        }

        $lastModified = $this->files->lastModified($path);

        if ($lastModified >= $this->files->lastModified($cachePath)) {
            return true;
        }

        return false;
    }
781131
private function isCacheValid()
    {
        if (!$this->cacheFile->exists()) {
            return false;
        }

        $cachedConfigTimestamp = $this->cacheFile->getTimestamp();

        /** @var \Bolt\Filesystem\Filesystem $configFs */
        $configFs = $this->app['filesystem']->getFilesystem('config');

        $configFiles = [
            'config.yml',
            'config_local.yml',
            'contenttypes.yml',
            'extensions.yml',
            'menu.yml',
            'permissions.yml',
            'routing.yml',
            'taxonomy.yml',
        ];
        foreach ($configFiles as $configFile) {
            $timestamp = $configFs->has($configFile) ? $configFs->get($configFile)->getTimestamp() : 0;
            if ($timestamp > $cachedConfigTimestamp) {
                // The configuration file timestamp is *newer* than the cache file's … invalidate!
                $this->invalidateCache();

                return false;
            }
        }

        return true;
    }
129427
public function getTimestamp($path)
    {
        $meta = $this->getMetadata($path);

        return isset($meta['LastModified'])
            ? ['timestamp' => strtotime($meta['LastModified'])] : false;
    }
344547
def __is_current(filepath):
    ''''''
    if not __DOWNLOAD_PARAMS['auto_update']:
        return True

    if not os.path.isfile(filepath):
        return False

    return datetime.datetime.utcfromtimestamp(os.path.getmtime(filepath)) \
        > __get_last_update_time()
1046622
private function isCacheUpToDate()
    {
        if (!file_exists($this->cachedFile)) {
            return false;
        }

        $cacheTime  = filemtime($this->cachedFile);
        $configTime = max(filemtime($this->configPath), filemtime($this->envFile));

        return $cacheTime == $configTime;
    }
1172758
public function isExpired()
    {
        $date = $this->getValidUntil();

        if ($date instanceof \MUtil_Date) {
            return $date->isEarlierOrEqual(time());
        }

        return false;
    }
925928
public function isValid() {
        // TODO: stat-Cache bei wiederholten Aufrufen loeschen, siehe clearstatcache()

        if (file_exists($this->fileName)) {
            if ($this->lastModified !== filemtime($this->fileName))
                return false;
        }
        elseif ($this->lastModified !== null) {
            return false;
        }

        return true;
    }
1083867
public function existsFile() {
		$file =$this->getPath();
		if (file_exists($file)) {
			if ($this->type == self::TYPE_ENTITY) {
				return self::FILE_MATCH;
			}
			
			$data = file_get_contents($file);
			if (strpos($data, "@version ".Version::BUILDER_VERSION) !== FALSE) {
				return self::FILE_MATCH;
			} else {
				return self::FILE_OUTDATED;
			}
		}
		return self::FILE_MISSING;
	}
643418
protected function isNotModified($request, $file)
    {
        $modifiedSince = $request->getHeaderLine('If-Modified-Since');
        if (!$modifiedSince) {
            return false;
        }

        return strtotime($modifiedSince) === $file->lastChange();
    }
678610
protected function isSaved(): bool
    {
        return $this->filesystem->has($this->path)
            && $this->filesystem->getTimestamp($this->path) > $this->file->getUpdatedAt();
    }
729091
public function getLastModified()
	{
		if ($this->lastModified == null) {
			$this->requestHead();
		}
		return $this->lastModified == null ? new \DateTime() : $this->lastModified;
	}
1023559
public function getLastModified()
	{
		if (is_null($this->lastModified)) {
			$this->lastModified = new \DateTime('@' . filemtime($this->path));
		}
		return $this->lastModified;
	}
634785
public function isCached() {
		if ($this->cached) return true;

		// Passed a cacheId?
		if (!$this->cacheId) return false;

		// Cache file exists?
		if (!file_exists($this->cachePath . $this->cacheId)) return false;

		// Can get the time of the file?
		if (!($mtime = filemtime($this->cachePath . $this->cacheId))) return false;

		// Cache expired?
		if (($mtime + $this->expire) < time()) {
			unlink($this->cachePath . $this->cacheId);
			return false;
		} else {
			/**
			 * Cache the results of this isCached() call.  Why?  So
			 * we don't have to double the overhead for each template.
			 * If we didn't cache, it would be hitting the file system
			 * twice as much (file_exists() & filemtime() [twice each]).
			 */
			$this->cached = true;
			return true;
		}
	}