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 "+Test for Status->CleanParams with a callback"
[lhc/web/wiklou.git]
/
includes
/
QueryPage.php
diff --git
a/includes/QueryPage.php
b/includes/QueryPage.php
index
b8e4e60
..
654b616
100644
(file)
--- a/
includes/QueryPage.php
+++ b/
includes/QueryPage.php
@@
-295,14
+295,11
@@
abstract class QueryPage extends SpecialPage {
$fname = get_class( $this ) . '::recache';
$dbw = wfGetDB( DB_MASTER );
$fname = get_class( $this ) . '::recache';
$dbw = wfGetDB( DB_MASTER );
- $dbr = wfGetDB( DB_SLAVE, array( $this->getName(), __METHOD__, 'vslow' ) );
- if ( !$dbw || !$dbr ) {
+ if ( !$dbw ) {
return false;
}
try {
return false;
}
try {
- # Clear out any old cached data
- $dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
# Do query
$res = $this->reallyDoQuery( $limit, false );
$num = false;
# Do query
$res = $this->reallyDoQuery( $limit, false );
$num = false;
@@
-310,7
+307,7
@@
abstract class QueryPage extends SpecialPage {
$num = $res->numRows();
# Fetch results
$vals = array();
$num = $res->numRows();
# Fetch results
$vals = array();
-
while ( $res && $row = $dbr->fetchObject( $res )
) {
+
foreach ( $res as $row
) {
if ( isset( $row->value ) ) {
if ( $this->usesTimestamps() ) {
$value = wfTimestamp( TS_UNIX,
if ( isset( $row->value ) ) {
if ( $this->usesTimestamps() ) {
$value = wfTimestamp( TS_UNIX,
@@
-328,6
+325,9
@@
abstract class QueryPage extends SpecialPage {
'qc_value' => $value );
}
'qc_value' => $value );
}
+ $dbw->begin( __METHOD__ );
+ # Clear out any old cached data
+ $dbw->delete( 'querycache', array( 'qc_type' => $this->getName() ), $fname );
# Save results into the querycache table on the master
if ( count( $vals ) ) {
$dbw->insert( 'querycache', $vals, __METHOD__ );
# Save results into the querycache table on the master
if ( count( $vals ) ) {
$dbw->insert( 'querycache', $vals, __METHOD__ );
@@
-337,6
+337,7
@@
abstract class QueryPage extends SpecialPage {
$dbw->insert( 'querycache_info',
array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ),
$fname );
$dbw->insert( 'querycache_info',
array( 'qci_type' => $this->getName(), 'qci_timestamp' => $dbw->timestamp() ),
$fname );
+ $dbw->commit( __METHOD__ );
}
} catch ( DBError $e ) {
if ( !$ignoreErrors ) {
}
} catch ( DBError $e ) {
if ( !$ignoreErrors ) {
@@
-348,6
+349,13
@@
abstract class QueryPage extends SpecialPage {
return $num;
}
return $num;
}
+ /**
+ * Get a DB connection to be used for slow recache queries
+ */
+ function getRecacheDB() {
+ return wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
+ }
+
/**
* Run the query and return the result
* @param int|bool $limit Numerical limit or false for no limit
/**
* Run the query and return the result
* @param int|bool $limit Numerical limit or false for no limit
@@
-357,7
+365,7
@@
abstract class QueryPage extends SpecialPage {
*/
function reallyDoQuery( $limit, $offset = false ) {
$fname = get_class( $this ) . "::reallyDoQuery";
*/
function reallyDoQuery( $limit, $offset = false ) {
$fname = get_class( $this ) . "::reallyDoQuery";
- $dbr =
wfGetDB( DB_SLAVE
);
+ $dbr =
$this->getRecacheDB(
);
$query = $this->getQueryInfo();
$order = $this->getOrderFields();
$query = $this->getQueryInfo();
$order = $this->getOrderFields();
@@
-458,7
+466,7
@@
abstract class QueryPage extends SpecialPage {
/**
* This is the actual workhorse. It does everything needed to make a
* real, honest-to-gosh query page.
/**
* This is the actual workhorse. It does everything needed to make a
* real, honest-to-gosh query page.
- * @para $par
+ * @para
m string
$par
* @return int
*/
function execute( $par ) {
* @return int
*/
function execute( $par ) {
@@
-539,7
+547,7
@@
abstract class QueryPage extends SpecialPage {
min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
$this->offset + 1 )->parseAsBlock() );
# Disable the "next" link when we reach the end
min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
$this->offset + 1 )->parseAsBlock() );
# Disable the "next" link when we reach the end
- $paging = $this->getLanguage()->viewPrevNext( $this->getTitle( $par ), $this->offset,
+ $paging = $this->getLanguage()->viewPrevNext( $this->get
Page
Title( $par ), $this->offset,
$this->limit, $this->linkParameters(), ( $this->numRows <= $this->limit ) );
$out->addHTML( '<p>' . $paging . '</p>' );
} else {
$this->limit, $this->linkParameters(), ( $this->numRows <= $this->limit ) );
$out->addHTML( '<p>' . $paging . '</p>' );
} else {
@@
-741,7
+749,7
@@
abstract class QueryPage extends SpecialPage {
}
function feedUrl() {
}
function feedUrl() {
- return $this->getTitle()->getFullURL();
+ return $this->get
Page
Title()->getFullURL();
}
}
}
}