From: jeroendedauw Date: Tue, 31 Jul 2012 18:33:10 +0000 (+0200) Subject: Support deleting all rows X-Git-Tag: 1.31.0-rc.0~22879^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=3ec9d41fb950ae8977cf9d696407ea23d43e9d68;p=lhc%2Fweb%2Fwiklou.git Support deleting all rows Change-Id: I36ee33580261f39cb0ba69473f5afac9a5135853 --- diff --git a/includes/db/ORMTable.php b/includes/db/ORMTable.php index a4396af4e4..bd6bf0b817 100644 --- a/includes/db/ORMTable.php +++ b/includes/db/ORMTable.php @@ -329,7 +329,7 @@ abstract class ORMTable implements IORMTable { public function delete( array $conditions, $functionName = null ) { return wfGetDB( DB_MASTER )->delete( $this->getName(), - $this->getPrefixedValues( $conditions ), + $conditions === array() ? '*' : $this->getPrefixedValues( $conditions ), $functionName ) !== false; // DatabaseBase::delete does not always return true for success as documented... } @@ -452,7 +452,10 @@ abstract class ORMTable implements IORMTable { public function updateSummaryFields( $summaryFields = null, array $conditions = array() ) { $this->setReadDb( DB_MASTER ); - foreach ( $this->select( null, $conditions ) as /* IORMRow */ $item ) { + /** + * @var IORMRow $item + */ + foreach ( $this->select( null, $conditions ) as $item ) { $item->loadSummaryFields( $summaryFields ); $item->setSummaryMode( true ); $item->save();