Maintenance: Move OrderedStreamingForkController to PSR-4 namespace

* Improve class docs while at it.
* Fix the odd file-level docblock that was combined with the
  class block in a way virtually no other file in core does.

Bug: T166010
Change-Id: Iefcece6da487166f04ccf8be94a24749c9ef97e2
This commit is contained in:
Timo Tijhof 2022-10-15 23:12:43 +01:00
parent 59fd86d553
commit 77dbe2d19c
3 changed files with 31 additions and 22 deletions

View file

@ -1171,7 +1171,7 @@ $wgAutoloadLocalClasses = [
'OldChangesList' => __DIR__ . '/includes/changes/OldChangesList.php',
'OldLocalFile' => __DIR__ . '/includes/filerepo/file/OldLocalFile.php',
'OldRevisionImporter' => __DIR__ . '/includes/import/OldRevisionImporter.php',
'OrderedStreamingForkController' => __DIR__ . '/includes/OrderedStreamingForkController.php',
'OrderedStreamingForkController' => __DIR__ . '/includes/Maintenance/OrderedStreamingForkController.php',
'OrphanStats' => __DIR__ . '/maintenance/storage/orphanStats.php',
'OutputPage' => __DIR__ . '/includes/OutputPage.php',
'PHPVersionCheck' => __DIR__ . '/includes/PHPVersionCheck.php',

View file

@ -1,7 +1,5 @@
<?php
/**
* Class for managing forking command line scripts.
*
* 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
@ -28,9 +26,10 @@ use ObjectCache;
use RedisConnectionPool;
/**
* Class for managing forking command line scripts.
* Currently just does forking and process control, but it could easily be extended
* to provide IPC and job dispatch.
* Manage forking inside CLI maintenance scripts.
*
* Only handles forking and process control. In the future, this could
* be extended to provide IPC and job dispatch.
*
* This class requires the posix and pcntl extensions.
*

View file

@ -1,21 +1,5 @@
<?php
use MediaWiki\Maintenance\ForkController;
/**
* Reads lines of work from an input stream and farms them out to multiple
* child streams. Each child has exactly one piece of work in flight at a given
* moment. Writes the result of child's work to an output stream. If numProcs
* <= zero the work will be performed in process.
*
* This class amends MediaWiki\Maintenance\ForkController with the requirement that the output is
* produced in the same exact order as input values were.
*
* Currently used by CirrusSearch extension to implement CLI search script.
*
* @ingroup Maintenance
* @since 1.30
*
* 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
@ -30,6 +14,30 @@ use MediaWiki\Maintenance\ForkController;
* 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\Maintenance;
/**
* Apply a transformation to values via a pool of sub processes.
*
* The controller reads lines from a given input stream, where each line
* describes work to be done. This work is then farmed out to multiple
* child streams that correspond to child procesess. Each child has exactly
* one piece of work in-flight at a given moment. The result of each work
* is written to an output stream.
*
* If numProcs is zero, the fallback is to perform work in-process instead.
*
* This class guarantees that the output is produced in the same exact order
* as input values were.
*
* Currently used by CirrusSearch extension to implement CLI search script.
*
* @ingroup Maintenance
* @since 1.30
*/
class OrderedStreamingForkController extends ForkController {
/** @var callable */
@ -222,3 +230,5 @@ class OrderedStreamingForkController extends ForkController {
}
}
}
class_alias( OrderedStreamingForkController::class, 'OrderedStreamingForkController' );