Merge "Various database class cleanups"
[lhc/web/wiklou.git] / includes / deferred / SqlDataUpdate.php
index 49164e3..ff06915 100644 (file)
@@ -35,7 +35,7 @@ abstract class SqlDataUpdate extends DataUpdate {
        protected $mDb;
 
        /** @var array SELECT options to be used (array) */
-       protected $mOptions = array();
+       protected $mOptions = [];
 
        /** @var bool Whether a transaction is open on this object (internal use only!) */
        private $mHasTransaction;
@@ -93,58 +93,9 @@ abstract class SqlDataUpdate extends DataUpdate {
         * Abort the database transaction started via beginTransaction (if any).
         */
        public function abortTransaction() {
-               if ( $this->mHasTransaction ) { //XXX: actually... maybe always?
+               if ( $this->mHasTransaction ) { // XXX: actually... maybe always?
                        $this->mDb->rollback( get_class( $this ) . '::abortTransaction' );
                        $this->mHasTransaction = false;
                }
        }
-
-       /**
-        * Invalidate the cache of a list of pages from a single namespace.
-        * This is intended for use by subclasses.
-        *
-        * @param int $namespace Namespace number
-        * @param array $dbkeys
-        */
-       protected function invalidatePages( $namespace, array $dbkeys ) {
-               if ( $dbkeys === array() ) {
-                       return;
-               }
-
-               $dbw = $this->mDb;
-               $dbw->onTransactionPreCommitOrIdle( function() use ( $dbw, $namespace, $dbkeys ) {
-                       /**
-                        * Determine which pages need to be updated
-                        * This is necessary to prevent the job queue from smashing the DB with
-                        * large numbers of concurrent invalidations of the same page
-                        */
-                       $now = $dbw->timestamp();
-                       $ids = $dbw->selectFieldValues( 'page',
-                               'page_id',
-                               array(
-                                       'page_namespace' => $namespace,
-                                       'page_title' => $dbkeys,
-                                       'page_touched < ' . $dbw->addQuotes( $now )
-                               ),
-                               __METHOD__
-                       );
-
-                       if ( $ids === array() ) {
-                               return;
-                       }
-
-                       /**
-                        * Do the update
-                        * We still need the page_touched condition, in case the row has changed since
-                        * the non-locking select above.
-                        */
-                       $dbw->update( 'page',
-                               array( 'page_touched' => $now ),
-                               array(
-                                       'page_id' => $ids,
-                                       'page_touched < ' . $dbw->addQuotes( $now )
-                               ), __METHOD__
-                       );
-               } );
-       }
 }