Some HipHop fixes:
[lhc/web/wiklou.git] / includes / filerepo / File.php
index c8b1cde..0b5e374 100644 (file)
@@ -176,7 +176,7 @@ abstract class File {
         * @return Title
         */
        public function getTitle() { return $this->title; }
-       
+
        /**
         * Return the title used to find this file
         */
@@ -229,6 +229,8 @@ abstract class File {
        * i.e. whether the files are all found in the same directory,
        * or in hashed paths like /images/3/3c.
        *
+       * Most callers don't check the return value, but ForeignAPIFile::getPath
+       * returns false.
        */
        public function getPath() {
                if ( !isset( $this->path ) ) {
@@ -240,7 +242,7 @@ abstract class File {
        /**
        * Alias for getPath()
        *
-       * @deprecated Use getPath().
+       * @deprecated since 1.18 Use getPath().
        */
        public function getFullPath() {
                wfDeprecated( __METHOD__ );
@@ -286,8 +288,8 @@ abstract class File {
        }
 
        /**
-         *  Return true if the file is vectorized
-         */
+        *  Return true if the file is vectorized
+        */
        public function isVectorized() {
                $handler = $this->getHandler();
                if ( $handler ) {
@@ -316,7 +318,7 @@ abstract class File {
                $handler = $this->getHandler();
                if ( !is_array( $metadata ) ) {
                        //just to make the return type consistant
-                       $metadata = unserialize( $metadata ); 
+                       $metadata = unserialize( $metadata );
                }
                if ( $handler ) {
                        return $handler->convertMetadataVersion( $metadata, $version );
@@ -515,7 +517,7 @@ abstract class File {
        function thumbName( $params ) {
                return $this->generateThumbName( $this->getName(), $params );
        }
-       
+
        /**
         * Generate a thumbnail file name from a name and specified parameters
         *
@@ -610,8 +612,8 @@ abstract class File {
                        if ( file_exists( $thumbPath )) {
                                $thumbTime = filemtime( $thumbPath );
                                if ( $thumbTime !== FALSE &&
-                                    gmdate( 'YmdHis', $thumbTime ) >= $wgThumbnailEpoch ) { 
-       
+                                       gmdate( 'YmdHis', $thumbTime ) >= $wgThumbnailEpoch ) {
+
                                        $thumb = $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
                                        break;
                                }
@@ -627,9 +629,9 @@ abstract class File {
                                        $thumb = $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
                                }
                        }
-                       
-                       // Purge. Useful in the event of Core -> Squid connection failure or squid 
-                       // purge collisions from elsewhere during failure. Don't keep triggering for 
+
+                       // Purge. Useful in the event of Core -> Squid connection failure or squid
+                       // purge collisions from elsewhere during failure. Don't keep triggering for
                        // "thumbs" which have the main image URL though (bug 13776)
                        if ( $wgUseSquid && ( !$thumb || $thumb->isError() || $thumb->getUrl() != $this->getURL()) ) {
                                SquidUpdate::purge( array( $thumbUrl ) );
@@ -903,47 +905,6 @@ abstract class File {
                $this->readOnlyError();
        }
 
-       /**
-        * Get an array of Title objects which are articles which use this file
-        * Also adds their IDs to the link cache
-        *
-        * This is mostly copied from Title::getLinksTo()
-        *
-        * @deprecated Use HTMLCacheUpdate, this function uses too much memory
-        */
-       function getLinksTo( $options = array() ) {
-               wfDeprecated( __METHOD__ );
-               wfProfileIn( __METHOD__ );
-
-               // Note: use local DB not repo DB, we want to know local links
-               if ( count( $options ) > 0 ) {
-                       $db = wfGetDB( DB_MASTER );
-               } else {
-                       $db = wfGetDB( DB_SLAVE );
-               }
-               $linkCache = LinkCache::singleton();
-
-               $encName = $db->addQuotes( $this->getName() );
-               $res = $db->select( array( 'page', 'imagelinks'), 
-                                                       array( 'page_namespace', 'page_title', 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ),
-                                                       array( 'page_id=il_from', 'il_to' => $encName ),
-                                                       __METHOD__,
-                                                       $options );
-
-               $retVal = array();
-               if ( $db->numRows( $res ) ) {
-                       foreach ( $res as $row ) {
-                               $titleObj = Title::newFromRow( $row );
-                               if ( $titleObj ) {
-                                       $linkCache->addGoodLinkObj( $row->page_id, $titleObj, $row->page_len, $row->page_is_redirect, $row->page_latest );
-                                       $retVal[] = $titleObj;
-                               }
-                       }
-               }
-               wfProfileOut( __METHOD__ );
-               return $retVal;
-       }
-
        function formatMetadata() {
                if ( !$this->getHandler() ) {
                        return false;
@@ -969,6 +930,7 @@ abstract class File {
        function getRepoName() {
                return $this->repo ? $this->repo->getName() : 'unknown';
        }
+
        /*
         * Returns the repository
         */
@@ -991,11 +953,11 @@ abstract class File {
        function isDeleted( $field ) {
                return false;
        }
-       
+
        /**
         * Return the deletion bitfield
         * STUB
-        */     
+        */
        function getVisibility() {
                return 0;
        }
@@ -1063,8 +1025,8 @@ abstract class File {
        }
 
        /**
-        * Returns 'true' if this file is a type which supports multiple pages, 
-        * e.g. DJVU or PDF. Note that this may be true even if the file in 
+        * Returns 'true' if this file is a type which supports multiple pages,
+        * e.g. DJVU or PDF. Note that this may be true even if the file in
         * question only has a single page.
         *
         * @return Bool
@@ -1134,7 +1096,7 @@ abstract class File {
                if ( $renderUrl ) {
                        if ( $this->repo->descriptionCacheExpiry > 0 ) {
                                wfDebug("Attempting to get the description from cache...");
-                               $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', $wgLang->getCode(), 
+                               $key = $this->repo->getLocalCacheKey( 'RemoteFileDescription', 'url', $wgLang->getCode(),
                                                                        $this->getName() );
                                $obj = $wgMemc->get($key);
                                if ($obj) {
@@ -1191,7 +1153,7 @@ abstract class File {
                }
                $ext = $this->getExtension();
                $dotExt = $ext === '' ? '' : ".$ext";
-               return $hash . $dotExt;                         
+               return $hash . $dotExt;
        }
 
        /**
@@ -1326,7 +1288,7 @@ abstract class File {
        function getRedirected() {
                return $this->redirected;
        }
-       
+
        function getRedirectedTitle() {
                if ( $this->redirected ) {
                        if ( !$this->redirectTitle ) {