24 require_once __DIR__ .
'/Maintenance.php';
32 parent::__construct();
46 $this->
output(
"Populating page_props.pp_sortkey...\n" );
48 $queryBuilder = $dbw->newSelectQueryBuilder()
49 ->select( [
'pp_propname',
'pp_page',
'pp_sortkey',
'pp_value' ] )
50 ->from(
'page_props' )
51 ->where( [
'pp_sortkey' =>
null ] )
52 ->orderBy( [
'pp_page',
'pp_propname' ] )
54 if ( $lastPageValue !== 0 ) {
55 $queryBuilder->andWhere( $dbw->buildComparison(
'>', [
56 'pp_page' => $lastPageValue,
57 'pp_propname' => $lastProp,
61 $res = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
63 if ( $res->numRows() === 0 ) {
69 foreach ( $res as $row ) {
70 if ( !is_numeric( $row->pp_value ) ) {
75 [
'pp_sortkey' => $row->pp_value ],
77 'pp_page' => $row->pp_page,
78 'pp_propname' => $row->pp_propname
85 if ( $editedRowCount !== $lastRowCount ) {
86 $this->
output(
"Updated " . $editedRowCount .
" rows\n" );
87 $lastRowCount = $editedRowCount;
94 $lastPageValue = $row->pp_page;
97 $lastProp = $row->pp_propname;
100 $this->
output(
"Populating page_props.pp_sortkey complete.\n" );
101 $this->
output(
"Updated a total of $editedRowCount rows\n" );
106 return 'populate pp_sortkey';
111 require_once RUN_MAINTENANCE_IF_MAIN;
Class for scripts that perform database maintenance and want to log the update in updatelog so we can...
getDB( $db, $groups=[], $dbDomain=false)
Returns a database to be used by current maintenance script.
beginTransaction(IDatabase $dbw, $fname)
Begin a transaction on a DB.
commitTransaction(IDatabase $dbw, $fname)
Commit the transaction on a DB handle and wait for replica DBs to catch up.
output( $out, $channel=null)
Throw some output to the user.
getBatchSize()
Returns batch size.
addDescription( $text)
Set the description text.
Usage: populatePPSortKey.php.
__construct()
Default constructor.
doDBUpdates()
Do the actual work.
getUpdateKey()
Get the update key name to go in the update log table.