*/
protected function initialize() {
if ( $this->mName === null && $this->mTitle )
- $this->mName = $title->getDBKey();
+ $this->mName = $title->getDBkey();
if( $this->mName === null && $this->mID === null ) {
throw new MWException( __METHOD__.' has both names and IDs null' );
$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow(
'category',
- array( 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats',
- 'cat_files' ),
+ array( 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files' ),
$where,
__METHOD__
);
if ( $this->mTitle ) {
# If there is a title object but no record in the category table, treat this as an empty category
$this->mID = false;
- $this->mName = $this->mTitle->getDBKey();
+ $this->mName = $this->mTitle->getDBkey();
$this->mPages = 0;
$this->mSubcats = 0;
$this->mFiles = 0;
# (bug 13683) If the count is negative, then 1) it's obviously wrong
# and should not be kept, and 2) we *probably* don't have to scan many
# rows to obtain the correct figure, so let's risk a one-time recount.
- if( $this->mPages < 0 || $this->mSubcats < 0 ||
- $this->mFiles < 0 ) {
+ if( $this->mPages < 0 || $this->mSubcats < 0 || $this->mFiles < 0 ) {
$this->refreshCounts();
}
}
$cat->mTitle = $title;
- $cat->mName = $title->getDBKey();
+ $cat->mName = $title->getDBkey();
return $cat;
}
$cat = new self();
$cat->mTitle = $title;
- $cat->mName = $title->getDBKey();
+ $cat->mName = $title->getDBkey();
return $cat;
}
# but we can't know that here...
return false;
} else {
- $cat->mName = $title->getDBKey(); # if we have a title object, fetch the category name from there
+ $cat->mName = $title->getDBkey(); # if we have a title object, fetch the category name from there
}
$cat->mID = false;
} else {
# Let's be sure that the row exists in the table. We don't need to
# do this if we got the row from the table in initialization!
+ $seqVal = $dbw->nextSequenceValue( 'category_id_seq' );
$dbw->insert(
'category',
- array( 'cat_title' => $this->mName ),
+ array( 'cat_id' => $seqVal,
+ 'cat_title' => $this->mName ),
__METHOD__,
'IGNORE'
);
}
$cond1 = $dbw->conditional( 'page_namespace='.NS_CATEGORY, 1, 'NULL' );
- $cond2 = $dbw->conditional( 'page_namespace='.NS_IMAGE, 1, 'NULL' );
+ $cond2 = $dbw->conditional( 'page_namespace='.NS_FILE, 1, 'NULL' );
$result = $dbw->selectRow(
array( 'categorylinks', 'page' ),
array( 'COUNT(*) AS pages',