r113451 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113450‎ | r113451 | r113452 >
Date:02:10, 9 March 2012
Author:bsitu
Status:resolved (Comments)
Tags:
Comment:
PageTriage new tables, getMetaData API and database access file
Modified paths:
  • /trunk/extensions/PageTriage/PageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/api/ApiPageTriageGetMetadata.php (added) (history)
  • /trunk/extensions/PageTriage/includes (added) (history)
  • /trunk/extensions/PageTriage/includes/ArticleMetadata.php (added) (history)
  • /trunk/extensions/PageTriage/sql/PageTriagePage.sql (added) (history)
  • /trunk/extensions/PageTriage/sql/PageTriagePageTags.sql (added) (history)
  • /trunk/extensions/PageTriage/sql/PageTriageTags.sql (added) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/sql/PageTriagePageTags.sql
@@ -0,0 +1,9 @@
 2+-- Store the metadata for article to be triaged
 3+CREATE TABLE /*_*/pagetriage_page_tags (
 4+ ptrpt_page_id int unsigned NOT NULL,
 5+ ptrpt_tag_id int unsigned NOT NULL,
 6+ ptrpt_value varbinary(255) NOT NULL
 7+) /*$wgDBTableOptions*/;
 8+
 9+CREATE UNIQUE INDEX /*i*/ptrpt_page_tag_id ON /*_*/pagetriage_page_tags (ptrpt_page_id,ptrpt_tag_id);
 10+CREATE INDEX /*i*/ptrpt_tag_id_value ON /*_*/pagetriage_page_tags (ptrpt_tag_id,ptrpt_value);
Property changes on: trunk/extensions/PageTriage/sql/PageTriagePageTags.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/PageTriage/sql/PageTriagePage.sql
@@ -0,0 +1,10 @@
 2+-- Store the list of articles to be triaged or being triaged already
 3+CREATE TABLE /*_*/pagetriage_page (
 4+ ptrp_id int unsigned NOT NULL PRIMARY KEY auto_increment,
 5+ ptrp_page_id int unsigned NOT NULL,
 6+ ptrp_triaged tinyint unsigned not null default 0,
 7+ ptrp_timestamp varbinary(14) NOT NULL
 8+) /*$wgDBTableOptions*/;
 9+
 10+CREATE UNIQUE INDEX /*i*/ptrp_page_id ON /*_*/pagetriage_page (ptrp_page_id);
 11+CREATE INDEX /*i*/ptrp_timestamp_triaged_id ON /*_*/pagetriage_page (ptrp_triaged, ptrp_timestamp, ptrp_id);
Property changes on: trunk/extensions/PageTriage/sql/PageTriagePage.sql
___________________________________________________________________
Added: svn:eol-style
112 + native
Index: trunk/extensions/PageTriage/sql/PageTriageTags.sql
@@ -0,0 +1,28 @@
 2+-- Article metadata types
 3+CREATE TABLE /*_*/pagetriage_tags (
 4+ ptrt_tag_id int unsigned NOT NULL PRIMARY KEY auto_increment,
 5+ ptrt_tag_name varbinary(20) NOT NULL,
 6+ ptrt_tag_desc varbinary(255) NOT NULL
 7+) /*$wgDBTableOptions*/;
 8+
 9+CREATE UNIQUE INDEX /*i*/ptrt_tag_id ON /*_*/pagetriage_tags (ptrt_tag_name);
 10+
 11+INSERT INTO pagetriage_tags (ptrt_tag_name, ptrt_tag_desc)
 12+VALUES
 13+('title', 'Article title'),
 14+('linkcount', 'Number of inbound links'),
 15+('category_count', 'Category mapping count'),
 16+('csd_status', 'CSD status'),
 17+('prod_status', 'PROD status'),
 18+('blp_prod_status', 'BLP PROD status'),
 19+('afd_status', 'AFD status'),
 20+('patrol_status', 'Already review/triaged'),
 21+('rev_count', 'Number of edits to the article'),
 22+('page_len', 'Number of bytes of article'),
 23+('creation_date', 'Article creation date'),
 24+('snippet', 'Beginning of article snippet'),
 25+('user_name', 'User name'),
 26+('user_editcount', 'User total edit'),
 27+('user_creation_date', 'User registration date'),
 28+('user_autoconfirmed', 'Check if user is autoconfirmed' ),
 29+('user_block_status', 'User block status');
