Skip to content

Commit

Permalink
rebuildData to output more verbose info, add --ignore-exceptions, r…
Browse files Browse the repository at this point in the history
…efs 1327

Output more verbose information about what entiyt is being rebuild.

- Add `--ignore-exceptions` and `--redirects` option
- Add `--exception-log` to specify a location otherwise the SMW root diretory is used
- Option `--categories` is `-c`
  • Loading branch information
mwjames committed Mar 5, 2016
1 parent 7bd74da commit b8073ba
Show file tree
Hide file tree
Showing 11 changed files with 964 additions and 121 deletions.
13 changes: 7 additions & 6 deletions includes/formatters/MessageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,18 @@ protected function doFormat( array $messages ) {
foreach ( $messages as $msg ) {

if ( $msg instanceof \Message ) {
$newArray[] = $msg->inLanguage( $this->language )->text();
$text = $msg->inLanguage( $this->language )->text();
$newArray[md5( $text )] = $text;
} elseif ( (array)$msg === $msg ) {
foreach ( $this->doFormat( $msg ) as $m ) {
$newArray[] = $m;
$newArray[md5( $m )] = $m;
}
} elseif ( (string)$msg === $msg ) {
$newArray[] = $msg;
$newArray[md5( $msg )] = $msg;
}
}

return array_unique( $newArray );
return $newArray;
}

/**
Expand All @@ -232,9 +233,9 @@ protected function doFormat( array $messages ) {
protected function getString( $html = true ) {

if ( $this->escape ) {
$messages = array_map( 'htmlspecialchars', $this->doFormat( $this->messages ) );
$messages = array_map( 'htmlspecialchars', array_values( $this->doFormat( $this->messages ) ) );
} else {
$messages = $this->doFormat( $this->messages );
$messages = array_values( $this->doFormat( $this->messages ) );
}

if ( count( $messages ) == 1 ) {
Expand Down
6 changes: 5 additions & 1 deletion maintenance/rebuildData.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ protected function addDefaultParams() {
'May leave the wiki temporarily incomplete.', false );

$this->addOption( 'v', 'Be verbose about the progress', false );
$this->addOption( 'c', 'Will refresh only category pages (and other explicitly named namespaces)', false );
$this->addOption( 'categories', 'Will refresh only category pages (and other explicitly named namespaces)', false, false, 'c' );
$this->addOption( 'p', 'Will refresh only property pages (and other explicitly named namespaces)', false );
$this->addOption( 'redirects', 'Only refresh redirect pages', false );

$this->addOption( 'skip-properties', 'Skip the default properties rebuild (only recommended when successive build steps are used)', false );
$this->addOption( 'shallow-update', 'Skip processing of entitites that compare to the last known revision date', false );

$this->addOption( 'ignore-exceptions', 'Ignore exceptions and log exception to a file', false );
$this->addOption( 'exception-log', 'Exception log file location (e.g. /tmp/logs/)', false, true );

$this->addOption( 'page', '<pagelist> Will refresh only the pages of the given names, with | used as a separator. ' .
'Example: --page "Page 1|Page 2" refreshes Page 1 and Page 2 Options -s, -e, -n, ' .
'--startidfile, -c, -p, -t are ignored if --page is given.', false, true );
Expand Down
Loading

0 comments on commit b8073ba

Please sign in to comment.