mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
4
NEWS.md
4
NEWS.md
@ -9,6 +9,10 @@ For changes prior to version 6.0.0, please see [`NEWS.old`](news.old).
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### New
|
||||||
|
|
||||||
|
- Added a `--verbose` (`-v`) option to the command line script.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Ensure compatibility with the PageForms extension (#58)
|
- Ensure compatibility with the PageForms extension (#58)
|
||||||
|
@ -195,7 +195,7 @@ line
|
|||||||
|
|
||||||
to `LocalSettings.php`.
|
to `LocalSettings.php`.
|
||||||
|
|
||||||
#### Maintenance script
|
#### Commandline
|
||||||
|
|
||||||
If you have access to a shell on the server that runs your wiki, and are allowed
|
If you have access to a shell on the server that runs your wiki, and are allowed
|
||||||
to execute `/bin/php` on the command line, you can use the extension's
|
to execute `/bin/php` on the command line, you can use the extension's
|
||||||
@ -215,6 +215,13 @@ page that was processed (e.g., 37), and use the maintenance script with the
|
|||||||
|
|
||||||
php linktitles-cli.php -s 37
|
php linktitles-cli.php -s 37
|
||||||
|
|
||||||
|
For more verbose output that also includes the page title, use the `--verbose`
|
||||||
|
option (or short `-v`):
|
||||||
|
|
||||||
|
php linktitles-cli.php -s 37 -v
|
||||||
|
|
||||||
|
In verbose mode, the script will output all page titles one by one.
|
||||||
|
|
||||||
See all available options with:
|
See all available options with:
|
||||||
|
|
||||||
php linktitles-cli.php -h
|
php linktitles-cli.php -h
|
||||||
|
@ -79,6 +79,13 @@ class Cli extends \Maintenance {
|
|||||||
true, // requires argument
|
true, // requires argument
|
||||||
"p"
|
"p"
|
||||||
);
|
);
|
||||||
|
$this->addOption(
|
||||||
|
"verbose",
|
||||||
|
"print detailed progress information",
|
||||||
|
false, // not required
|
||||||
|
false, // does not require an argument
|
||||||
|
"v"
|
||||||
|
);
|
||||||
// TODO: Add back logging options.
|
// TODO: Add back logging options.
|
||||||
// TODO: Add configuration options.
|
// TODO: Add configuration options.
|
||||||
// $this->addOption(
|
// $this->addOption(
|
||||||
@ -153,6 +160,7 @@ class Cli extends \Maintenance {
|
|||||||
*/
|
*/
|
||||||
private function allPages( $index = 0 ) {
|
private function allPages( $index = 0 ) {
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
$verbose = $this->hasOption( 'verbose' );
|
||||||
|
|
||||||
// Retrieve page names from the database.
|
// Retrieve page names from the database.
|
||||||
$dbr = $this->getDB( DB_REPLICA );
|
$dbr = $this->getDB( DB_REPLICA );
|
||||||
@ -178,7 +186,21 @@ class Cli extends \Maintenance {
|
|||||||
$title = \Title::makeTitleSafe( $row->page_namespace, $row->page_title );
|
$title = \Title::makeTitleSafe( $row->page_namespace, $row->page_title );
|
||||||
$numProcessed += 1;
|
$numProcessed += 1;
|
||||||
$index += 1;
|
$index += 1;
|
||||||
$this->output( sprintf( "\rPage #%d (%02.0f%%) ", $index, $numProcessed / $numPages * 100 ) );
|
if ( $verbose ) {
|
||||||
|
$this->output(
|
||||||
|
sprintf(
|
||||||
|
"%s - processed %5d of %5d (%2.0f%%) - index %5d - %s",
|
||||||
|
date("c", time()),
|
||||||
|
$numProcessed,
|
||||||
|
$numPages,
|
||||||
|
$numProcessed / $numPages * 100,
|
||||||
|
$index,
|
||||||
|
$title
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->output( sprintf( "\rPage #%d (%02.0f%%) ", $index, $numProcessed / $numPages * 100 ) );
|
||||||
|
}
|
||||||
Extension::processPage( $title, $context );
|
Extension::processPage( $title, $context );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user