WP_Filesystem_SSH2::chgrp()publicWP 2.7.0

Changes the file group.

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

Хуков нет.

Возвращает

true|false. True on success, false on failure.

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

$WP_Filesystem_SSH2 = new WP_Filesystem_SSH2();
$WP_Filesystem_SSH2->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.7.0 Введена.

Код WP_Filesystem_SSH2::chgrp() WP 6.5.2

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

	if ( ! $recursive || ! $this->is_dir( $file ) ) {
		return $this->run_command( sprintf( 'chgrp %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true );
	}

	return $this->run_command( sprintf( 'chgrp -R %s %s', escapeshellarg( $group ), escapeshellarg( $file ) ), true );
}