Property changes on: trunk/extensions/PageTriage/sql/PageTriageTags.sql
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: trunk/extensions/PageTriage/includes/ArticleMetadata.php
@@ -0,0 +1,422 @@
 2+<?php
 3+
 4+class ArticleMetadata {
 5+
 6+ protected $mPageId;
 7+
 8+ /**
 9+ * @param $pageId array - list of page id
 10+ */
 11+ public function __construct( $pageId = array() ) {
 12+ if ( !$pageId ) {
 13+ throw new MWArticleMetadataMissingPageIdException( 'Missing page id' );
 14+ }
 15+
 16+ $this->mPageId = $pageId;
 17+ }
 18+
 19+ /**
 20+ * Compile the metadata for an article, should be triggered on article save
 21+ * @return array|bool
 22+ */
 23+ public function compileMetadata( ) {
 24+ $metaData = array();
 25+
 26+ //Start the data compilation
 27+ if ( $this->compileArticleBasicData( $metaData ) ) {
 28+ $this->compileUserBasicData( $metaData );
 29+ $this->compileDeletionTagData( $metaData );
 30+
 31+ $tags = self::getValidTags();
 32+ $dbw = wfGetDB( DB_MASTER );
 33+ foreach ( $metaData as $pageId => $data ) {
 34+ $this->setMetadataToCache( $pageId, $data );
 35+ //Make sure either all or none metadata for a single page_id
 36+ $dbw->begin();
 37+ foreach ( $data as $key => $val) {
 38+ if ( isset( $tags[$key] ) ) {
 39+ $row = array (
 40+ 'ptrpt_page_id' => $pageId,
 41+ 'ptrpt_tag_id' => $tags[$key],
 42+ 'ptrpt_value' => $val
 43+ );
 44+ }
 45+ $dbw->replace( 'pagetriage_page_tags', array( 'ptrpt_page_id', 'ptrpt_tag_id' ), $row, __METHOD__ );
 46+ }
 47+ $dbw->commit();
 48+ }
 49+ }
 50+
 51+ return $metaData;
 52+ }
 53+
 54+ /**
 55+ * Flush the metadata in cache
 56+ * @param $pageId - page id to be flushed, if null is provided, all
 57+ * page id in $this->mPageId will be flushed
 58+ */
 59+ protected function flushMetadataFromCache( $pageId = null ) {
 60+ global $wgMemc;
 61+
 62+ $keyPrefix = $this->memcKeyPrefix();
 63+ if ( is_null( $pageId ) ) {
 64+ foreach ( $this->mPageId as $pageId ) {
 65+ $wgMemc->delete( $keyPrefix . '-' . $pageId );
 66+ }
 67+ } else {
 68+ $wgMemc->delete( $keyPrefix . '-' . $pageId );
 69+ }
 70+ }
 71+
 72+ /**
 73+ * Set the metadata to cache
 74+ */
 75+ protected function setMetadataToCache( $pageId, $singleData ) {
 76+ global $wgMemc;
 77+
 78+ $this->flushMetadataFromCache( $pageId );
 79+ $wgMemc->set( $this->memcKeyPrefix() . '-' . $pageId, $singleData );
 80+ }
 81+
 82+ /**
 83+ * Get the metadata from cache
 84+ * @param $pageId - the page id to get the cache data for, if null is provided
 85+ * all page id in $this->mPageId will be obtained
 86+ */
 87+ protected function getMetadataFromCache( $pageId = null ) {
 88+ global $wgMemc;
 89+
 90+ $keyPrefix = $this->memcKeyPrefix();
 91+
 92+ if ( is_null( $pageId ) ) {
 93+ $metaData = array();
 94+ foreach ( $this->mPageId as $pageId ) {
 95+ $metaDataCache = $wgMemc->get( $keyPrefix . '-' . $pageId );
 96+ if ( $metaDataCache !== false ) {
 97+ $metaData[$pageId] = $metaDataCache;
 98+ }
 99+ }
 100+ return $metaData;
 101+ } else {
 102+ return $wgMemc->get( $keyPrefix . '-' . $pageId );;
 103+ }
 104+ }
 105+
 106+ /**
 107+ * Return the prefix of memcache key for article metadata
 108+ * @return string
 109+ */
 110+ protected function memcKeyPrefix() {
 111+ return wfMemcKey( 'article', 'metadata' );
 112+ }
 113+
 114+ /**
 115+ * Get the metadata for a single or list of articles
 116+ * @return array
 117+ */
 118+ public function getMetadata() {
 119+ $articles = $this->mPageId;
 120+ $metaData = $this->getMetadataFromCache();
 121+
 122+ foreach ( $articles as $key => $pageId ) {
 123+ if ( isset( $metaData[$pageId] ) ) {
 124+ unset( $articles[$key] );
 125+ }
 126+ }
 127+
 128+ // Articles with no metadata after cache attempt
 129+ if ( $articles ) {
 130+ $dbr = wfGetDB( DB_SLAVE );
 131+
 132+ $res = $dbr->select(
 133+ array( 'pagetriage_page_tags', 'pagetriage_tags' ),
 134+ array( 'ptrpt_page_id', 'ptrt_tag_name', 'ptrpt_value' ),
 135+ array( 'ptrpt_page_id' => $articles, 'ptrpt_tag_id = ptrt_tag_id' ),
 136+ __METHOD__
 137+ );
 138+
 139+ $pageData = array();
 140+ foreach ( $res as $row ) {
 141+ $pageData[$row->ptrpt_page_id][$row->ptrt_tag_name] = $row->ptrpt_value;
 142+ }
 143+
 144+ foreach ( $pageData as $pageId => $val ) {
 145+ $this->setMetadataToCache( $pageId, $val );
 146+ }
 147+ $metaData += $pageData;
 148+
 149+ // Double check articles with no metadata yet, maybe we do not want to do this on the fly since
 150+ // compiling page especially multipla pages at the same request is quite expensive
 151+ // @todo discuss this
 152+ foreach ( $articles as $key => $pageId ) {
 153+ if ( isset( $metaData[$pageId] ) ) {
 154+ unset( $articles[$key] );
 155+ }
 156+ }
 157+ if ( $articles ) {
 158+ $self = new ArticleMetadata( $articles );
 159+ $metaData += $self->compileMetadata( $articles );
 160+ }
 161+ }
 162+
 163+ return $metaData;
 164+ }
 165+
 166+ /**
 167+ * Return a list of valid metadata
 168+ * @return array
 169+ */
 170+ public static function getValidTags() {
 171+ static $tags = array();
 172+
 173+ if ( count( $tags ) > 0 ) {
 174+ return $tags;
 175+ }
 176+
 177+ $dbr = wfGetDB( DB_SLAVE );
 178+
 179+ $res = $dbr->select(
 180+ array( 'pagetriage_tags' ),
 181+ array( 'ptrt_tag_id', 'ptrt_tag_name' ),
 182+ array( ),
 183+ __METHOD__
 184+ );
 185+
 186+ foreach ( $res as $row ) {
 187+ $tags[$row->ptrt_tag_name] = $row->ptrt_tag_id;
 188+ }
 189+
 190+ return $tags;
 191+ }
 192+
 193+ /**
 194+ * Get a list of untriaged articles based on the search criteria
 195+ * @param $criteria array - list of tags for the filter
 196+ * @param $offset string
 197+ * @param $backwards bool - flag to check whether to get data backward
 198+ *
 199+ * @Todo - Pass a range for timestamp to avoid full index scan
 200+ */
 201+ public static function getUnTriagedArticleByMetadata( $criteria = array(), $offset = '', $backwards = false ) {
 202+ global $wgPageTriagePageIdPerRequest;
 203+
 204+ $tags = self::getValidTags();
 205+
 206+ if ( count( $criteria ) > count( $tags ) ) {
 207+ throw new MWArticleMetadataMetaDataOutofBoundException( 'Invalid search criteria are provided' );
 208+ }
 209+
 210+ $dbr = wfGetDB( DB_SLAVE );
 211+
 212+ $table = array( 'pagetriage_page', 'page' );
 213+
 214+ $tagConds = '';
 215+ $tagCount = 0;
 216+ // Check for valid tags and construct tag query
 217+ foreach ( $criteria as $key => $val ) {
 218+ if ( isset( $tags[$key] ) ) {
 219+ if ( $tagConds ) {
 220+ $tagConds .= ' OR ';
 221+ }
 222+ $tagConds .= " ( ptrpt_tag_id = " . $tags[$key] . " AND ptrpt_value = " . $dbr->addQuotes( $val ) . " ) ";
 223+ $tagCount++;
 224+ }
 225+ }
 226+
 227+ $conds = array( 'ptrp_page_id = page_id', 'ptrp_triaged' => '0' );
 228+
 229+ if ( $offset ) {
 230+ $arr = explode( '|', $offset, 2 );
 231+ $ts = $dbr->addQuotes( $dbr->timestamp( $arr[0] ) );
 232+ $id = isset( $arr[1] ) ? intval( $arr[1] ) : 0;
 233+ $op = $backwards ? '<' : '>';
 234+ $conds[] = "ptrp_timestamp $op $ts OR (ptrp_timestamp = $ts AND ptrp_id $op= $id)";
 235+ }
 236+
 237+ $desc = $backwards ? 'DESC' : '';
 238+ $opts = array( 'LIMIT' => $wgPageTriagePageIdPerRequest + 1, "ORDER BY ptrp_timestamp $desc ptrp_id $desc" );
 239+
 240+ if ( $tagCount ) {
 241+ $conds[] = '(' . $tagConds . ')';
 242+ $conds[] = 'ptrpt_page_id = ptrp_page_id';
 243+ $opts['GROUP BY'] = 'ptrpt_page_id';
 244+ $opts['HAVING'] = 'COUNT(ptrpt_tag_id) = ' . $tagCount;
 245+ $table[] = 'pagetriage_page_tags';
 246+ }
 247+
 248+ $res = $dbr->select(
 249+ $table,
 250+ array( 'ptrp_page_id' ),
 251+ $conds,
 252+ __METHOD__,
 253+ $opts
 254+ );
 255+
 256+ return iterator_to_array( $res );
 257+ }
 258+
 259+ /**
 260+ * Compile article basic data like title, number of bytes
 261+ */
 262+ protected function compileArticleBasicData( &$metaData ) {
 263+ global $wgLang;
 264+
 265+ $dbr = wfGetDB( DB_SLAVE );
 266+
 267+ $res = $dbr->select(
 268+ array( 'page', 'revision' ),
 269+ array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'COUNT(rev_id) AS rev_count', 'MIN(rev_timestamp) AS creation_date' ),
 270+ array( 'page_id' => $this->mPageId, 'page_id = rev_page'),
 271+ __METHOD__,
 272+ array ( 'GROUP BY' => 'page_id' )
 273+ );
 274+ foreach ( $res as $row ) {
 275+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 276+ $metaData[$row->page_id]['page_len'] = $row->page_len;
 277+ $metaData[$row->page_id]['creation_date'] = $row->creation_date;
 278+ $metaData[$row->page_id]['rev_count'] = $row->rev_count;
 279+ $metaData[$row->page_id]['title'] = $title->getPrefixedText();
 280+ }
 281+ // Remove any non-existing page_id from $this->mPageId
 282+ foreach ( $this->mPageId as $key => $pageId ) {
 283+ if ( !isset( $metaData[$pageId] ) ) {
 284+ unset($this->mPageId[$key]);
 285+ }
 286+ }
 287+ if ( !$this->mPageId ) {
 288+ return false;
 289+ }
 290+
 291+ $res = $dbr->select(
 292+ array( 'page', 'pagelinks' ),
 293+ array( 'page_id', 'COUNT(pl_from) AS linkcount' ),
 294+ array( 'page_id' => $this->mPageId, 'page_namespace = pl_namespace', 'page_title = pl_title' ),
 295+ __METHOD__,
 296+ array ( 'GROUP BY' => 'page_id' )
 297+ );
 298+ foreach ( $res as $row ) {
 299+ $metaData[$row->page_id]['linkcount'] = $row->linkcount;
 300+ }
 301+ foreach ( $this->mPageId as $pageId ) {
 302+ if ( !isset( $metaData[$row->page_id]['linkcount'] ) ) {
 303+ $metaData[$row->page_id]['linkcount'] = '0';
 304+ }
 305+ }
 306+
 307+ $res = $dbr->select(
 308+ array( 'page', 'categorylinks' ),
 309+ array( 'page_id', 'COUNT(cl_to) AS category_count' ),
 310+ array( 'page_id' => $this->mPageId, 'page_id = cl_from' ),
 311+ __METHOD__,
 312+ array ( 'GROUP BY' => 'page_id' )
 313+ );
 314+ foreach ( $res as $row ) {
 315+ $metaData[$row->page_id]['category_count'] = $row->category_count;
 316+ }
 317+ foreach ( $this->mPageId as $pageId ) {
 318+ if ( !isset( $metaData[$pageId]['category_count'] ) ) {
 319+ $metaData[$pageId]['category_count'] = '0';
 320+ }
 321+ }
 322+
 323+ $res = $dbr->select(
 324+ array( 'text', 'revision', 'page', 'pagetriage_page' ),
 325+ array( 'page_id', 'old_text', 'ptrp_triaged' ),
 326+ array( 'page_id' => $this->mPageId, 'page_id = rev_page', 'rev_text_id = old_id' ),
 327+ __METHOD__,
 328+ array(),
 329+ array( 'pagetriage_page' => array( 'LEFT JOIN', 'page_id = ptrp_page_id' ) )
 330+ );
 331+
 332+ foreach ( $res as $row ) {
 333+ $metaData[$row->page_id]['snippet'] = $wgLang->truncate( $row->old_text, 150 );
 334+ $metaData[$row->page_id]['patrol_status'] = $row->ptrp_triaged ? $row->ptrp_triaged : '0';
 335+ }
 336+
 337+ return true;
 338+ }
 339+
 340+ /**
 341+ * Compile user basic data like username for the author
 342+ * @param $metaData array
 343+ */
 344+ protected function compileUserBasicData( &$metaData ) {
 345+ $dbr = wfGetDB( DB_SLAVE );
 346+
 347+ $res = $dbr->select(
 348+ array( 'revision' ),
 349+ array( 'MIN(rev_id) AS rev_id' ),
 350+ array( 'rev_page' => $this->mPageId ),
 351+ __METHOD__,
 352+ array( 'GROUP BY' => 'rev_page' )
 353+ );
 354+
 355+ $revId = array();
 356+
 357+ foreach ( $res as $row ) {
 358+ $revId[] = $row->rev_id;
 359+ }
 360+
 361+ $res = $dbr->select(
 362+ array( 'revision', 'user' ),
 363+ array( 'rev_page AS page_id', 'user_id', 'user_name', 'user_real_name', 'user_registration', 'user_editcount' ),
 364+ array( 'rev_id' => $revId, 'rev_user = user_id' ),
 365+ __METHOD__,
 366+ array()
 367+ );
 368+
 369+ foreach ( $res as $row ) {
 370+ $user = User::newFromRow( $row );
 371+ $metaData[$row->page_id]['user_name'] = $user->getName();
 372+ $metaData[$row->page_id]['user_editcount'] = $user->getEditCount();
 373+ $metaData[$row->page_id]['user_creation_date'] = wfTimestamp( TS_MW, $user->getRegistration() );
 374+ $metaData[$row->page_id]['user_autoconfirmed'] = $user->isAllowed( 'autoconfirmed' );
 375+ $metaData[$row->page_id]['user_block_status'] = $user->isBlocked() ? '1' : '0';
 376+ }
 377+ }
 378+
 379+ /**
 380+ * Compile the deletion tag data
 381+ * @param $metaData array
 382+ */
 383+ protected function compileDeletionTagData( &$metaData ) {
 384+ $dbr = wfGetDB( DB_SLAVE );
 385+
 386+ $deletionTags = array (
 387+ 'All_articles_proposed_for_deletion' => 'prod_status',
 388+ 'BLP_articles_proposed_for_deletion' => 'blp_prod_status',
 389+ 'Candidates_for_speedy_deletion' => 'csd_status',
 390+ 'Articles_for_deletion' => 'afd_status'
 391+ );
 392+
 393+ $res = $dbr->select(
 394+ array( 'categorylinks' ),
 395+ array( 'cl_from AS page_id', 'cl_to' ),
 396+ array( 'cl_from' => $this->mPageId, 'cl_to' => array_keys( $deletionTags ) ),
 397+ __METHOD__
 398+ );
 399+
 400+ foreach ( $res as $row ) {
 401+ $metaData[$row->page_id][$deletionTags[$row->cl_to]] = '1';
 402+ }
 403+
 404+ // Fill in 0 for page not tagged with any of these status
 405+ // Subtract from category_count
 406+ foreach ( $this->mPageId as $pageId ) {
 407+ foreach ( $deletionTags as $status ) {
 408+ if ( !isset( $metaData[$pageId][$status] ) ) {
 409+ $metaData[$pageId][$status] = '0';
 410+ } else {
 411+ $metaData[$pageId]['category_count'] -= 1;
 412+ }
 413+ }
 414+
 415+ if ( $metaData[$pageId]['category_count'] < 0 ) {
 416+ $metaData[$pageId]['category_count'] = '0';
 417+ }
 418+ }
 419+ }
 420+}
 421+
 422+class MWArticleMetadataMissingPageIdException extends MWException {}
 423+class MWArticleMetadataMetaDataOutofBoundException extends MWException {}
