original_string: protected function writeCacheFile($file, $content)
      {
          if (empty($file)) {
              return;
          }
  
          if (!isset(self::$umask)) {
              self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false);
          }
  
          if (self::$umask) {
              $dir = dirname($file);
              if (!is_dir($dir)) {
                  $old = umask(0002);
                  Folder::create($dir);
                  umask($old);
              }
              parent::writeCacheFile($file, $content);
              chmod($file, 0775);
          } else {
              parent::writeCacheFile($file, $content);
          }
      }
code: protected function writeCacheFile($file, $content)
      {
          if (empty($file)) {
              return;
          }
  
          if (!isset(self::$umask)) {
              self::$umask = Grav::instance()['config']->get('system.twig.umask_fix', false);
          }
  
          if (self::$umask) {
              $dir = dirname($file);
              if (!is_dir($dir)) {
                  $old = umask(0002);
                  Folder::create($dir);
                  umask($old);
              }
              parent::writeCacheFile($file, $content);
              chmod($file, 0775);
          } else {
              parent::writeCacheFile($file, $content);
          }
      }
code_tokens: protected function writeCacheFile ( $ file , $ content ) { if ( empty ( $ file ) ) { return ; } if ( ! isset ( self :: $ umask ) ) { self :: $ umask = Grav :: instance ( ) [ 'config' ] -> get ( 'system.twig.umask_fix' , false ) ; } if ( self :: $ umask ) { $ dir = dirname ( $ file ) ; if ( ! is_dir ( $ dir ) ) { $ old = umask ( 0002 ) ; Folder :: create ( $ dir ) ; umask ( $ old ) ; } parent :: writeCacheFile ( $ file , $ content ) ; chmod ( $ file , 0775 ) ; } else { parent :: writeCacheFile ( $ file , $ content ) ; } }
docstring: This exists so template cache files use the same
  group between apache and cli
  
  @param string $file
  @param string $content
docstring_tokens: This exists so template cache files use the same group between apache and cli