dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix typo in trunk as in branch (r103778)
[lhc/web/wiklou.git]
/
maintenance
/
rollbackEdits.php
diff --git
a/maintenance/rollbackEdits.php
b/maintenance/rollbackEdits.php
index
86ca3ee
..
6a7e85a
100644
(file)
--- a/
maintenance/rollbackEdits.php
+++ b/
maintenance/rollbackEdits.php
@@
-21,7
+21,7
@@
* @ingroup Maintenance
*/
* @ingroup Maintenance
*/
-require_once( dirname(
__FILE__
) . '/Maintenance.php' );
+require_once( dirname(
__FILE__
) . '/Maintenance.php' );
class RollbackEdits extends Maintenance {
public function __construct() {
class RollbackEdits extends Maintenance {
public function __construct() {
@@
-36,7
+36,7
@@
class RollbackEdits extends Maintenance {
public function execute() {
$user = $this->getOption( 'user' );
$username = User::isIP( $user ) ? $user : User::getCanonicalName( $user );
public function execute() {
$user = $this->getOption( 'user' );
$username = User::isIP( $user ) ? $user : User::getCanonicalName( $user );
- if( !$username ) {
+ if
( !$username ) {
$this->error( 'Invalid username', true );
}
$this->error( 'Invalid username', true );
}
@@
-44,10
+44,10
@@
class RollbackEdits extends Maintenance {
$summary = $this->getOption( 'summary', $this->mSelf . ' mass rollback' );
$titles = array();
$results = array();
$summary = $this->getOption( 'summary', $this->mSelf . ' mass rollback' );
$titles = array();
$results = array();
- if( $this->hasOption( 'titles' ) ) {
- foreach( explode( '|', $this->getOption( 'titles' ) ) as $title ) {
+ if
( $this->hasOption( 'titles' ) ) {
+ foreach
( explode( '|', $this->getOption( 'titles' ) ) as $title ) {
$t = Title::newFromText( $title );
$t = Title::newFromText( $title );
- if( !$t ) {
+ if
( !$t ) {
$this->error( 'Invalid title, ' . $title );
} else {
$titles[] = $t;
$this->error( 'Invalid title, ' . $title );
} else {
$titles[] = $t;
@@
-57,15
+57,15
@@
class RollbackEdits extends Maintenance {
$titles = $this->getRollbackTitles( $user );
}
$titles = $this->getRollbackTitles( $user );
}
- if( !$titles ) {
+ if
( !$titles ) {
$this->output( 'No suitable titles to be rolled back' );
return;
}
$this->output( 'No suitable titles to be rolled back' );
return;
}
- foreach( $titles as $t ) {
+ foreach
( $titles as $t ) {
$a = new Article( $t );
$this->output( 'Processing ' . $t->getPrefixedText() . '...' );
$a = new Article( $t );
$this->output( 'Processing ' . $t->getPrefixedText() . '...' );
- if( !$a->commitRollback( $user, $summary, $bot, $results ) ) {
+ if
( !$a->commitRollback( $user, $summary, $bot, $results ) ) {
$this->output( "done\n" );
} else {
$this->output( "failed\n" );
$this->output( "done\n" );
} else {
$this->output( "failed\n" );
@@
-76,6
+76,7
@@
class RollbackEdits extends Maintenance {
/**
* Get all pages that should be rolled back for a given user
* @param $user String a name to check against rev_user_text
/**
* Get all pages that should be rolled back for a given user
* @param $user String a name to check against rev_user_text
+ * @return array
*/
private function getRollbackTitles( $user ) {
$dbr = wfGetDB( DB_SLAVE );
*/
private function getRollbackTitles( $user ) {
$dbr = wfGetDB( DB_SLAVE );
@@
-83,10
+84,10
@@
class RollbackEdits extends Maintenance {
$results = $dbr->select(
array( 'page', 'revision' ),
array( 'page_namespace', 'page_title' ),
$results = $dbr->select(
array( 'page', 'revision' ),
array( 'page_namespace', 'page_title' ),
- array( 'page
.page_latest = revision.rev_id', 'revision.rev_user_text' =>
$user ),
+ array( 'page
_latest = rev_id', 'rev_user_text' =>
$user ),
__METHOD__
);
__METHOD__
);
-
while( $row = $dbr->fetchObject( $results )
) {
+
foreach ( $results as $row
) {
$titles[] = Title::makeTitle( $row->page_namespace, $row->page_title );
}
return $titles;
$titles[] = Title::makeTitle( $row->page_namespace, $row->page_title );
}
return $titles;
@@
-94,4
+95,4
@@
class RollbackEdits extends Maintenance {
}
$maintClass = 'RollbackEdits';
}
$maintClass = 'RollbackEdits';
-require_once(
DO_MAINTENANCE
);
+require_once(
RUN_MAINTENANCE_IF_MAIN
);