Property changes on: trunk/extensions/PageTriage/includes/ArticleMetadata.php
___________________________________________________________________
Added: svn:eol-style
1424 + native
Index: trunk/extensions/PageTriage/api/ApiPageTriageGetMetadata.php
@@ -0,0 +1,60 @@
 2+<?php
 3+
 4+class ApiPageTriageGetMetadata extends ApiBase {
 5+
 6+ public function execute() {
 7+ global $wgPageTriagePageIdPerRequest;
 8+
 9+ $params = $this->extractRequestParams();
 10+
 11+ if ( count( $params['page_id'] ) > $wgPageTriagePageIdPerRequest ) {
 12+ $this->dieUsage( 'Too many pages in the request', 'exceed-page-limit' );
 13+ }
 14+
 15+ $articleMetadata = new ArticleMetadata( );
 16+ $metaData = $articleMetadata->getMetadata( $params['page_id'] );
 17+
 18+ $result = array( 'result' => 'success', 'page' => $metaData );
 19+ $this->getResult()->addValue( null, $this->getModuleName(), $result );
 20+ }
 21+
 22+ public function needsToken() {
 23+ return true;
 24+ }
 25+
 26+ public function getTokenSalt() {
 27+ return '';
 28+ }
 29+
 30+ public function getAllowedParams() {
 31+ return array(
 32+ 'page_id' => array(
 33+ ApiBase::PARAM_REQUIRED => true,
 34+ ApiBase::PARAM_TYPE => 'integer',
 35+ ApiBase::PARAM_ISMULTI => true,
 36+ ),
 37+ );
 38+ }
 39+
 40+ public function mustBePosted() {
 41+ return true;
 42+ }
 43+
 44+ public function isWriteMode() {
 45+ return true;
 46+ }
 47+
 48+ public function getVersion() {
 49+ return __CLASS__ . ': $Id: ApiPageTriageGetMetadata.php $';
 50+ }
 51+
 52+ public function getParamDescription() {
 53+ return array(
 54+ 'page_id' => 'The list of articles for which metadata is obtained',
 55+ );
 56+ }
 57+
 58+ public function getDescription() {
 59+ return 'Get metadata for a list of articles';
 60+ }
 61+}
