From: Brion Vibber Date: Mon, 25 Feb 2008 21:27:45 +0000 (+0000) Subject: Revert r31232 -- duplicates updateRestrictions.php X-Git-Tag: 1.31.0-rc.0~49350 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=8483b6ddb8b66e996c263a20f7a2aee765dabe89;p=lhc%2Fweb%2Fwiklou.git Revert r31232 -- duplicates updateRestrictions.php --- diff --git a/maintenance/fixPageRestrictions.php b/maintenance/fixPageRestrictions.php deleted file mode 100644 index dbdc61800e..0000000000 --- a/maintenance/fixPageRestrictions.php +++ /dev/null @@ -1,103 +0,0 @@ - - */ - -require_once( 'commandLine.inc' ); - -$fname = 'fixPageRestrictions.php'; - -$dbw = wfGetDB( DB_MASTER ); - -// Get user IDs which need fixing -$res = $dbw->select( 'page', 'page_id, page_restrictions', 'page_restrictions <>\'\'', $fname ); - -while ( $row = $dbw->fetchObject( $res ) ) { - $id = $row->page_id; - $old_restrictions = $row->page_restrictions; - $edit_restriction = ''; - $move_restriction = ''; - if ( strpos( $old_restrictions, '=' ) !== false ) { - if ( strpos( $old_restrictions, ':' ) !== false ) { - # either "edit=x:move=y" or "move=x:edit=y" - if ( strpos( $old_restrictions, 'edit' ) == 0 ){ - # "edit=x:move=y" - $edit_restriction = substr( $old_restrictions, 5, strlen( $old_restrictions) - strpos( $old_restrictions, ':') - 6); - $move_restriction = substr( $old_restrictions, 5, strlen( $old_restrictions) - strpos( $old_restrictions, ':') - 6); - } else { - # "move=x:edit=y" - $move_restriction = substr( $old_restrictions, 5, strlen( $old_restrictions) - strpos( $old_restrictions, ':') - 6); - $edit_restriction = substr( $old_restrictions, 5, strlen( $old_restrictions) - strpos( $old_restrictions, ':') - 6); - } - } else { - # either "edit=x" or "move=x" - if ( strpos( $old_restrictions, 'edit') !== false ) { - $edit_restriction = substr( $old_restrictions, 5); - } else { - $move_restriction = substr( $old_restrictions, 5); - } - } - } else { - # either "sysop" or "autoconfirmed" -- or an unexpected value - if ( $old_restrictions == 'sysop' ) { - $edit_restriction = 'sysop'; - $move_restriction = 'sysop'; - } elseif ( $old_restrictions == 'autoconfirmed' ) { - $edit_restriction = 'autoconfirmed'; - $move_restriction = 'autoconfirmed'; - } else { - #Shouldn't happen - print "WARNING: I found a record with old restriction set to '$old_restrictions' and I can't handle it!\n"; - } - } - - if ( $edit_restriction <> '' ) { - $dbw->replace( 'page_restrictions', - array(array('pr_page', 'pr_type')), - array( 'pr_page' => $id, 'pr_type' => 'edit' - , 'pr_level' => $edit_restriction, 'pr_cascade' => 0 - , 'pr_expiry' => 'infinity' ), - $fname ); - } - if ( $move_restriction <> '' ) { - $dbw->replace( 'page_restrictions', - array(array('pr_page', 'pr_type')), - array( 'pr_page' => $id, 'pr_type' => 'move' - , 'pr_level' => $move_restriction, 'pr_cascade' => 0 - , 'pr_expiry' => 'infinity' ), - $fname ); - } - - $dbw->update( 'page', array( 'page_restrictions' => ''), array( 'page_id' => $id), $fname); - - print "Fixed restrictions for page_id=$id\n from '$old_restrictions'\n to 'edit=$edit_restriction, move=$move_restriction'\n"; -} -print "\n"; \ No newline at end of file