Write to data folder `.htaccess` issue found after update to 15.0.8 from 15.0.7

Anyone aware of this issue?

Debian 9.9, PHP 7.0, NC

Error – PHP – file_put_contents(/var/XXXXX/.htaccess): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Setup.php#560

Appears to be an issue with the file access control rights. Currently, I am in the dark of the purpose of this setup step. However, no trouble until now apparently.

Please accept my apologies for any inconveniences and the limited contribution. I may investigate later and may update this report in the future.

You have a permission issue with this file, the webserver user (user running the php process) can’t open it.

Thank you. However, I was aware of this.

Basically the script tries to write or rewrite the .htaccess file in the data directory it appears.

Obviously, this was not or not always the case in earlier updates. However, the a.m. file should be in place and should show the appropriate content with a date of the install.

Remains the question how to get this file written after setting the write parameter and if wrong content or missing file. A rerun of the occ upgrade one should presume if I am correct.

For the curious minds without access to the scipt files:

public static function protectDataDirectory() {
	//Require all denied
	$now =  date('Y-m-d H:i:s');
	$content = "# Generated by Nextcloud on $now\n";
	$content.= "# line below if for Apache 2.4\n";
	$content.= "<ifModule mod_authz_core.c>\n";
	$content.= "Require all denied\n";
	$content.= "</ifModule>\n\n";
	$content.= "# line below if for Apache 2.2\n";
	$content.= "<ifModule !mod_authz_core.c>\n";
	$content.= "deny from all\n";
	$content.= "Satisfy All\n";
	$content.= "</ifModule>\n\n";
	$content.= "# section for Apache 2.2 and 2.4\n";
	$content.= "<ifModule mod_autoindex.c>\n";
	$content.= "IndexIgnore *\n";
	$content.= "</ifModule>\n";

	$baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
	file_put_contents($baseDir . '/.htaccess', $content);
	file_put_contents($baseDir . '/index.html', '');

Supposedly, the script has a repair and reliability task.