ChangesListSpecialPage: Add urlversion and make urlversion=2 ignore defaults
[lhc/web/wiklou.git] / includes / WatchedItemQueryService.php
index c80e4a5..22d5439 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 
+use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Linker\LinkTarget;
 use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\LoadBalancer;
 
 /**
  * Class performing complex database queries related to WatchedItems.
@@ -388,7 +390,7 @@ class WatchedItemQueryService {
                }
 
                if ( array_key_exists( 'rcTypes', $options ) ) {
-                       $conds['rc_type'] = array_map( 'intval',  $options['rcTypes'] );
+                       $conds['rc_type'] = array_map( 'intval', $options['rcTypes'] );
                }
 
                $conds = array_merge(
@@ -401,7 +403,7 @@ class WatchedItemQueryService {
                if ( !isset( $options['start'] ) && !isset( $options['end'] ) ) {
                        if ( $db->getType() === 'mysql' ) {
                                // This is an index optimization for mysql
-                               $conds[] = "rc_timestamp > ''";
+                               $conds[] = 'rc_timestamp > ' . $db->addQuotes( '' );
                        }
                }
 
@@ -504,7 +506,7 @@ class WatchedItemQueryService {
                        $conds[] = 'rc_user_text != ' . $db->addQuotes( $options['notByUser'] );
                }
 
-               // Avoid brute force searches (bug 17342)
+               // Avoid brute force searches (T19342)
                $bitmask = 0;
                if ( !$user->isAllowed( 'deletedhistory' ) ) {
                        $bitmask = Revision::DELETED_USER;
@@ -563,7 +565,7 @@ class WatchedItemQueryService {
                }
                if ( isset( $options['filter'] ) ) {
                        $filter = $options['filter'];
-                       if ( $filter ===  self::FILTER_CHANGED ) {
+                       if ( $filter === self::FILTER_CHANGED ) {
                                $conds[] = 'wl_notificationtimestamp IS NOT NULL';
                        } else {
                                $conds[] = 'wl_notificationtimestamp IS NULL';