Tinaj1234 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/108219
Change subject: Removing page_restrictions from page table
......................................................................
Removing page_restrictions from page table
Experimental patch-Do not merge.
Removing page_restrictions from page table as it is superseded by the
page_restriction table.
Bug: 33334
Change-Id: I1509ad3cc9a99eeff7df4cfc548dd1640053ccc7
---
M includes/WikiPage.php
M includes/api/ApiQueryInfo.php
M includes/installer/MysqlUpdater.php
M includes/installer/SqliteUpdater.php
A maintenance/archives/patch-drop-page_restrictions.sql
A maintenance/sqlite/archives/patch-drop-page_restrictions.sql
M maintenance/tables.sql
7 files changed, 51 insertions(+), 23 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/19/108219/1
diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 8c035aa..d8988af 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -278,7 +278,6 @@
'page_id',
'page_namespace',
'page_title',
- 'page_restrictions',
'page_counter',
'page_is_redirect',
'page_is_new',
@@ -407,7 +406,6 @@
$this->mTitle->loadFromRow( $data );
// Old-fashioned restrictions
- $this->mTitle->loadRestrictions(
$data->page_restrictions );
$this->mId = intval( $data->page_id );
$this->mCounter = intval( $data->page_counter );
@@ -1253,7 +1251,6 @@
'page_namespace' => $this->mTitle->getNamespace(),
'page_title' => $this->mTitle->getDBkey(),
'page_counter' => 0,
- 'page_restrictions' => '',
'page_is_redirect' => 0, // Will set this shortly...
'page_is_new' => 1,
'page_random' => wfRandom(),
@@ -2405,7 +2402,6 @@
// Clear out legacy restriction fields
$dbw->update(
'page',
- array( 'page_restrictions' => '' ),
array( 'page_id' => $id ),
__METHOD__
);
@@ -2594,20 +2590,20 @@
* @throws MWException
* @return String
*/
- protected static function flattenRestrictions( $limit ) {
- if ( !is_array( $limit ) ) {
- throw new MWException( 'WikiPage::flattenRestrictions
given non-array restriction set' );
- }
-
- $bits = array();
- ksort( $limit );
-
- foreach ( array_filter( $limit ) as $action => $restrictions ) {
- $bits[] = "$action=$restrictions";
- }
-
- return implode( ':', $bits );
- }
+// protected static function flattenRestrictions( $limit ) {
+// if ( !is_array( $limit ) ) {
+// throw new MWException( 'WikiPage::flattenRestrictions
given non-array restriction set' );
+// }
+//
+// $bits = array();
+// ksort( $limit );
+//
+// foreach ( array_filter( $limit ) as $action => $restrictions ) {
+// $bits[] = "$action=$restrictions";
+// }
+//
+// return implode( ':', $bits );
+// }
/**
* Same as doDeleteArticleReal(), but returns a simple boolean. This is
kept around for
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index 43b8c0c..bc12675 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -59,7 +59,6 @@
public function requestExtraData( $pageSet ) {
global $wgDisableCounters, $wgContentHandlerUseDB;
- $pageSet->requestField( 'page_restrictions' );
// when resolving redirects, no page will have this field
if ( !$pageSet->isResolvingRedirects() ) {
$pageSet->requestField( 'page_is_redirect' );
@@ -288,7 +287,6 @@
}
}
- $this->pageRestrictions = $pageSet->getCustomField(
'page_restrictions' );
// when resolving redirects, no page will have this field
$this->pageIsRedir = !$pageSet->isResolvingRedirects()
? $pageSet->getCustomField( 'page_is_redirect' )
diff --git a/includes/installer/MysqlUpdater.php
b/includes/installer/MysqlUpdater.php
index 9dfbff8..96eb3bb 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -249,6 +249,8 @@
array( 'addIndex', 'logging',
'log_user_text_type_time', 'patch-logging_user_text_type_time_index.sql' ),
array( 'addIndex', 'logging', 'log_user_text_time',
'patch-logging_user_text_time_index.sql' ),
array( 'addField', 'page', 'page_links_updated',
'patch-page_links_updated.sql' ),
+ array( 'dropField', 'page', 'page_restrictions',
'patch-drop-page_restrictions.sql' ),
+
);
}
diff --git a/includes/installer/SqliteUpdater.php
b/includes/installer/SqliteUpdater.php
index 3db3758..e70ee68 100644
--- a/includes/installer/SqliteUpdater.php
+++ b/includes/installer/SqliteUpdater.php
@@ -126,6 +126,8 @@
array( 'addIndex', 'logging',
'log_user_text_type_time', 'patch-logging_user_text_type_time_index.sql' ),
array( 'addIndex', 'logging', 'log_user_text_time',
'patch-logging_user_text_time_index.sql' ),
array( 'addField', 'page', 'page_links_updated',
'patch-page_links_updated.sql' ),
+ array( 'dropField', 'page', 'page_restrictions',
'patch-drop-page_restrictions.sql' ),
+
);
}
diff --git a/maintenance/archives/patch-drop-page_restrictions.sql
b/maintenance/archives/patch-drop-page_restrictions.sql
new file mode 100644
index 0000000..32c5e9e
--- /dev/null
+++ b/maintenance/archives/patch-drop-page_restrictions.sql
@@ -0,0 +1,3 @@
+-- page_restrictions is superseded by the page_restriction table, delete it
+
+ALTER TABLE /*$wgDBprefix*/page DROP COLUMN page_restrictions;
diff --git a/maintenance/sqlite/archives/patch-drop-page_restrictions.sql
b/maintenance/sqlite/archives/patch-drop-page_restrictions.sql
new file mode 100644
index 0000000..6aec5c2
--- /dev/null
+++ b/maintenance/sqlite/archives/patch-drop-page_restrictions.sql
@@ -0,0 +1,29 @@
+-- page_restrictions is superseded by the page_restriction table, hence delete
it
+
+CREATE TABLE /*_*/page_tmp(
+ page_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ page_namespace int NOT NULL,
+ page_title varchar(255) binary NOT NULL,
+ page_counter bigint unsigned NOT NULL default 0,
+ page_is_redirect tinyint unsigned NOT NULL default 0,
+ page_is_new tinyint unsigned NOT NULL default 0,
+ page_random real unsigned NOT NULL,
+ page_touched binary(14) NOT NULL default '',
+ page_links_updated varbinary(14) NULL default NULL,
+ page_latest int unsigned NOT NULL,
+ page_len int unsigned NOT NULL,
+ page_content_model varbinary(32) DEFAULT NULL
+)/*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/page_tmp
+ SELECT page_id, page_namespace, page_title, page_counter,
page_is_redirect, page_is_new, page_random, page_touched, page_links_updated,
page_content_model, page_latest, page_len
+ FROM /*_*/page;
+
+DROP TABLE /*_*/page;
+
+ALTER TABLE /*_*/page_tmp RENAME TO /*_*/page;
+
+CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
+CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
+CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
+CREATE INDEX /*i*/page_redirect_namespace_len ON /*_*/page (page_is_redirect,
page_namespace, page_len);
\ No newline at end of file
diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index fb2f0e1..4e9fd50 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -232,9 +232,7 @@
-- Spaces are transformed into underscores in title storage.
page_title varchar(255) binary NOT NULL,
- -- Comma-separated set of permission keys indicating who
- -- can move or edit the page.
- page_restrictions tinyblob NOT NULL,
+
-- Number of times this page has been viewed.
page_counter bigint unsigned NOT NULL default 0,
--
To view, visit https://gerrit.wikimedia.org/r/108219
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1509ad3cc9a99eeff7df4cfc548dd1640053ccc7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tinaj1234 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits