]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/LinkCache.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / includes / LinkCache.php
index 4f74cdd70fcd172664f8891a12d5a58318218bde..8d035763e3ef02c8f3b925531d488a2021437271 100644 (file)
@@ -33,7 +33,7 @@ class LinkCache {
        /**
         * General accessor to get/set whether SELECT FOR UPDATE should be used
         */
-       public function forUpdate( $update = NULL ) {
+       public function forUpdate( $update = null ) {
                return wfSetVar( $this->mForUpdate, $update );
        }
 
@@ -57,7 +57,7 @@ class LinkCache {
                if ( array_key_exists( $dbkey, $this->mGoodLinkFields ) ) {
                        return $this->mGoodLinkFields[$dbkey][$field];
                } else {
-                       return NULL;
+                       return null;
                }
        }
 
@@ -72,10 +72,12 @@ class LinkCache {
         * @param int $len
         * @param int $redir
         */
-       public function addGoodLinkObj( $id, $title, $len = -1, $redir = NULL ) {
+       public function addGoodLinkObj( $id, $title, $len = -1, $redir = null ) {
                $dbkey = $title->getPrefixedDbKey();
-               $this->mGoodLinks[$dbkey] = $id;
-               $this->mGoodLinkFields[$dbkey] = array( 'length' => $len, 'redirect' => $redir );
+               $this->mGoodLinks[$dbkey] = intval( $id );
+               $this->mGoodLinkFields[$dbkey] = array(
+                       'length' => intval( $len ),
+                       'redirect' => intval( $redir ) );
        }
 
        public function addBadLinkObj( $title ) {
@@ -112,7 +114,7 @@ class LinkCache {
         * @param $redir bool, is redirect?
         * @return integer
         */
-       public function addLink( $title, $len = -1, $redir = NULL ) {
+       public function addLink( $title, $len = -1, $redir = null ) {
                $nt = Title::newFromDBkey( $title );
                if( $nt ) {
                        return $this->addLinkObj( $nt, $len, $redir );
@@ -128,7 +130,7 @@ class LinkCache {
         * @param $redir bool, is redirect?
         * @return integer
         */
-       public function addLinkObj( &$nt, $len = -1, $redirect = NULL ) {
+       public function addLinkObj( &$nt, $len = -1, $redirect = null ) {
                global $wgAntiLockFlags, $wgProfiler;
                wfProfileIn( __METHOD__ );
 
@@ -167,9 +169,9 @@ class LinkCache {
                        __METHOD__, $options );
                # Set fields...
                if ( $s !== false ) {
-                       $id = $s->page_id;
-                       $len = $s->page_len;
-                       $redirect = $s->page_is_redirect;
+                       $id = intval( $s->page_id );
+                       $len = intval( $s->page_len );
+                       $redirect = intval( $s->page_is_redirect );
                } else {
                        $len = -1;
                        $redirect = 0;