- return 0;
- }
-
- // Cache to avoid multiple queries for the same title
- if ( isset($this->mIsDeleted) ) {
- return $this->mIsDeleted;
- }
-
- $dbr = wfGetDB( DB_SLAVE );
- $aConds = array(
- 'ar_namespace' => $this->getNamespace(),
- 'ar_title' => $this->getDBkey()
- );
- $n = $dbr->selectField( 'archive', 'COUNT(*)', $aConds, __METHOD__ );
-
- if ( $this->getNamespace() == NS_IMAGE ) {
- $faConds = array( 'fa_name' => $this->getDBkey() );
- $n += $dbr->selectField( 'filearchive', 'COUNT(*)', $faConds , __METHOD__ );
+ $n = 0;
+ } else {
+ $dbr = wfGetDB( DB_SLAVE );
+ $n = $dbr->selectField( 'archive', 'COUNT(*)', array( 'ar_namespace' => $this->getNamespace(),
+ 'ar_title' => $this->getDBkey() ), $fname );
+ if( $this->getNamespace() == NS_IMAGE ) {
+ $n += $dbr->selectField( 'filearchive', 'COUNT(*)',
+ array( 'fa_name' => $this->getDBkey() ), $fname );
+ }