dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git]
/
maintenance
/
populateBacklinkNamespace.php
diff --git
a/maintenance/populateBacklinkNamespace.php
b/maintenance/populateBacklinkNamespace.php
index
271a3f6
..
295dacd
100644
(file)
--- a/
maintenance/populateBacklinkNamespace.php
+++ b/
maintenance/populateBacklinkNamespace.php
@@
-31,7
+31,8
@@
require_once __DIR__ . '/Maintenance.php';
class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populate the *_from_namespace fields";
+ $this->addDescription( 'Populate the *_from_namespace fields' );
+ $this->addOption( 'lastUpdatedId', "Highest page_id with updated links", false, true );
}
protected function getUpdateKey() {
}
protected function getUpdateKey() {
@@
-49,7
+50,10
@@
class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
$this->output( "Updating *_from_namespace fields in links tables.\n" );
$this->output( "Updating *_from_namespace fields in links tables.\n" );
- $start = $db->selectField( 'page', 'MIN(page_id)', false, __METHOD__ );
+ $start = $this->getOption( 'lastUpdatedId' );
+ if ( !$start ) {
+ $start = $db->selectField( 'page', 'MIN(page_id)', false, __METHOD__ );
+ }
if ( !$start ) {
$this->output( "Nothing to do." );
return false;
if ( !$start ) {
$this->output( "Nothing to do." );
return false;
@@
-63,21
+67,21
@@
class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
while ( $blockEnd <= $end ) {
$this->output( "...doing page_id from $blockStart to $blockEnd\n" );
$cond = "page_id BETWEEN $blockStart AND $blockEnd";
while ( $blockEnd <= $end ) {
$this->output( "...doing page_id from $blockStart to $blockEnd\n" );
$cond = "page_id BETWEEN $blockStart AND $blockEnd";
- $res = $db->select( 'page',
array( 'page_id', 'page_namespace' )
, $cond, __METHOD__ );
+ $res = $db->select( 'page',
[ 'page_id', 'page_namespace' ]
, $cond, __METHOD__ );
foreach ( $res as $row ) {
$db->update( 'pagelinks',
foreach ( $res as $row ) {
$db->update( 'pagelinks',
-
array( 'pl_from_namespace' => $row->page_namespace )
,
-
array( 'pl_from' => $row->page_id )
,
+
[ 'pl_from_namespace' => $row->page_namespace ]
,
+
[ 'pl_from' => $row->page_id ]
,
__METHOD__
);
$db->update( 'templatelinks',
__METHOD__
);
$db->update( 'templatelinks',
-
array( 'tl_from_namespace' => $row->page_namespace )
,
-
array( 'tl_from' => $row->page_id )
,
+
[ 'tl_from_namespace' => $row->page_namespace ]
,
+
[ 'tl_from' => $row->page_id ]
,
__METHOD__
);
$db->update( 'imagelinks',
__METHOD__
);
$db->update( 'imagelinks',
-
array( 'il_from_namespace' => $row->page_namespace )
,
-
array( 'il_from' => $row->page_id )
,
+
[ 'il_from_namespace' => $row->page_namespace ]
,
+
[ 'il_from' => $row->page_id ]
,
__METHOD__
);
}
__METHOD__
);
}