| Index: trunk/extensions/Translate/MessageCollection.php |
| — | — | @@ -4,7 +4,7 @@ |
| 5 | 5 | * |
| 6 | 6 | * @file |
| 7 | 7 | * @author Niklas Laxström |
| 8 | | - * @copyright Copyright © 2007-2010, Niklas Laxström |
| | 8 | + * @copyright Copyright © 2007-2011, Niklas Laxström |
| 9 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 10 | 10 | */ |
| 11 | 11 | |
| — | — | @@ -479,11 +479,6 @@ |
| 480 | 480 | |
| 481 | 481 | $dbr = wfGetDB( DB_SLAVE ); |
| 482 | 482 | |
| 483 | | - static $id = null; |
| 484 | | - |
| 485 | | - if ( $id === null ) |
| 486 | | - $id = $dbr->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 487 | | - |
| 488 | 483 | $tables = array( 'page', 'revtag' ); |
| 489 | 484 | $fields = array( 'page_title', 'rt_type' ); |
| 490 | 485 | $conds = array( |
| — | — | @@ -493,7 +488,7 @@ |
| 494 | 489 | $joins = array( 'revtag' => |
| 495 | 490 | array( |
| 496 | 491 | 'LEFT JOIN', |
| 497 | | - array( 'page_id=rt_page', 'page_latest=rt_revision', 'rt_type' => $id ) |
| | 492 | + array( 'page_id=rt_page', 'page_latest=rt_revision', 'rt_type' => RevTag::getType( 'fuzzy' ) ) |
| 498 | 493 | ) |
| 499 | 494 | ); |
| 500 | 495 | |
| Index: trunk/extensions/Translate/scripts/createCheckIndex.php |
| — | — | @@ -3,7 +3,7 @@ |
| 4 | 4 | * Creates serialised database of messages that need checking for problems. |
| 5 | 5 | * |
| 6 | 6 | * @author Niklas Laxstrom |
| 7 | | - * @copyright Copyright © 2008-2010, Niklas Laxström |
| | 7 | + * @copyright Copyright © 2008-2011, Niklas Laxström |
| 8 | 8 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 9 | 9 | * @file |
| 10 | 10 | */ |
| — | — | @@ -88,7 +88,6 @@ |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $db = wfGetDB( DB_MASTER ); |
| 92 | | - $id = $db->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 93 | 92 | foreach ( $problematic as $p ) { |
| 94 | 93 | $title = Title::makeTitleSafe( $p[0], $p[1] ); |
| 95 | 94 | $titleText = $title->getDBKey(); |
| — | — | @@ -100,7 +99,7 @@ |
| 101 | 100 | $inserts = array( |
| 102 | 101 | 'rt_page' => $r->page_id, |
| 103 | 102 | 'rt_revision' => $r->page_latest, |
| 104 | | - 'rt_type' => $id |
| | 103 | + 'rt_type' => RevTag::getType( 'fuzzy' ) |
| 105 | 104 | ); |
| 106 | 105 | } |
| 107 | 106 | $db->replace( 'revtag', 'rt_type_page_revision', $inserts, __METHOD__ ); |
| Index: trunk/extensions/Translate/scripts/populateFuzzy.php |
| — | — | @@ -3,7 +3,7 @@ |
| 4 | 4 | * A script to populate fuzzy tags to revtag table. |
| 5 | 5 | * |
| 6 | 6 | * @author Niklas Laxstrom |
| 7 | | - * @copyright Copyright © 2009-2010, Niklas Laxström |
| | 7 | + * @copyright Copyright © 2009-2011, Niklas Laxström |
| 8 | 8 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 9 | 9 | * @file |
| 10 | 10 | */ |
| — | — | @@ -14,12 +14,6 @@ |
| 15 | 15 | |
| 16 | 16 | $db = wfGetDB( DB_MASTER ); |
| 17 | 17 | |
| 18 | | -$id = $db->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 19 | | -if ( $id === false ) { |
| 20 | | - echo "Fuzzy tag is not registered\n"; |
| 21 | | - exit(); |
| 22 | | -} |
| 23 | | - |
| 24 | 18 | $count = $db->selectField( 'page', 'count(*)', array( 'page_namespace' => $wgTranslateMessageNamespaces ), __METHOD__ ); |
| 25 | 19 | if ( !$count ) { |
| 26 | 20 | echo "Nothing to update"; |
| — | — | @@ -52,7 +46,7 @@ |
| 53 | 47 | $inserts[] = array( |
| 54 | 48 | 'rt_page' => $r->page_id, |
| 55 | 49 | 'rt_revision' => $r->rev_id, |
| 56 | | - 'rt_type' => $id |
| | 50 | + 'rt_type' => RevTag::getType( 'fuzzy' ), |
| 57 | 51 | ); |
| 58 | 52 | } |
| 59 | 53 | } |
| Index: trunk/extensions/Translate/scripts/pagetranslation-check-database.php |
| — | — | @@ -4,7 +4,7 @@ |
| 5 | 5 | * feature and fix problems. |
| 6 | 6 | * |
| 7 | 7 | * @author Niklas Laxstrom |
| 8 | | - * @copyright Copyright © 2010, Niklas Laxström |
| | 8 | + * @copyright Copyright © 2010-2011, Niklas Laxström |
| 9 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 10 | 10 | * @file |
| 11 | 11 | */ |
| — | — | @@ -104,15 +104,8 @@ |
| 105 | 105 | |
| 106 | 106 | $dbr = wfGetDB( DB_SLAVE ); |
| 107 | 107 | |
| 108 | | - $result = $dbr->select( 'revtag_type', '*', null, __METHOD__ ); |
| 109 | | - $idToTag = array(); |
| | 108 | + $tags = array( 'tp:mark', 'tp:tag', 'tp:transver', 'fuzzy' ); |
| 110 | 109 | |
| 111 | | - foreach ( $result as $_ ) { |
| 112 | | - $idToTag[$_->rtt_id] = $_->rtt_name; |
| 113 | | - } |
| 114 | | - |
| 115 | | - $tagToId = array_flip( $idToTag ); |
| 116 | | - |
| 117 | 110 | $pages = $dbr->select( 'revtag', 'rt_page', null, __METHOD__, array( 'GROUP BY' => 'rt_page' ) ); |
| 118 | 111 | $this->output( "Checking that tags match a valid page...\n\n" ); |
| 119 | 112 | |
| — | — | @@ -137,16 +130,14 @@ |
| 138 | 131 | $this->output( "\n\nValidating tags...\n" ); |
| 139 | 132 | |
| 140 | 133 | $result = $dbr->select( 'revtag', '*', null, __METHOD__ ); |
| 141 | | - $transver = $tagToId['tp:transver']; |
| 142 | | - |
| 143 | 134 | foreach ( $result as $_ ) { |
| 144 | | - if ( !isset( $idToTag[$_->rt_type] ) ) { |
| | 135 | + if ( !isset( $tags[$_->rt_type] ) ) { |
| 145 | 136 | $name = $this->idToName( $_->rt_page ); |
| 146 | 137 | $this->output( "Page $name has unknown tag {$_->rt_type}\n" ); |
| 147 | 138 | $fixes["$name <revtag:unknown:{$_->rt_type}>"] = |
| 148 | 139 | array( 'delete tag', 'revtag', array( 'rt_page' => $id, 'rt_type' => $_->rt_type ) ); |
| 149 | 140 | continue; |
| 150 | | - } elseif ( $_->rt_type === $transver ) { |
| | 141 | + } elseif ( $_->rt_type === RevTag::getType( 'tp:transver' ) ) { |
| 151 | 142 | $check = $this->checkTransrevRevision( $rev ); |
| 152 | 143 | if ( $check !== true ) { |
| 153 | 144 | $name = $this->idToName( $_->rt_page ); |
| Index: trunk/extensions/Translate/revtags.sql |
| — | — | @@ -1,16 +1,8 @@ |
| | 2 | +-- These tables could go into core someday, but not likely |
| 2 | 3 | |
| 3 | | -CREATE TABLE /*$wgDBprefix*/revtag_type ( |
| 4 | | - rtt_id int not null primary key auto_increment, |
| 5 | | - rtt_name varbinary(60) not null |
| 6 | | -) /*$wgDBTableOptions*/; |
| 7 | | -CREATE UNIQUE INDEX /*i*/rtt_name ON /*$wgDBprefix*/revtag_type (rtt_name); |
| 8 | | - |
| 9 | 4 | -- Revision tags |
| 10 | 5 | CREATE TABLE /*$wgDBprefix*/revtag ( |
| 11 | | - -- Link to revtag_type.rtt_id |
| 12 | | - rt_type int not null, |
| | 6 | + rt_type varbinary(60) not null, |
| 13 | 7 | |
| 14 | 8 | -- Link to page.page_id |
| 15 | 9 | rt_page int not null, |
| Index: trunk/extensions/Translate/MessageGroups.php |
| — | — | @@ -921,9 +921,9 @@ |
| 922 | 922 | if ( $wgEnablePageTranslation ) { |
| 923 | 923 | $dbr = wfGetDB( DB_SLAVE ); |
| 924 | 924 | |
| 925 | | - $tables = array( 'page', 'revtag', 'revtag_type' ); |
| | 925 | + $tables = array( 'page', 'revtag' ); |
| 926 | 926 | $vars = array( 'page_id', 'page_namespace', 'page_title', ); |
| 927 | | - $conds = array( 'page_id=rt_page', 'rtt_id=rt_type', 'rtt_name' => 'tp:mark' ); |
| | 927 | + $conds = array( 'page_id=rt_page', 'rt_type' => RevTag::getType( 'tp:mark') ); |
| 928 | 928 | $options = array( 'GROUP BY' => 'page_id' ); |
| 929 | 929 | $res = $dbr->select( $tables, $vars, $conds, __METHOD__, $options ); |
| 930 | 930 | |
| Index: trunk/extensions/Translate/tag/TranslatablePage.php |
| — | — | @@ -425,7 +425,6 @@ |
| 426 | 426 | protected function addTag( $tag, $revision, $value = null ) { |
| 427 | 427 | $dbw = wfGetDB( DB_MASTER ); |
| 428 | 428 | |
| 429 | | - $id = self::getTagId( $tag ); |
| 430 | 429 | $aid = $this->getTitle()->getArticleId(); |
| 431 | 430 | |
| 432 | 431 | if ( is_object( $revision ) ) { |
| — | — | @@ -434,7 +433,7 @@ |
| 435 | 434 | |
| 436 | 435 | $conds = array( |
| 437 | 436 | 'rt_page' => $aid, |
| 438 | | - 'rt_type' => $id, |
| | 437 | + 'rt_type' => RevTag::getType( $tag ), |
| 439 | 438 | 'rt_revision' => $revision |
| 440 | 439 | ); |
| 441 | 440 | $dbw->delete( 'revtag', $conds, __METHOD__ ); |
| — | — | @@ -478,8 +477,8 @@ |
| 479 | 478 | $conds = array( |
| 480 | 479 | 'rt_page' => $aid, |
| 481 | 480 | 'rt_type' => array( |
| 482 | | - self::getTagId( 'tp:mark' ), |
| 483 | | - self::getTagId( 'tp:tag' ), |
| | 481 | + RevTag::getType( 'tp:mark' ), |
| | 482 | + RevTag::getType( 'tp:tag' ), |
| 484 | 483 | ), |
| 485 | 484 | ); |
| 486 | 485 | |
| — | — | @@ -501,11 +500,10 @@ |
| 502 | 501 | } |
| 503 | 502 | |
| 504 | 503 | $db = wfGetDB( $dbt ); |
| 505 | | - $id = self::getTagId( $tag ); |
| 506 | 504 | |
| 507 | 505 | $conds = array( |
| 508 | 506 | 'rt_page' => $aid, |
| 509 | | - 'rt_type' => $id, |
| | 507 | + 'rt_type' => RevTag::getType( $tag ), |
| 510 | 508 | ); |
| 511 | 509 | |
| 512 | 510 | $options = array( 'ORDER BY' => 'rt_revision DESC' ); |
| — | — | @@ -536,7 +534,7 @@ |
| 537 | 535 | $fields = array( 'rt_revision', 'rt_value' ); |
| 538 | 536 | $conds = array( |
| 539 | 537 | 'rt_page' => $this->getTitle()->getArticleId(), |
| 540 | | - 'rt_type' => self::getTagId( 'tp:mark' ), |
| | 538 | + 'rt_type' => RevTag::getType( 'tp:mark' ), |
| 541 | 539 | ); |
| 542 | 540 | $options = array( 'ORDER BY' => 'rt_revision DESC' ); |
| 543 | 541 | |
| — | — | @@ -663,52 +661,19 @@ |
| 664 | 662 | } |
| 665 | 663 | |
| 666 | 664 | public function getTransRev( $suffix ) { |
| 667 | | - $id = self::getTagId( 'tp:transver' ); |
| 668 | 665 | $title = Title::makeTitle( NS_TRANSLATIONS, $suffix ); |
| 669 | 666 | |
| 670 | 667 | $db = wfGetDB( DB_SLAVE ); |
| 671 | 668 | $fields = 'rt_value'; |
| 672 | 669 | $conds = array( |
| 673 | 670 | 'rt_page' => $title->getArticleId(), |
| 674 | | - 'rt_type' => $id, |
| | 671 | + 'rt_type' => RevTag::getType( 'tp:transver' ), |
| 675 | 672 | ); |
| 676 | 673 | $options = array( 'ORDER BY' => 'rt_revision DESC' ); |
| 677 | 674 | |
| 678 | 675 | return $db->selectField( 'revtag', $fields, $conds, __METHOD__, $options ); |
| 679 | 676 | } |
| 680 | 677 | |
| 681 | | - protected static function getTagId( $tag ) { |
| 682 | | - $validTags = array( 'tp:mark', 'tp:tag', 'tp:transver' ); |
| 683 | | - if ( !in_array( $tag, $validTags ) ) { |
| 684 | | - throw new MWException( "Invalid tag $tag requested" ); |
| 685 | | - } |
| 686 | | - |
| 687 | | - global $wgTranslateStaticTags; |
| 688 | | - |
| 689 | | - if ( is_array( $wgTranslateStaticTags ) ) { |
| 690 | | - return $wgTranslateStaticTags[$tag]; |
| 691 | | - } |
| 692 | | - |
| 693 | | - // Simple static cache |
| 694 | | - static $tagcache = array(); |
| 695 | | - |
| 696 | | - if ( !count( $tagcache ) ) { |
| 697 | | - $db = wfGetDB( DB_SLAVE ); |
| 698 | | - $res = $db->select( |
| 699 | | - 'revtag_type', // Table |
| 700 | | - array( 'rtt_name', 'rtt_id' ), |
| 701 | | - array( 'rtt_name' => $validTags ), |
| 702 | | - __METHOD__ |
| 703 | | - ); |
| 704 | | - |
| 705 | | - foreach ( $res as $r ) { |
| 706 | | - $tagcache[$r->rtt_name] = $r->rtt_id; |
| 707 | | - } |
| 708 | | - } |
| 709 | | - |
| 710 | | - return $tagcache[$tag]; |
| 711 | | - } |
| 712 | | - |
| 713 | 678 | public static function isTranslationPage( Title $title ) { |
| 714 | 679 | list( $key, $code ) = TranslateUtils::figureMessage( $title->getText() ); |
| 715 | 680 | |
| — | — | @@ -769,7 +734,7 @@ |
| 770 | 735 | $conds = array( |
| 771 | 736 | 'rt_page = page_id', |
| 772 | 737 | 'rt_revision = page_latest', |
| 773 | | - 'rt_type' => array( self::getTagId( 'tp:mark' ), self::getTagId( 'tp:tag' ) ), |
| | 738 | + 'rt_type' => array( RevTag::getType( 'tp:mark' ), RevTag::getType( 'tp:tag' ) ), |
| 774 | 739 | ); |
| 775 | 740 | $options = array( 'GROUP BY' => 'rt_page' ); |
| 776 | 741 | |
| Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
| — | — | @@ -5,7 +5,7 @@ |
| 6 | 6 | * @file |
| 7 | 7 | * @author Niklas Laxström |
| 8 | 8 | * @author Siebrand Mazeland |
| 9 | | - * @copyright Copyright © 2008-2010 Niklas Laxström, Siebrand Mazeland |
| | 9 | + * @copyright Copyright © 2008-2011 Niklas Laxström, Siebrand Mazeland |
| 10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 11 | 11 | */ |
| 12 | 12 | |
| — | — | @@ -138,16 +138,15 @@ |
| 139 | 139 | |
| 140 | 140 | public function loadPagesFromDB() { |
| 141 | 141 | $dbr = wfGetDB( DB_SLAVE ); |
| 142 | | - $tables = array( 'page', 'revtag_type', 'revtag' ); |
| 143 | | - $vars = array( 'page_id', 'page_title', 'page_namespace', 'page_latest', 'MAX(rt_revision) as rt_revision', 'rtt_name' ); |
| | 142 | + $tables = array( 'page', 'revtag' ); |
| | 143 | + $vars = array( 'page_id', 'page_title', 'page_namespace', 'page_latest', 'MAX(rt_revision) as rt_revision', 'rt_type' ); |
| 144 | 144 | $conds = array( |
| 145 | 145 | 'page_id=rt_page', |
| 146 | | - 'rt_type=rtt_id', |
| 147 | | - 'rtt_name' => array( 'tp:mark', 'tp:tag' ), |
| | 146 | + 'rt_type' => array( RevTag::getType( 'tp:mark' ), RevTag::getType( 'tp:tag' ) ), |
| 148 | 147 | ); |
| 149 | 148 | $options = array( |
| 150 | 149 | 'ORDER BY' => 'page_namespace, page_title', |
| 151 | | - 'GROUP BY' => 'page_id, rtt_id', |
| | 150 | + 'GROUP BY' => 'page_id, rt_type', |
| 152 | 151 | ); |
| 153 | 152 | $res = $dbr->select( $tables, $vars, $conds, __METHOD__, $options ); |
| 154 | 153 | |
| — | — | @@ -172,7 +171,8 @@ |
| 173 | 172 | $pages[$r->page_id]['latest'] = intval( $title->getLatestRevID() ); |
| 174 | 173 | } |
| 175 | 174 | |
| 176 | | - $pages[$r->page_id][$r->rtt_name] = intval( $r->rt_revision ); |
| | 175 | + $tag = RevTag::typeToTag( $r->rt_type ); |
| | 176 | + $pages[$r->page_id][$tag] = intval( $r->rt_revision ); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // Pages where mark <= tag |
| — | — | @@ -560,8 +560,6 @@ |
| 561 | 561 | |
| 562 | 562 | $titleCond = $db->makeList( $titles, LIST_OR ); |
| 563 | 563 | |
| 564 | | - $id = $db->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 565 | | - |
| 566 | 564 | $fields = array( 'page_id', 'page_latest' ); |
| 567 | 565 | $conds = array( 'page_namespace' => NS_TRANSLATIONS, $titleCond ); |
| 568 | 566 | $res = $db->select( 'page', $fields, $conds, __METHOD__ ); |
| — | — | @@ -571,7 +569,7 @@ |
| 572 | 570 | foreach ( $res as $r ) { |
| 573 | 571 | $inserts[] = array( |
| 574 | 572 | 'rt_page' => $r->page_id, |
| 575 | | - 'rt_type' => $id, |
| | 573 | + 'rt_type' => RevTag::getType( 'fuzzy' ), |
| 576 | 574 | 'rt_revision' => $r->page_latest, |
| 577 | 575 | ); |
| 578 | 576 | } |
| Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
| — | — | @@ -4,7 +4,7 @@ |
| 5 | 5 | * |
| 6 | 6 | * @file |
| 7 | 7 | * @author Niklas Laxström |
| 8 | | - * @copyright Copyright © 2008-2010, Niklas Laxström |
| | 8 | + * @copyright Copyright © 2008-2011, Niklas Laxström |
| 9 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 10 | 10 | */ |
| 11 | 11 | |
| — | — | @@ -150,13 +150,9 @@ |
| 151 | 151 | |
| 152 | 152 | $dbw = wfGetDB( DB_MASTER ); |
| 153 | 153 | |
| 154 | | - // Can this be done in one query? |
| 155 | | - $id = $dbw->selectField( 'revtag_type', 'rtt_id', |
| 156 | | - array( 'rtt_name' => 'tp:transver' ), __METHOD__ ); |
| 157 | | - |
| 158 | 154 | $conds = array( |
| 159 | 155 | 'rt_page' => $title->getArticleId(), |
| 160 | | - 'rt_type' => $id, |
| | 156 | + 'rt_type' => RevTag::getType( 'tp:transver' ), |
| 161 | 157 | 'rt_revision' => $revision |
| 162 | 158 | ); |
| 163 | 159 | $dbw->delete( 'revtag', $conds, __METHOD__ ); |
| — | — | @@ -397,11 +393,11 @@ |
| 398 | 394 | |
| 399 | 395 | $wgExtNewTables[] = array( 'translate_sections', "$dir/translate.sql" ); |
| 400 | 396 | $wgExtNewFields[] = array( 'translate_sections', 'trs_order', "$dir/translate-add-trs_order.patch.sql" ); |
| 401 | | - $wgExtNewTables[] = array( 'revtag_type', "$dir/revtags.sql" ); |
| | 397 | + $wgExtNewTables[] = array( 'revtag', "$dir/revtags.sql" ); |
| 402 | 398 | } else { |
| 403 | 399 | $updater->addExtensionUpdate( array( 'addTable', 'translate_sections', "$dir/translate.sql", true ) ); |
| 404 | 400 | $updater->addExtensionUpdate( array( 'addField', 'translate_sections', 'trs_order', "$dir/translate-add-trs_order.patch.sql", true ) ); |
| 405 | | - $updater->addExtensionUpdate( array( 'addTable', 'revtag_type', "$dir/revtags.sql", true ) ); |
| | 401 | + $updater->addExtensionUpdate( array( 'addTable', 'revtag', "$dir/revtags.sql", true ) ); |
| 406 | 402 | } |
| 407 | 403 | return true; |
| 408 | 404 | } |
| — | — | @@ -528,9 +524,7 @@ |
| 529 | 525 | } |
| 530 | 526 | |
| 531 | 527 | public static function parserTestTables( &$tables ) { |
| 532 | | - $tables[] = 'revtag_type'; |
| 533 | 528 | $tables[] = 'revtag'; |
| 534 | | - |
| 535 | 529 | return true; |
| 536 | 530 | } |
| 537 | 531 | |
| Index: trunk/extensions/Translate/TranslateEditAddons.php |
| — | — | @@ -279,14 +279,13 @@ |
| 280 | 280 | */ |
| 281 | 281 | public static function isFuzzy( Title $title ) { |
| 282 | 282 | $dbr = wfGetDB( DB_SLAVE ); |
| 283 | | - $id = $dbr->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 284 | 283 | |
| 285 | 284 | $tables = array( 'page', 'revtag' ); |
| 286 | 285 | $fields = array( 'rt_type' ); |
| 287 | 286 | $conds = array( |
| 288 | 287 | 'page_namespace' => $title->getNamespace(), |
| 289 | 288 | 'page_title' => $title->getDBkey(), |
| 290 | | - 'rt_type' => $id, |
| | 289 | + 'rt_type' => RevTag::getType( 'fuzzy' ), |
| 291 | 290 | 'page_id=rt_page', |
| 292 | 291 | 'page_latest=rt_revision' |
| 293 | 292 | ); |
| — | — | @@ -394,11 +393,9 @@ |
| 395 | 394 | // begin fuzzy tag. |
| 396 | 395 | $dbw = wfGetDB( DB_MASTER ); |
| 397 | 396 | |
| 398 | | - $id = $dbw->selectField( 'revtag_type', 'rtt_id', array( 'rtt_name' => 'fuzzy' ), __METHOD__ ); |
| 399 | | - |
| 400 | 397 | $conds = array( |
| 401 | 398 | 'rt_page' => $article->getTitle()->getArticleId(), |
| 402 | | - 'rt_type' => $id, |
| | 399 | + 'rt_type' => RevTag::getType( 'fuzzy' ), |
| 403 | 400 | 'rt_revision' => $rev |
| 404 | 401 | ); |
| 405 | 402 | // Remove any existing fuzzy tags for this revision |
| — | — | @@ -424,12 +421,9 @@ |
| 425 | 422 | if ( $definitionTitle && $definitionTitle->exists() ) { |
| 426 | 423 | $definitionRevision = $definitionTitle->getLatestRevID(); |
| 427 | 424 | |
| 428 | | - $id = $dbw->selectField( 'revtag_type', 'rtt_id', |
| 429 | | - array( 'rtt_name' => 'tp:transver' ), __METHOD__ ); |
| 430 | | - |
| 431 | 425 | $conds = array( |
| 432 | 426 | 'rt_page' => $title->getArticleId(), |
| 433 | | - 'rt_type' => $id, |
| | 427 | + 'rt_type' => RevTag::getType( 'tp:transver' ), |
| 434 | 428 | 'rt_revision' => $rev, |
| 435 | 429 | 'rt_value' => $definitionRevision, |
| 436 | 430 | ); |
| Index: trunk/extensions/Translate/Translate.php |
| — | — | @@ -15,7 +15,7 @@ |
| 16 | 16 | /** |
| 17 | 17 | * Version number used in extension credits and in other placed where needed. |
| 18 | 18 | */ |
| 19 | | -define( 'TRANSLATE_VERSION', '2011-08-23' ); |
| | 19 | +define( 'TRANSLATE_VERSION', '2011-08-26' ); |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Extension credits properties. |
| — | — | @@ -672,30 +672,13 @@ |
| 673 | 673 | return true; |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | | - /** Add our tags if they are not registered yet |
| 677 | | - * tp:tag is called also the ready tag |
| 678 | | - * @todo Remove useless complication that is revtag_type table. |
| 679 | | - */ |
| 680 | | - $tags = array( 'tp:mark', 'tp:tag', 'tp:transver', 'fuzzy' ); |
| 681 | | - |
| 682 | 676 | $dbw = wfGetDB( DB_MASTER ); |
| 683 | | - if ( !$dbw->tableExists( 'revtag_type' ) ) { |
| | 677 | + if ( !$dbw->tableExists( 'revtag' ) ) { |
| 684 | 678 | $wgHooks['SiteNoticeAfter'][] = array( 'efTranslateCheckWarn', 'tpt-install' ); |
| 685 | 679 | return false; |
| 686 | 680 | } |
| 687 | 681 | |
| 688 | | - foreach ( $tags as $tag ) { |
| 689 | | - /// @todo: use insert ignore |
| 690 | | - $field = array( 'rtt_name' => $tag ); |
| 691 | | - $ret = $dbw->selectField( 'revtag_type', 'rtt_name', $field, __METHOD__ ); |
| 692 | | - |
| 693 | | - if ( $ret !== $tag ) { |
| 694 | | - $dbw->insert( 'revtag_type', $field, __METHOD__ ); |
| 695 | | - } |
| 696 | | - } |
| 697 | | - |
| 698 | 682 | $wgMemc->set( $memcKey, $version ); |
| 699 | | - |
| 700 | 683 | return true; |
| 701 | 684 | } |
| 702 | 685 | |
| Index: trunk/extensions/Translate/_autoload.php |
| — | — | @@ -112,6 +112,7 @@ |
| 113 | 113 | $wgAutoloadClasses['TranslateYaml'] = $dir . 'utils/TranslateYaml.php'; |
| 114 | 114 | |
| 115 | 115 | $wgAutoloadClasses['TranslateBC'] = $dir . 'utils/CompatibilityCode.php'; |
| | 116 | +$wgAutoloadClasses['RevTag'] = $dir . 'utils/RevTag.php'; |
| 116 | 117 | |
| 117 | 118 | $wgAutoloadClasses['MessageHandle'] = $dir . 'utils/MessageHandle.php'; |
| 118 | 119 | |
| Index: trunk/extensions/Translate/utils/TranslationHelpers.php |
| — | — | @@ -878,12 +878,9 @@ |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | $db = wfGetDB( DB_MASTER ); |
| 882 | | - $id = $db->selectField( 'revtag_type', 'rtt_id', |
| 883 | | - array( 'rtt_name' => 'tp:transver' ), __METHOD__ ); |
| 884 | | - |
| 885 | 882 | $conds = array( |
| 886 | 883 | 'rt_page' => $this->title->getArticleId(), |
| 887 | | - 'rt_type' => $id, |
| | 884 | + 'rt_type' => RevTag::getType( 'tp:transver' ), |
| 888 | 885 | 'rt_revision' => $this->title->getLatestRevID(), |
| 889 | 886 | ); |
| 890 | 887 | |