// Get normal protections for existing titles
if ( count( $this->titles ) ) {
$this->resetQueryParams();
- $this->addTables( array( 'page_restrictions', 'page' ) );
- $this->addWhere( 'page_id=pr_page' );
+ $this->addTables( 'page_restrictions' );
$this->addFields( array( 'pr_page', 'pr_type', 'pr_level',
- 'pr_expiry', 'pr_cascade', 'page_namespace',
- 'page_title' ) );
+ 'pr_expiry', 'pr_cascade' ) );
$this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
$res = $this->select( __METHOD__ );
foreach ( $res as $row ) {
+ $title = $this->titles[$row->pr_page];
$a = array(
'type' => $row->pr_type,
'level' => $row->pr_level,
if ( $row->pr_cascade ) {
$a['cascade'] = '';
}
- $this->protections[$row->page_namespace][$row->page_title][] = $a;
-
- // Also check old restrictions
- if ( $this->pageRestrictions[$row->pr_page] ) {
- $restrictions = explode( ':', trim( $this->pageRestrictions[$row->pr_page] ) );
+ $this->protections[$title->getNamespace()][$title->getDBkey()][] = $a;
+ }
+ // Also check old restrictions
+ foreach( $this->titles as $pageId => $title ) {
+ if ( $this->pageRestrictions[$pageId] ) {
+ $namespace = $title->getNamespace();
+ $dbKey = $title->getDBkey();
+ $restrictions = explode( ':', trim( $this->pageRestrictions[$pageId] ) );
foreach ( $restrictions as $restrict ) {
$temp = explode( '=', trim( $restrict ) );
if ( count( $temp ) == 1 ) {
if ( $restriction == '' ) {
continue;
}
- $this->protections[$row->page_namespace][$row->page_title][] = array(
+ $this->protections[$namespace][$dbKey][] = array(
'type' => 'edit',
'level' => $restriction,
'expiry' => 'infinity',
);
- $this->protections[$row->page_namespace][$row->page_title][] = array(
+ $this->protections[$namespace][$dbKey][] = array(
'type' => 'move',
'level' => $restriction,
'expiry' => 'infinity',
if ( $restriction == '' ) {
continue;
}
- $this->protections[$row->page_namespace][$row->page_title][] = array(
+ $this->protections[$namespace][$dbKey][] = array(
'type' => $temp[0],
'level' => $restriction,
'expiry' => 'infinity',