convert "::1" and other pseudo-IPv6 addresses that Apache may throw at us to their...
[lhc/web/wiklou.git] / includes / SpecialContributions.php
index 239fb8b..0907256 100644 (file)
@@ -31,7 +31,7 @@ class ContribsFinder {
                list( $index, $usercond ) = $this->getUserCond();
                $nscond = $this->getNamespaceCond();
                $use_index = $this->dbr->useIndexClause( $index );
-               extract( $this->dbr->tableNames( 'revision', 'page' ) );
+               list( $revision, $page) = $this->dbr->tableNamesN( 'revision', 'page' );
                $sql =  "SELECT rev_timestamp " .
                        " FROM $page,$revision $use_index " .
                        " WHERE rev_page=page_id AND $usercond $nscond" .
@@ -82,7 +82,7 @@ class ContribsFinder {
                $nscond = $this->getNamespaceCond();
 
                $use_index = $this->dbr->useIndexClause( $index );
-               extract( $this->dbr->tableNames( 'page', 'revision' ) );
+               list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
 
                $sql =  "SELECT rev_timestamp FROM $page, $revision $use_index " .
                        "WHERE page_id = rev_page AND rev_timestamp > '" . $this->offset . "' AND " .
@@ -106,7 +106,7 @@ class ContribsFinder {
        function getFirstOffsetForPaging() {
                list( $index, $usercond ) = $this->getUserCond();
                $use_index = $this->dbr->useIndexClause( $index );
-               extract( $this->dbr->tableNames( 'page', 'revision' ) );
+               list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
                $nscond = $this->getNamespaceCond();
                $sql =  "SELECT rev_timestamp FROM $page, $revision $use_index " .
                        "WHERE page_id = rev_page AND " .
@@ -128,9 +128,9 @@ class ContribsFinder {
        }
 
        /* private */ function makeSql() {
-               $userCond = $condition = $index = $offsetQuery = '';
+               $offsetQuery = '';
 
-               extract( $this->dbr->tableNames( 'page', 'revision' ) );
+               list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
                list( $index, $userCond ) = $this->getUserCond();
 
                if ( $this->offset )
@@ -168,7 +168,6 @@ class ContribsFinder {
  */
 function wfSpecialContributions( $par = null ) {
        global $wgUser, $wgOut, $wgLang, $wgRequest;
-       $fname = 'wfSpecialContributions';
 
        $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
        if ( !strlen( $target ) ) {
@@ -186,9 +185,11 @@ function wfSpecialContributions( $par = null ) {
 
        list( $options['limit'], $options['offset']) = wfCheckLimits();
        $options['offset'] = $wgRequest->getVal( 'offset' );
-       /* Offset must be an integral. */
-       if ( !strlen( $options['offset'] ) || !preg_match( '/^[0-9]+$/', $options['offset'] ) )
-               $options['offset'] = '';
+       /* Offset must be an integral, unless the db is using timestamps */
+       $dbr =& wfGetDB( DB_SLAVE );
+       if ( !strlen( $options['offset'] ) ||
+               ( !$dbr->realTimestamps() && !preg_match( '/^[0-9]+$/', $options['offset'] ) ) )
+       $options['offset'] = '';
 
        $title = SpecialPage::getTitleFor( 'Contributions' );
        $options['target'] = $target;