WP_Filesystem_Direct::chown()
Changes the owner of a file or directory.
Метод класса: WP_Filesystem_Direct{}
Хуков нет.
Возвращает
true|false
. True on success, false on failure.
Использование
$WP_Filesystem_Direct = new WP_Filesystem_Direct(); $WP_Filesystem_Direct->chown( $file, $owner, $recursive );
- $file(строка) (обязательный)
- Path to the file or directory.
- $owner(строка|int) (обязательный)
- A user name or number.
- $recursive(true|false)
- If set to true, changes file owner recursively.
По умолчанию: false
Список изменений
С версии 2.5.0 | Введена. |
Код WP_Filesystem_Direct::chown() WP Filesystem Direct::chown WP 6.6.2
public function chown( $file, $owner, $recursive = false ) { if ( ! $this->exists( $file ) ) { return false; } if ( ! $recursive ) { return chown( $file, $owner ); } if ( ! $this->is_dir( $file ) ) { return chown( $file, $owner ); } // Is a directory, and we want recursive. $filelist = $this->dirlist( $file ); foreach ( $filelist as $filename ) { $this->chown( $file . '/' . $filename, $owner, $recursive ); } return true; }