r62501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62500‎ | r62501 | r62502 >
Date:08:14, 15 February 2010
Author:nad
Status:deferred
Tags:
Comment:
when getting record name at start, account for redirect
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -37,17 +37,25 @@
3838 $wgParser->setFunctionHook( $wgRecordAdminTableMagic, array( $this, 'expandTableMagic' ) );
3939 $wgParser->setFunctionHook( $wgRecordAdminDataMagic, array( $this, 'expandDataMagic' ) );
4040
41 - # Check if posting a public creation form
42 - $title = Title::newFromText( $wgRequest->getText( 'title' ) );
43 - if ( is_object( $title ) && $title->getNamespace() != NS_SPECIAL && $wgRequest->getText( 'wpType' ) && $wgRequest->getText( 'wpCreate' ) )
44 - $this->createRecord();
45 -
4641 # A minimal hook so we know if the page has been rendered or not
4742 # (so that record tables don't execute when run from the job-queue - looking for a better way to do this)
4843 $wgHooks['BeforePageDisplay'][] = $this;
4944
50 - # Add some hooks if the current title is a record
 45+ # Get the current title accounting for redirect
 46+ $title = Title::newFromText( $wgRequest->getText( 'title' ) );
 47+ if ( is_object( $title ) && $title->isRedirect() ) {
 48+ $article = new Article( $title );
 49+ $content = $article->getContent();
 50+ if ( preg_match( '/\[\[(.+?)\]\]/', $content, $m ) ) $title = Title::newFromText( $m[1] );
 51+ }
 52+
5153 if ( is_object( $title ) ) {
 54+
 55+ # Check if posting a public creation form
 56+ if ( $title->getNamespace() != NS_SPECIAL && $wgRequest->getText( 'wpType' ) && $wgRequest->getText( 'wpCreate' ) )
 57+ $this->createRecord();
 58+
 59+ # Add some hooks if the current title is a record
5260 $uses = '';
5361 $id = $title->getArticleID();
5462 $dbr = &wfGetDB( DB_SLAVE );
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.10.4, 2010-02-13' );
 15+define( 'RECORDADMIN_VERSION', '0.10.6, 2010-02-15' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log