http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62501
Revision: 62501
Author: nad
Date: 2010-02-15 08:14:41 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
when getting record name at start, account for redirect
Modified Paths:
--------------
trunk/extensions/RecordAdmin/RecordAdmin.php
trunk/extensions/RecordAdmin/RecordAdmin_body.php
Modified: trunk/extensions/RecordAdmin/RecordAdmin.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin.php 2010-02-15 07:31:33 UTC
(rev 62500)
+++ trunk/extensions/RecordAdmin/RecordAdmin.php 2010-02-15 08:14:41 UTC
(rev 62501)
@@ -11,7 +11,7 @@
* @licence GNU General Public Licence 2.0 or later
*/
-define( 'RECORDADMIN_VERSION', '0.10.4, 2010-02-13' );
+define( 'RECORDADMIN_VERSION', '0.10.6, 2010-02-15' );
$wgRecordAdminUseNamespaces = false; # Whether record articles should be
in a namespace of the same name as their type
$wgRecordAdminCategory = 'Records'; # Category containing record types
Modified: trunk/extensions/RecordAdmin/RecordAdmin_body.php
===================================================================
--- trunk/extensions/RecordAdmin/RecordAdmin_body.php 2010-02-15 07:31:33 UTC
(rev 62500)
+++ trunk/extensions/RecordAdmin/RecordAdmin_body.php 2010-02-15 08:14:41 UTC
(rev 62501)
@@ -37,17 +37,25 @@
$wgParser->setFunctionHook( $wgRecordAdminTableMagic, array(
$this, 'expandTableMagic' ) );
$wgParser->setFunctionHook( $wgRecordAdminDataMagic, array(
$this, 'expandDataMagic' ) );
- # Check if posting a public creation form
- $title = Title::newFromText( $wgRequest->getText( 'title' ) );
- if ( is_object( $title ) && $title->getNamespace() !=
NS_SPECIAL && $wgRequest->getText( 'wpType' ) && $wgRequest->getText(
'wpCreate' ) )
- $this->createRecord();
-
# A minimal hook so we know if the page has been rendered or not
# (so that record tables don't execute when run from the
job-queue - looking for a better way to do this)
$wgHooks['BeforePageDisplay'][] = $this;
- # Add some hooks if the current title is a record
+ # Get the current title accounting for redirect
+ $title = Title::newFromText( $wgRequest->getText( 'title' ) );
+ if ( is_object( $title ) && $title->isRedirect() ) {
+ $article = new Article( $title );
+ $content = $article->getContent();
+ if ( preg_match( '/\[\[(.+?)\]\]/', $content, $m ) )
$title = Title::newFromText( $m[1] );
+ }
+
if ( is_object( $title ) ) {
+
+ # Check if posting a public creation form
+ if ( $title->getNamespace() != NS_SPECIAL &&
$wgRequest->getText( 'wpType' ) && $wgRequest->getText( 'wpCreate' ) )
+ $this->createRecord();
+
+ # Add some hooks if the current title is a record
$uses = '';
$id = $title->getArticleID();
$dbr = &wfGetDB( DB_SLAVE );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs