ARGUS WordPress Defence 1.0.0 — first production release
Automatic WordPress security: local firewall, malware and file-integrity scanning, vulnerability protection, quarantine, scheduled backups, an optional page cache, and automatic global threat intelligence. See README.md for installation, update, and uninstall instructions.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
$dir = $argv[1] ?? null;
|
||||
if ( ! $dir || ! is_dir( $dir ) ) {
|
||||
fwrite( STDERR, "Usage: php strip-comments.php <directory>\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator( $dir, FilesystemIterator::SKIP_DOTS )
|
||||
);
|
||||
|
||||
$count = 0;
|
||||
$skipped = 0;
|
||||
foreach ( $iterator as $file ) {
|
||||
if ( 'php' !== strtolower( $file->getExtension() ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'argus-wordpress-defence.php' === $file->getFilename() ) {
|
||||
$skipped++;
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
$stripped = php_strip_whitespace( $path );
|
||||
if ( '' === trim( (string) $stripped ) ) {
|
||||
fwrite( STDERR, "WARNING: stripping produced empty output for {$path}, leaving original untouched\n" );
|
||||
continue;
|
||||
}
|
||||
file_put_contents( $path, $stripped );
|
||||
$count++;
|
||||
}
|
||||
|
||||
echo "Stripped comments/whitespace from {$count} PHP files ({$skipped} skipped: plugin header file).\n";
|
||||
Reference in New Issue
Block a user