2007-04-21 21:11:14 +00:00
|
|
|
<?php
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
/**
|
2007-04-21 23:19:18 +00:00
|
|
|
* Makes the required database updates for Special:ProtectedPages
|
2007-04-21 21:44:19 +00:00
|
|
|
* to show all protected pages, even ones before the page restrictions
|
|
|
|
|
* schema change. All remaining page_restriction column values are moved
|
|
|
|
|
* to the new table.
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Maintenance
|
2007-04-21 21:11:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
define( 'BATCH_SIZE', 100 );
|
|
|
|
|
|
|
|
|
|
require_once 'commandLine.inc';
|
|
|
|
|
|
|
|
|
|
$db =& wfGetDB( DB_MASTER );
|
|
|
|
|
if ( !$db->tableExists( 'page_restrictions' ) ) {
|
|
|
|
|
echo "page_restrictions does not exist\n";
|
|
|
|
|
exit( 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
migrate_page_restrictions( $db );
|
|
|
|
|
|
|
|
|
|
function migrate_page_restrictions( $db ) {
|
|
|
|
|
|
|
|
|
|
$start = $db->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
|
|
|
|
|
$end = $db->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ );
|
2008-10-03 21:16:35 +00:00
|
|
|
|
|
|
|
|
if( !$start ) {
|
|
|
|
|
die("Nothing to do.\n");
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-09 18:35:41 +00:00
|
|
|
# Do remaining chunk
|
|
|
|
|
$end += BATCH_SIZE - 1;
|
2007-04-21 21:11:14 +00:00
|
|
|
$blockStart = $start;
|
|
|
|
|
$blockEnd = $start + BATCH_SIZE - 1;
|
2007-05-03 15:39:43 +00:00
|
|
|
$encodedExpiry = 'infinity';
|
2007-04-21 21:11:14 +00:00
|
|
|
while ( $blockEnd <= $end ) {
|
2008-04-09 18:35:41 +00:00
|
|
|
echo "...doing page_id from $blockStart to $blockEnd\n";
|
2007-05-01 18:58:54 +00:00
|
|
|
$cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !='' AND page_restrictions !='edit=:move='";
|
2007-04-21 21:11:14 +00:00
|
|
|
$res = $db->select( 'page', array('page_id', 'page_restrictions'), $cond, __FUNCTION__ );
|
|
|
|
|
$batch = array();
|
|
|
|
|
while ( $row = $db->fetchObject( $res ) ) {
|
|
|
|
|
$oldRestrictions = array();
|
|
|
|
|
foreach( explode( ':', trim( $row->page_restrictions ) ) as $restrict ) {
|
|
|
|
|
$temp = explode( '=', trim( $restrict ) );
|
|
|
|
|
if(count($temp) == 1) {
|
|
|
|
|
// old old format should be treated as edit/move restriction
|
2007-04-23 19:50:10 +00:00
|
|
|
$oldRestrictions["edit"] = trim( $temp[0] );
|
|
|
|
|
$oldRestrictions["move"] = trim( $temp[0] );
|
2007-04-21 21:11:14 +00:00
|
|
|
} else {
|
2007-04-23 19:50:10 +00:00
|
|
|
$oldRestrictions[$temp[0]] = trim( $temp[1] );
|
2007-04-21 21:11:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
# Update restrictions table
|
|
|
|
|
foreach( $oldRestrictions as $action => $restrictions ) {
|
|
|
|
|
$batch[] = array(
|
|
|
|
|
'pr_page' => $row->page_id,
|
|
|
|
|
'pr_type' => $action,
|
|
|
|
|
'pr_level' => $restrictions,
|
|
|
|
|
'pr_cascade' => 0,
|
|
|
|
|
'pr_expiry' => $encodedExpiry
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
# We use insert() and not replace() as Article.php replaces
|
|
|
|
|
# page_restrictions with '' when protected in the restrictions table
|
|
|
|
|
if ( count( $batch ) ) {
|
2007-12-03 19:16:56 +00:00
|
|
|
$db->insert( 'page_restrictions', $batch, __FUNCTION__, array( 'IGNORE' ) );
|
2007-04-21 21:11:14 +00:00
|
|
|
}
|
2008-04-09 18:35:41 +00:00
|
|
|
$blockStart += BATCH_SIZE - 1;
|
|
|
|
|
$blockEnd += BATCH_SIZE - 1;
|
2007-04-21 21:11:14 +00:00
|
|
|
wfWaitForSlaves( 5 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-29 01:19:14 +00:00
|
|
|
|