Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PageTriage should not compile article not in queue
1. Fix it so it only compiles data in the queue 2. a maintenance script to clean the junk data Change-Id: I0bf48b1cf75c96720e24e27b07751282dec58dd2
- Loading branch information
Showing
3 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Remove page with namespace other than NS_MAIN/NS_USER from pagetriage queue | ||
* | ||
* @ingroup Maintenance | ||
*/ | ||
|
||
require_once( dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' ); | ||
|
||
/** | ||
* Maintenance script that removes data from pagetriage_page_tags with page_id not in pagetriage_page | ||
* | ||
* @ingroup Maintenance | ||
*/ | ||
class CleanupPageTriagePageTags extends Maintenance { | ||
|
||
protected $batchSize = 100; | ||
|
||
public function execute() { | ||
$dbw = wfGetDB( DB_MASTER ); | ||
$dbr = wfGetDB( DB_SLAVE ); | ||
|
||
$count = $this->batchSize; | ||
$start = 0; | ||
|
||
while ( $count == $this->batchSize ) { | ||
$res = $dbr->select( | ||
array( 'pagetriage_page_tags', 'pagetriage_page' ), | ||
array( 'DISTINCT ptrpt_page_id AS page_id' ), | ||
array( | ||
'ptrpt_page_id > ' . $start, | ||
'ptrp_page_id IS NULL' | ||
), | ||
__METHOD__, | ||
array( 'LIMIT' => $this->batchSize, 'ORDER BY' => 'ptrpt_page_id' ), | ||
array( 'pagetriage_page' => array( 'LEFT JOIN', 'ptrp_page_id = ptrpt_page_id' ) ) | ||
); | ||
|
||
$page = array(); | ||
foreach( $res as $row ) { | ||
$page[] = $row->page_id; | ||
$start = $row->page_id; | ||
}; | ||
$count = count( $page ); | ||
|
||
if ( $count > 0 ) { | ||
$dbw->delete( | ||
'pagetriage_page_tags', | ||
array( 'ptrpt_page_id' => $page ), | ||
__METHOD__ | ||
); | ||
|
||
$this->output( "processing " . $count . "\n" ); | ||
wfWaitForSlaves(); | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
$maintClass = 'CleanupPageTriagePageTags'; // Tells it to run the class | ||
require_once( RUN_MAINTENANCE_IF_MAIN ); |