code: public static function updateFolderHashes($varResource)
  	{
  		$arrPaths  = array();
  
  		if (!\is_array($varResource))
  		{
  			$varResource = array($varResource);
  		}
  
  		$rootDir = System::getContainer()->getParameter('kernel.project_dir');
  
  		foreach ($varResource as $strResource)
  		{
  			$arrChunks = explode('/', $strResource);
  			$strPath   = array_shift($arrChunks);
  
  			// Do not check files
  			if (is_file($rootDir . '/' . $strResource))
  			{
  				array_pop($arrChunks);
  			}
  
  			// Build the paths
  			while (\count($arrChunks))
  			{
  				$strPath .= '/' . array_shift($arrChunks);
  				$arrPaths[] = $strPath;
  			}
  
  			unset($arrChunks);
  		}
  
  		$arrPaths = array_values(array_unique($arrPaths));
  
  		// Store the hash of each folder
  		foreach (array_reverse($arrPaths) as $strPath)
  		{
  			$objModel  = FilesModel::findByPath($strPath);
  
  			// The DB entry does not yet exist
  			if ($objModel === null)
  			{
  				$objModel = static::addResource($strPath, false);
  			}
  
  			$objModel->hash = static::getFolderHash($strPath);
  			$objModel->save();
  		}
  	}
docs: Update the hashes of all parent folders of a resource
  
  @param mixed $varResource A path or an array of paths to update