Make use of \File::getArchiveRel to avoid code duplication
[lhc/web/wiklou.git] / includes / filerepo / file / OldLocalFile.php
index 9759b79..ad95bb4 100644 (file)
@@ -115,13 +115,14 @@ class OldLocalFile extends LocalFile {
                global $wgActorTableSchemaMigrationStage;
 
                wfDeprecated( __METHOD__, '1.31' );
-               if ( $wgActorTableSchemaMigrationStage > MIGRATION_WRITE_BOTH ) {
+               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
                        // If code is using this instead of self::getQueryInfo(), there's a
                        // decent chance it's going to try to directly access
                        // $row->oi_user or $row->oi_user_text and we can't give it
-                       // useful values here once those aren't being written anymore.
+                       // useful values here once those aren't being used anymore.
                        throw new BadMethodCallException(
-                               'Cannot use ' . __METHOD__ . ' when $wgActorTableSchemaMigrationStage > MIGRATION_WRITE_BOTH'
+                               'Cannot use ' . __METHOD__
+                                       . ' when $wgActorTableSchemaMigrationStage has SCHEMA_COMPAT_READ_NEW'
                        );
                }
 
@@ -138,7 +139,7 @@ class OldLocalFile extends LocalFile {
                        'oi_minor_mime',
                        'oi_user',
                        'oi_user_text',
-                       'oi_actor' => $wgActorTableSchemaMigrationStage > MIGRATION_OLD ? 'oi_actor' : 'NULL',
+                       'oi_actor' => 'NULL',
                        'oi_timestamp',
                        'oi_deleted',
                        'oi_sha1',
@@ -324,14 +325,14 @@ class OldLocalFile extends LocalFile {
         * @return string
         */
        function getRel() {
-               return 'archive/' . $this->getHashPath() . $this->getArchiveName();
+               return $this->getArchiveRel( $this->getArchiveName() );
        }
 
        /**
         * @return string
         */
        function getUrlRel() {
-               return 'archive/' . $this->getHashPath() . rawurlencode( $this->getArchiveName() );
+               return $this->getArchiveRel( rawurlencode( $this->getArchiveName() ) );
        }
 
        function upgradeRow() {
@@ -415,7 +416,7 @@ class OldLocalFile extends LocalFile {
        function uploadOld( $srcPath, $archiveName, $timestamp, $comment, $user ) {
                $this->lock();
 
-               $dstRel = 'archive/' . $this->getHashPath() . $archiveName;
+               $dstRel = $this->getArchiveRel( $archiveName );
                $status = $this->publishTo( $srcPath, $dstRel );
 
                if ( $status->isGood() ) {