Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated - WP.AlternativeFunctions: Add more functions to filesystem functions list #2108

Merged
merged 15 commits into from
Dec 19, 2022
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion WordPress/Sniffs/WP/AlternativeFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,37 @@ public function getGroups() {
),
),

'file_system_read' => array(
'unlink' => array(
'type' => 'warning',
'message' => '%s() is discouraged. Use wp_delete_file() to delete a file.',
'since' => '4.2.0',
'functions' => array(
'unlink',
),
),

'rename' => array(
'type' => 'warning',
'message' => '%s() is discouraged. Use WP_Filesystem::move method to rename a file.',
sandeshjangam marked this conversation as resolved.
Show resolved Hide resolved
'since' => '2.5.0',
'functions' => array(
'rename',
),
),

'file_system_operations' => array(
'type' => 'warning',
'message' => 'File operations should use WP_Filesystem methods instead of direct PHP filesystem calls. Found: %s()',
sandeshjangam marked this conversation as resolved.
Show resolved Hide resolved
'since' => '2.5.0',
'functions' => array(
'chgrp',
'chmod',
'chown',
'is_writable',
'is_writeable',
'mkdir',
'rmdir',
'touch',
GaryJones marked this conversation as resolved.
Show resolved Hide resolved
'readfile',
'fclose',
'fopen',
Expand All @@ -139,6 +165,7 @@ public function getGroups() {
'file_put_contents',
'fsockopen',
'pfsockopen',
'fputs',
),
),

Expand Down