X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2FSqlDataUpdate.php;h=51188d85c9929fcbe83ba10ccdb840b42bd61803;hb=4bd5471ca3d1da1b3e9aa351323efb73cc4a8c44;hp=256e8f74c6493d4a36ef0ee7b307de527f5da880;hpb=697a93dbaf74dbe34503d62e01645b20d71392f0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SqlDataUpdate.php b/includes/SqlDataUpdate.php index 256e8f74c6..51188d85c9 100644 --- a/includes/SqlDataUpdate.php +++ b/includes/SqlDataUpdate.php @@ -48,7 +48,7 @@ abstract class SqlDataUpdate extends DataUpdate { public function __construct( $withTransaction = true ) { global $wgAntiLockFlags; - parent::__construct( ); + parent::__construct(); if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) { $this->mOptions = array(); @@ -56,7 +56,7 @@ abstract class SqlDataUpdate extends DataUpdate { $this->mOptions = array( 'FOR UPDATE' ); } - // @todo: get connection only when it's needed? make sure that doesn't break anything, especially transactions! + // @todo get connection only when it's needed? make sure that doesn't break anything, especially transactions! $this->mDb = wfGetDB( DB_MASTER ); $this->mWithTransaction = $withTransaction; @@ -76,7 +76,7 @@ abstract class SqlDataUpdate extends DataUpdate { // NOTE: nested transactions are not supported, only start a transaction if none is open if ( $this->mDb->trxLevel() === 0 ) { - $this->mDb->begin( get_class( $this ) . '::beginTransaction' ); + $this->mDb->begin( get_class( $this ) . '::beginTransaction' ); $this->mHasTransaction = true; } } @@ -95,7 +95,7 @@ abstract class SqlDataUpdate extends DataUpdate { * Abort the database transaction started via beginTransaction (if any). */ public function abortTransaction() { - if ( $this->mHasTransaction ) { + if ( $this->mHasTransaction ) { //XXX: actually... maybe always? $this->mDb->rollback( get_class( $this ) . '::abortTransaction' ); $this->mHasTransaction = false; } @@ -109,7 +109,7 @@ abstract class SqlDataUpdate extends DataUpdate { * @param $dbkeys Array */ protected function invalidatePages( $namespace, array $dbkeys ) { - if ( !count( $dbkeys ) ) { + if ( $dbkeys === array() ) { return; } @@ -127,10 +127,12 @@ abstract class SqlDataUpdate extends DataUpdate { 'page_touched < ' . $this->mDb->addQuotes( $now ) ), __METHOD__ ); + foreach ( $res as $row ) { $ids[] = $row->page_id; } - if ( !count( $ids ) ) { + + if ( $ids === array() ) { return; }