Index: branches/robchurch/reports/languages/messages/MessagesEn.php |
— | — | @@ -1576,7 +1576,7 @@ |
1577 | 1577 | 'wantedcategories' => 'Wanted categories', |
1578 | 1578 | 'wantedcategories-summary' => '', # only translate this message to other languages if you have to change it |
1579 | 1579 | 'wantedpages' => 'Wanted pages', |
1580 | | -'wantedpages-summary' => '', # only translate this message to other languages if you have to change it |
| 1580 | +'wantedpages-header' => 'This report lists pages which don\'t exist, but have $1 or more incoming links.', |
1581 | 1581 | 'mostlinked' => 'Most linked to pages', |
1582 | 1582 | 'mostlinked-summary' => '', # only translate this message to other languages if you have to change it |
1583 | 1583 | 'mostlinkedcategories' => 'Most linked to categories', |
Index: branches/robchurch/reports/includes/SpecialPage.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | 'Uncategorizedtemplates' => array( 'SpecialRedirect', 'Uncategorizedpages', array( 'namespace' => NS_TEMPLATE ) ), |
99 | 99 | 'Unusedcategories' => array( 'SpecialPage', 'Unusedcategories' ), |
100 | 100 | 'Unusedimages' => array( 'SpecialPage', 'Unusedimages' ), |
101 | | - 'Wantedpages' => array( 'IncludableSpecialPage', 'Wantedpages' ), |
| 101 | + 'Wantedpages' => 'WantedPagesReport', |
102 | 102 | 'Wantedcategories' => array( 'SpecialPage', 'Wantedcategories' ), |
103 | 103 | 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ), |
104 | 104 | 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ), |
Index: branches/robchurch/reports/includes/reports/ReportPager.php |
— | — | @@ -62,6 +62,7 @@ |
63 | 63 | |
64 | 64 | $sql = $this->report->getBaseSql( $this->mDb ) |
65 | 65 | . ' WHERE ' . implode( ' AND ', $conds ) |
| 66 | + . $this->report->getExtraSql( $this->mDb ) |
66 | 67 | . ' ' . implode( ' ', $options ); |
67 | 68 | wfDebugLog( 'reports', __METHOD__ . " executing `{$sql}`" ); |
68 | 69 | $this->mResult = new ResultWrapper( |
Index: branches/robchurch/reports/includes/reports/Report.php |
— | — | @@ -143,6 +143,17 @@ |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
| 147 | + * Get additional SQL to be inserted between the |
| 148 | + * conditions and ORDER clauses when the report is run live |
| 149 | + * |
| 150 | + * @param Database $dbr Database object being queried |
| 151 | + * @return string |
| 152 | + */ |
| 153 | + public function getExtraSql( $dbr ) { |
| 154 | + return ''; |
| 155 | + } |
| 156 | + |
| 157 | + /** |
147 | 158 | * Get ORDER BY clauses to be applied when the |
148 | 159 | * report is run live |
149 | 160 | * |
— | — | @@ -375,6 +386,7 @@ |
376 | 387 | 'ShortPagesReport', |
377 | 388 | 'UncategorisedPagesReport', |
378 | 389 | 'UnwatchedPagesReport', |
| 390 | + 'WantedPagesReport', |
379 | 391 | 'WithoutInterwikiReport', |
380 | 392 | ) + $GLOBALS['wgCustomReports']; |
381 | 393 | } |
Index: branches/robchurch/reports/includes/reports/ReportCache.php |
— | — | @@ -16,7 +16,9 @@ |
17 | 17 | * @param callback $namespaceCallback Callback after each namespace |
18 | 18 | */ |
19 | 19 | public static function recache( $report, $limit = 1000, $namespaceCallback = null ) { |
| 20 | + wfProfileIn( __METHOD__ ); |
20 | 21 | foreach( self::getNamespaces( $report ) as $namespace ) { |
| 22 | + $fname = __METHOD__ . '::' . $report->getName() . '_(' . $namespace . ')'; |
21 | 23 | # Clear existing cached entries for this report and namespace |
22 | 24 | $dbw = wfGetDB( DB_MASTER ); |
23 | 25 | $dbw->delete( |
— | — | @@ -27,15 +29,19 @@ |
28 | 30 | ), |
29 | 31 | __METHOD__ |
30 | 32 | ); |
31 | | - # Obtain fresh entries for the report |
| 33 | + # Obtain fresh entries for the report |
| 34 | + wfProfileIn( "{$fname}-read" ); |
| 35 | + $start = time(); |
32 | 36 | $dbr = wfGetDB( DB_SLAVE ); |
33 | 37 | $sql = $report->getBaseSql( $dbr ); |
34 | 38 | $conds = $report->getExtraConditions( $dbr ); |
35 | 39 | $conds[] = $report->getNamespaceClause( $namespace ); |
36 | 40 | $sql .= ' WHERE ' . implode( ' AND ', $conds ); |
| 41 | + $sql .= $report->getExtraSql( $dbr ); |
37 | 42 | $sql .= " LIMIT {$limit}"; |
38 | 43 | $res = $dbr->query( $sql, __METHOD__ ); |
39 | 44 | $rows = $dbr->numRows( $res ); |
| 45 | + wfProfileOut( "{$fname}-read" ); |
40 | 46 | # Insert the new entries into the cache |
41 | 47 | while( $row = $dbr->fetchObject( $res ) ) { |
42 | 48 | $dbw->insert( |
— | — | @@ -61,10 +67,12 @@ |
62 | 68 | ), |
63 | 69 | __METHOD__ |
64 | 70 | ); |
| 71 | + $time = time() - $start; |
65 | 72 | # Callback? |
66 | 73 | if( is_callable( $namespaceCallback ) ) |
67 | | - call_user_func( $namespaceCallback, $report, $namespace, $rows ); |
| 74 | + call_user_func( $namespaceCallback, $report, $namespace, $rows, $time ); |
68 | 75 | } |
| 76 | + wfProfileOut( __METHOD__ ); |
69 | 77 | } |
70 | 78 | |
71 | 79 | /** |
Index: branches/robchurch/reports/includes/AutoLoader.php |
— | — | @@ -217,7 +217,6 @@ |
218 | 218 | 'UserrightsForm' => 'includes/SpecialUserrights.php', |
219 | 219 | 'SpecialVersion' => 'includes/SpecialVersion.php', |
220 | 220 | 'WantedCategoriesPage' => 'includes/SpecialWantedcategories.php', |
221 | | - 'WantedPagesPage' => 'includes/SpecialWantedpages.php', |
222 | 221 | 'WhatLinksHerePage' => 'includes/SpecialWhatlinkshere.php', |
223 | 222 | 'SquidUpdate' => 'includes/SquidUpdate.php', |
224 | 223 | 'ReplacementArray' => 'includes/StringUtils.php', |
— | — | @@ -292,6 +291,7 @@ |
293 | 292 | 'ShortPagesReport' => 'includes/reports/ShortPagesReport.php', |
294 | 293 | 'UncategorisedPagesReport' => 'includes/reports/UncategorisedPagesReport.php', |
295 | 294 | 'UnwatchedPagesReport' => 'includes/reports/UnwatchedPagesReport.php', |
| 295 | + 'WantedPagesReport' => 'includes/reports/WantedPagesReport.php', |
296 | 296 | 'WithoutInterwikiReport' => 'includes/reports/WithoutInterwikiReport.php', |
297 | 297 | |
298 | 298 | # API |
Index: branches/robchurch/reports/includes/QueryPage.php |
— | — | @@ -25,8 +25,9 @@ |
26 | 26 | array( 'FewestrevisionsPage', 'Fewestrevisions' ), |
27 | 27 | array( 'UnusedCategoriesPage', 'Unusedcategories' ), |
28 | 28 | array( 'UnusedimagesPage', 'Unusedimages' ), |
| 29 | + |
29 | 30 | array( 'WantedCategoriesPage', 'Wantedcategories' ), |
30 | | - array( 'WantedPagesPage', 'Wantedpages' ), |
| 31 | + |
31 | 32 | array( 'UnusedtemplatesPage', 'Unusedtemplates' ), |
32 | 33 | ); |
33 | 34 | wfRunHooks( 'wgQueryPages', array( &$wgQueryPages ) ); |
Index: branches/robchurch/reports/maintenance/updateReports.php |
— | — | @@ -34,8 +34,9 @@ |
35 | 35 | } |
36 | 36 | echo( "Done!\n" ); |
37 | 37 | |
38 | | -function updateReportsCallback( $report, $namespace, $rows ) { |
39 | | - echo( "\tNamespace {$namespace}\t{$rows} rows\n" ); |
| 38 | +function updateReportsCallback( $report, $namespace, $rows, $time ) { |
| 39 | + $time = round( $time, 3 ); |
| 40 | + echo( "\tNamespace {$namespace}\t{$rows} rows\t{$time}s\n" ); |
40 | 41 | } |
41 | 42 | |
42 | 43 | ?> |
\ No newline at end of file |
Index: branches/robchurch/reports/maintenance/language/messages.inc |
— | — | @@ -967,7 +967,7 @@ |
968 | 968 | 'wantedcategories', |
969 | 969 | 'wantedcategories-summary', |
970 | 970 | 'wantedpages', |
971 | | - 'wantedpages-summary', |
| 971 | + 'wantedpages-header', |
972 | 972 | 'mostlinked', |
973 | 973 | 'mostlinked-summary', |
974 | 974 | 'mostlinkedcategories', |
Index: branches/robchurch/reports/maintenance/language/messageTypes.inc |
— | — | @@ -120,7 +120,6 @@ |
121 | 121 | 'whatlinkshere-barrow', |
122 | 122 | 'imagelist-summary', |
123 | 123 | 'wantedcategories-summary', |
124 | | - 'wantedpages-summary', |
125 | 124 | 'mostlinked-summary', |
126 | 125 | 'mostlinkedcategories-summary', |
127 | 126 | 'mostlinkedtemplates-summary', |