Merge "Use Database::addQuotes instead of hard coded apostrophs"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 24 Feb 2017 20:56:22 +0000 (20:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 24 Feb 2017 20:56:22 +0000 (20:56 +0000)
1  2 
includes/EditPage.php
includes/WatchedItemQueryService.php

diff --combined includes/EditPage.php
@@@ -1256,7 -1256,7 +1256,7 @@@ class EditPage 
                $revision = $this->mArticle->getRevisionFetched();
                if ( $revision === null ) {
                        if ( !$this->contentModel ) {
 -                              $this->contentModel = $this->getTitle()->getContentModel();
 +                              throw new RuntimeException( 'EditPage contentModel was false' );
                        }
                        $handler = ContentHandler::getForModelID( $this->contentModel );
  
  
                if ( $content === false || $content === null ) {
                        if ( !$this->contentModel ) {
 -                              $this->contentModel = $this->getTitle()->getContentModel();
 +                              throw new RuntimeException( 'EditPage contentModel was false' );
                        }
                        $handler = ContentHandler::getForModelID( $this->contentModel );
  
                }
                # Give a notice if the user is editing a deleted/moved page...
                if ( !$this->mTitle->exists() ) {
+                       $dbr = wfGetDB( DB_REPLICA );
                        LogEventsList::showLogExtract( $wgOut, [ 'delete', 'move' ], $this->mTitle,
                                '',
                                [
                                        'lim' => 10,
-                                       'conds' => [ "log_action != 'revision'" ],
+                                       'conds' => [ 'log_action != ' . $dbr->addQuotes( 'revision' ) ],
                                        'showIfEmpty' => false,
                                        'msgKey' => [ 'recreate-moveddeleted-warn' ]
                                ]
@@@ -2,7 -2,6 +2,7 @@@
  
  use MediaWiki\Linker\LinkTarget;
  use Wikimedia\Assert\Assert;
 +use Wikimedia\Rdbms\LoadBalancer;
  
  /**
   * Class performing complex database queries related to WatchedItems.
@@@ -402,7 -401,7 +402,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( '' );
                        }
                }