$user = $this->getUser();
$pageId = $this->getId();
- $hideBit = Revision::DELETED_USER; // username hidden?
+ $deletedBit = $dbr->bitAnd('rev_deleted', Revision::DELETED_USER); // username hidden?
$sql = "SELECT {$userTable}.*, MAX(rev_timestamp) as timestamp
FROM $revTable LEFT JOIN $userTable ON rev_user = user_id
WHERE rev_page = $pageId
AND rev_user != $user
- AND rev_deleted & $hideBit = 0
+ AND $deletedBit = 0
GROUP BY rev_user, rev_user_text, user_real_name
ORDER BY timestamp DESC";
// Find out if there was only one contributor
// Only scan the last 20 revisions
$res = $dbw->select( 'revision', 'rev_user_text',
- array( 'rev_page' => $this->getID(), 'rev_deleted & '.Revision::DELETED_USER.'=0' ),
+ array( 'rev_page' => $this->getID(), $dbw->bitAnd('rev_deleted', Revision::DELETED_USER) . ' = 0' ),
__METHOD__,
array( 'LIMIT' => 20 )
);
wfProfileIn( $fname );
$this->author_list = "<contributors>";
//rev_deleted
- $nothidden = '(rev_deleted & '.Revision::DELETED_USER.') = 0';
+ $nothidden = '('.$this->db->bitAnd('rev_deleted', Revision::DELETED_USER) . ') = 0';
$sql = "SELECT DISTINCT rev_user_text,rev_user FROM {$page},{$revision}
WHERE page_id=rev_page AND $nothidden AND " . $cond ;
$this->mConds['log_user'] = $userid;
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
- $this->mConds[] = 'log_deleted & ' . LogPage::DELETED_USER . ' = 0';
+ $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
}
$this->user = $usertitle->getText();
}
}
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
- $this->mConds[] = 'log_deleted & ' . LogPage::DELETED_ACTION . ' = 0';
+ $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0';
}
}
// Paranoia: avoid brute force searches (bug 17342)
if (!is_null($title)) {
- $this->addWhere('log_deleted & ' . LogPage::DELETED_ACTION . ' = 0');
+ $this->addWhere($db->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0');
}
if (!is_null($user)) {
- $this->addWhere('log_deleted & ' . LogPage::DELETED_USER . ' = 0');
+ $this->addWhere($db->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0');
}
$count = 0;
}
}
+ $db = $this->getDB();
$this->addTables('revision');
$this->addFields(Revision::selectFields());
$this->addTables('page');
$this->addWhereFld('rev_user_text', $params['user']);
} elseif (!is_null($params['excludeuser'])) {
$this->addWhere('rev_user_text != ' .
- $this->getDB()->addQuotes($params['excludeuser']));
+ $db->addQuotes($params['excludeuser']));
}
if(!is_null($params['user']) || !is_null($params['excludeuser'])) {
// Paranoia: avoid brute force searches (bug 17342)
- $this->addWhere('rev_deleted & ' . Revision::DELETED_USER . ' = 0');
+ $this->addWhere($db->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0');
}
}
elseif ($revCount > 0) {
$count = 0;
$res = $this->select(__METHOD__);
- $db = $this->getDB();
while ($row = $db->fetchObject($res)) {
if (++ $count > $limit) {
}
if(!$wgUser->isAllowed('hideuser'))
- $this->addWhere('rev_deleted & ' . Revision::DELETED_USER . ' = 0');
+ $this->addWhere($this->getDB()->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0');
// We only want pages by the specified users.
if($this->prefixMode)
$this->addWhere("rev_user_text LIKE '" . $this->getDB()->escapeLike($this->userprefix) . "%'");
return $list;
}
+ /**
+ * Bitwise operations
+ */
+
+ function bitNot($field) {
+ return '~'.$bitField;
+ }
+
+ function bitAnd($fieldLeft, $fieldRight) {
+ return $fieldLeft.'&'.$fieldRight;
+ }
+
+ function bitOr($fieldLeft, $fieldRight) {
+ return $fieldLeft.'|'.$fieldRight;
+ }
+
/**
* Change the current database
*/
return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail );
}
+ /* redundand ... will remove after confirming bitwise operations functionality
public function makeList( $a, $mode = LIST_COMMA ) {
if ( !is_array( $a ) ) {
throw new DBUnexpectedError( $this, 'DatabaseOracle::makeList called with incorrect parameters' );
return parent::makeList($a2, $mode);
}
+ */
+
+ function bitNot($field) {
+ //expecting bit-fields smaller than 4bytes
+ return 'BITNOT('.$bitField.')';
+ }
+
+ function bitAnd($fieldLeft, $fieldRight) {
+ return 'BITAND('$fieldLeft.', '.$fieldRight.')';
+ }
+
+ function bitOr($fieldLeft, $fieldRight) {
+ return 'BITOR('$fieldLeft.', '.$fieldRight.')';
+ }
public function setTimeout( $timeout ) {
// @todo fixme no-op
array( 'oi_archive_name' ),
array( 'oi_name' => $this->file->getName(),
'oi_archive_name IN (' . $dbw->makeList( array_keys($oldRels) ) . ')',
- 'oi_deleted & ' . File::DELETED_FILE => File::DELETED_FILE ),
+ $dbw->bitAnd('oi_deleted', File::DELETED_FILE) => File::DELETED_FILE ),
__METHOD__ );
while( $row = $dbw->fetchObject( $res ) ) {
$privateFiles[$row->oi_archive_name] = 1;
$inuse = $dbw->selectField( 'oldimage', '1',
array( 'oi_sha1' => $sha1,
"oi_archive_name LIKE '%.{$ext}'",
- 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ),
+ $dbw->bitAnd('oi_deleted', File::DELETED_FILE) => File::DELETED_FILE ),
__METHOD__, array( 'FOR UPDATE' ) );
}
if ( !$inuse ) {
$conds = array_merge( $userCond, $this->getNamespaceCond() );
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
- $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . ' = 0';
+ $conds[] = $this->mDb->bitAnd('rev_deleted', Revision::DELETED_USER) . ' = 0';
}
$join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
$conds = array_merge( $userCond, $this->getNamespaceCond() );
// Paranoia: avoid brute force searches (bug 17792)
if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
- $conds[] = 'ar_deleted & ' . Revision::DELETED_USER . ' = 0';
+ $conds[] = $this->mDb->bitAnd('ar_deleted', Revision::DELETED_USER) . ' = 0';
}
return array(
'tables' => array( 'archive' ),
RETURN (x + y - BITAND(x, y));
END;
/*$mw$*/
+
+/*$mw$*/
+CREATE OR REPLACE FUNCTION BITNOT (x IN NUMBER) RETURN NUMBER AS
+BEGIN
+ RETURN (4294967295 - x);
+END;
+/*$mw$*/
+