Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -47,17 +47,16 @@ |
48 | 48 | |
49 | 49 | # Add some hooks if the current title is a record |
50 | 50 | if ( is_object( $title ) ) { |
51 | | - $types = array(); |
52 | | - $id = $title->getArticleID(); |
53 | | - $dbr = &wfGetDB( DB_SLAVE ); |
54 | | - $cat = $dbr->addQuotes( $wgRecordAdminCategory ); |
55 | | - $cl = $dbr->tableName( 'categorylinks' ); |
56 | | - $tl = $dbr->tableName( 'templatelinks' ); |
57 | | - $res = $dbr->select( $cl, 'cl_from', "cl_to = $cat" ); |
58 | | - while ( $row = $dbr->fetchRow( $res ) ) $types[] = 'tl_title = ' . $dbr->addQuotes( Title::newFromID( $row[0] )->getText() ); |
| 51 | + $uses = ''; |
| 52 | + $id = $title->getArticleID(); |
| 53 | + $dbr = &wfGetDB( DB_SLAVE ); |
| 54 | + $cat = $dbr->addQuotes( $wgRecordAdminCategory ); |
| 55 | + $cl = $dbr->tableName( 'categorylinks' ); |
| 56 | + $tl = $dbr->tableName( 'templatelinks' ); |
| 57 | + $res = $dbr->select( $cl, 'cl_from', "cl_to = $cat" ); |
| 58 | + while ( $row = $dbr->fetchRow( $res ) ) $uses .= " OR tl_title=" . $dbr->addQuotes( Title::newFromID( $row[0] )->getText() ); |
59 | 59 | $dbr->freeResult( $res ); |
60 | | - $uses = join( ' OR ', $types ); |
61 | | - if ( $uses && $row = $dbr->selectRow( $tl, 'tl_title', "tl_from = $id AND ($uses)" ) ) { |
| 60 | + if ( $uses && $row = $dbr->selectRow( $tl, 'tl_title', "tl_from = $id AND (0 $uses)" ) ) { |
62 | 61 | global $wgRecordAdminEditWithForm, $wgRecordAdminAddTitleInfo; |
63 | 62 | $this->type = $row->tl_title; |
64 | 63 | |
— | — | @@ -855,11 +854,13 @@ |
856 | 855 | } |
857 | 856 | } |
858 | 857 | $this->filter = $filter; |
| 858 | + $tmp = $this->type; |
859 | 859 | $this->preProcessForm( $type ); |
860 | 860 | $this->examineForm(); |
861 | 861 | $records = $this->getRecords( $type, $filter, $title, $invert, $orderby ); |
862 | 862 | if ( $count ) while ( count( $records ) > $count ) array_pop( $records ); |
863 | 863 | $table = $this->renderRecords( $records, $cols, $sortable, $template, $name, $export ); |
| 864 | + $this->type = $tmp; |
864 | 865 | |
865 | 866 | return array( $table, 'noparse' => true, 'isHTML' => true ); |
866 | 867 | } |
Index: trunk/extensions/RecordAdmin/RecordAdmin.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'RECORDADMIN_VERSION', '0.9.0, 2009-11-19' ); |
| 15 | +define( 'RECORDADMIN_VERSION', '0.9.1, 2009-12-02' ); |
16 | 16 | |
17 | 17 | $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type |
18 | 18 | $wgRecordAdminCategory = 'Records'; # Category containing record types |