use MediaWiki\Block\Restriction\NamespaceRestriction;
use MediaWiki\Block\Restriction\PageRestriction;
use MediaWiki\Block\Restriction\Restriction;
+use MWException;
use Wikimedia\Rdbms\IResultWrapper;
use Wikimedia\Rdbms\IDatabase;
return [];
}
- $db = $db ?: wfGetDb( DB_REPLICA );
+ $db = $db ?: wfGetDB( DB_REPLICA );
$result = $db->select(
[ 'ipblocks_restrictions', 'page' ],
* @return bool
*/
public static function insert( array $restrictions ) {
- if ( empty( $restrictions ) ) {
+ if ( !$restrictions ) {
return false;
}
$rows[] = $restriction->toRow();
}
- if ( empty( $rows ) ) {
+ if ( !$rows ) {
return false;
}
$dbw = wfGetDB( DB_MASTER );
- return $dbw->insert(
+ $dbw->insert(
'ipblocks_restrictions',
$rows,
__METHOD__,
[ 'IGNORE' ]
);
+
+ return true;
}
/**
$restrictions
);
- // Nothing to remove.
if ( empty( $restrictionsToRemove ) ) {
continue;
}
$parentBlockId = (int)$parentBlockId;
- $db = wfGetDb( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
$db->startAtomic( __METHOD__ );