Property changes on: trunk/extensions/PageTriage/api/ApiPageTriageGetMetadata.php
___________________________________________________________________
Added: svn:eol-style
162 + native
Index: trunk/extensions/PageTriage/PageTriage.php
@@ -51,11 +51,18 @@
5252 $wgAutoloadClasses['SpecialPageTriage'] = $dir . 'SpecialPageTriage.php';
5353 $wgSpecialPages['PageTriage'] = 'SpecialPageTriage';
5454 $wgSpecialPageGroups['PageTriage'] = 'changes';
 55+$wgAutoloadClasses['ArticleMetadata'] = $dir . 'includes/ArticleMetadata.php';
5556
5657 $wgAutoloadClasses['ApiQueryPageTriage'] = $dir . 'api/ApiQueryPageTriage.php';
 58+$wgAutoloadClasses['ApiPageTriageGetMetadata'] = $dir . 'api/ApiPageTriageGetMetadata.php';
5759
 60+// custom exceptions
 61+$wgAutoloadClasses['MWArticleMetadataMissingPageIdException'] = $dir . 'includes/ArticleMetadata.php';
 62+$wgAutoloadClasses['MWArticleMetadataMetaDataOutofBoundException'] = $dir . 'includes/ArticleMetadata.php';
 63+
5864 // api modules
5965 $wgAPIModules['pagetriage'] = 'ApiQueryPageTriage';
 66+$wgAPIModules['pagetriagegetmetadata'] = 'ApiPageTriageGetMetadata';
