* Throw a showstopper exception when a hook function fails to return a value.
[lhc/web/wiklou.git] / includes / filerepo / UnregisteredLocalFile.php
index 15dcf00..ca4dbc4 100644 (file)
 class UnregisteredLocalFile extends File {
        var $title, $path, $mime, $handler, $dims;
 
-       function newFromPath( $path, $mime ) {
+       static function newFromPath( $path, $mime ) {
                return new UnregisteredLocalFile( false, false, $path, $mime );
        }
 
-       function newFromTitle( $title, $repo ) {
+       static function newFromTitle( $title, $repo ) {
                return new UnregisteredLocalFile( $title, $repo, false, false );
        }
 
@@ -27,7 +27,7 @@ class UnregisteredLocalFile extends File {
                }
                if ( $title ) {
                        $this->title = $title;
-                       $this->name = $title->getDBkey();
+                       $this->name = $repo->getNameFromTitle( $title );
                } else {
                        $this->name = basename( $path );
                        $this->title = Title::makeTitleSafe( NS_IMAGE, $this->name );
@@ -92,7 +92,7 @@ class UnregisteredLocalFile extends File {
 
        function getURL() {
                if ( $this->repo ) {
-                       return $this->repo->getZoneUrl( 'public' ) . $this->repo->getHashPath( $this->name ) . urlencode( $this->name );
+                       return $this->repo->getZoneUrl( 'public' ) . '/' . $this->repo->getHashPath( $this->name ) . urlencode( $this->name );
                } else {
                        return false;
                }