Index: trunk/phase3/includes/LinkBatch.php |
— | — | @@ -12,12 +12,26 @@ |
13 | 13 | */ |
14 | 14 | var $data = array(); |
15 | 15 | |
| 16 | + /** |
| 17 | + * For debugging which method is using this class. |
| 18 | + */ |
| 19 | + protected $caller; |
| 20 | + |
16 | 21 | function __construct( $arr = array() ) { |
17 | 22 | foreach( $arr as $item ) { |
18 | 23 | $this->addObj( $item ); |
19 | 24 | } |
20 | 25 | } |
21 | 26 | |
| 27 | + /** |
| 28 | + * Use ->setCaller( __METHOD__ ) to indicate which code is using this |
| 29 | + * class. Only used in debugging output. |
| 30 | + * @since 1.17 |
| 31 | + */ |
| 32 | + public function setCaller( $caller ) { |
| 33 | + $this->caller = $caller; |
| 34 | + } |
| 35 | + |
22 | 36 | public function addObj( $title ) { |
23 | 37 | if ( is_object( $title ) ) { |
24 | 38 | $this->add( $title->getNamespace(), $title->getDBkey() ); |
— | — | @@ -134,7 +148,8 @@ |
135 | 149 | $sql = "SELECT page_id, page_namespace, page_title, page_len, page_is_redirect, page_latest FROM $page WHERE $set"; |
136 | 150 | |
137 | 151 | // Do query |
138 | | - $res = $dbr->query( $sql, __METHOD__ ); |
| 152 | + $caller = $this->caller ? __METHOD__ . " (for {$this->caller})" : __METHOD__; |
| 153 | + $res = $dbr->query( $sql, $caller ); |
139 | 154 | wfProfileOut( __METHOD__ ); |
140 | 155 | return $res; |
141 | 156 | } |