dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3dfb1cb
)
Add QueryPage::delete method
author
Gergő Tisza
<tgr.huwiki@gmail.com>
Fri, 26 Jul 2019 14:47:09 +0000
(16:47 +0200)
committer
Gergő Tisza
<tgr.huwiki@gmail.com>
Fri, 26 Jul 2019 21:22:30 +0000
(23:22 +0200)
Add a method for delete the cached result for a page. This is
useful for backlog-type query pages which provide some interface
for fixing the problem in-place.
Change-Id: I36b750d71b6551bb5c662e82c24f029db01acd3b
includes/specialpage/QueryPage.php
patch
|
blob
|
history
diff --git
a/includes/specialpage/QueryPage.php
b/includes/specialpage/QueryPage.php
index
eb179bf
..
1977af0
100644
(file)
--- a/
includes/specialpage/QueryPage.php
+++ b/
includes/specialpage/QueryPage.php
@@
-21,6
+21,7
@@
* @ingroup SpecialPage
*/
* @ingroup SpecialPage
*/
+use MediaWiki\Linker\LinkTarget;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\IResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\IResultWrapper;
use Wikimedia\Rdbms\IDatabase;
@@
-375,6
+376,23
@@
abstract class QueryPage extends SpecialPage {
return wfGetDB( DB_REPLICA, [ $this->getName(), 'QueryPage::recache', 'vslow' ] );
}
return wfGetDB( DB_REPLICA, [ $this->getName(), 'QueryPage::recache', 'vslow' ] );
}
+ /**
+ * Remove a cached result.
+ * Useful for interactive backlogs where the user can fix problems in-place.
+ * @param LinkTarget $title The page to remove.
+ * @since 1.34
+ */
+ public function delete( LinkTarget $title ) {
+ if ( $this->isCached() ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->delete( 'querycache', [
+ 'qc_type' => $this->getName(),
+ 'qc_namespace' => $title->getNamespace(),
+ 'qc_title' => $title->getDBkey(),
+ ], __METHOD__ );
+ }
+ }
+
/**
* 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