WP_Filesystem_Direct::chgrp │ public │ WP 2.5.0

Changes the file group.

Метод класса: WP_Filesystem_Direct{}

Хуков нет.

Возвращает

bool. True on success, false on failure.

Использование

$WP_Filesystem_Direct = new WP_Filesystem_Direct();
$WP_Filesystem_Direct->chgrp( $file, $group, $recursive );
$file(строка) (обязательный)
Path to the file.
$group(строка|int) (обязательный)
A group name or number.
$recursive(true|false)
If set to true, changes file group recursively.
По умолчанию: false

Список изменений

С версии 2.5.0 Введена.

Код WP_Filesystem_Direct::chgrp() WP 7.1.4

public function chgrp( $file, $group, $recursive = false ) {
	if ( ! $this->exists( $file ) ) {
		return false;
	}

	if ( ! $recursive ) {
		return chgrp( $file, $group );
	}

	if ( ! $this->is_dir( $file ) ) {
		return chgrp( $file, $group );
	}

	// Is a directory, and we want recursive.
	$file     = trailingslashit( $file );
	$filelist = $this->dirlist( $file );
	if ( false === $filelist ) {
		return false;
	}

	foreach ( $filelist as $file_listing ) {
		$this->chgrp( $file . $file_listing['name'], $group, $recursive );
	}

	return true;
}