6067
6168 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efPageTriageSchemaUpdates';
6269
@@ -75,9 +82,15 @@
7683 $updater->addExtensionTable( 'pagetriage', "$base/PageTriage.sql" );
7784 }
7885 }
 86+ $updater->addExtensionTable( 'pagetriage_tags', $base . '/PageTriageTags.sql' );
 87+ $updater->addExtensionTable( 'pagetriage_page_tags', $base . '/PageTriagePageTags.sql' );
 88+ $updater->addExtensionTable( 'pagetriage_page', $base . '/PageTriagePage.sql' );
 89+
7990 return true;
8091 }
8192
 93+$wgPageTriagePageIdPerRequest = 20;
 94+
8295 // Register ResourceLoader modules
8396 $wgResourceModules['ext.pageTriage.core'] = array(
8497 'localBasePath' => dirname( __FILE__ ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r113667followup to -r113451 - add documentation, pagetriage tags and fix data compil...bsitu21:14, 12 March 2012

Comments

#Comment by Nikerabbit (talk | contribs)   07:22, 9 March 2012

API files should have svn:keywords Id set.

#Comment by Kaldari (talk | contribs)   22:17, 13 April 2012

Id added in r114897.

#Comment by Kaldari (talk | contribs)   01:46, 21 March 2012

Is there any reason that pagetriage_page needs its own id? It seems to me that we could just use the page id as the primary id for that table.

#Comment by Bsitu (talk | contribs)   17:21, 29 March 2012

yeah, we can use page id as the primary key. I just have a preference that tables have their own primary keys, :), I will update the schema

Status & tagging log