Index: trunk/phase3/maintenance/cleanupImages.php |
— | — | @@ -114,23 +114,9 @@ |
115 | 115 | $db = wfGetDB( DB_MASTER ); |
116 | 116 | $version = 0; |
117 | 117 | $final = $new; |
118 | | - $has_page = Title::makeTitle( NS_FILE, $orig )->exists(); |
119 | 118 | |
120 | | - while( true ) { |
121 | | - $test = $db->selectField( 'image', 'img_name', array( 'img_name' => $final ), __METHOD__ ); |
122 | | - $conflict = ( $test !== false ); |
123 | | - |
124 | | - if( !$conflict && ( $has_page || $version > 0 ) ) { |
125 | | - // If the file has a description page, don't try to move it to a |
126 | | - // title that already has one. But if we have a misnamed file |
127 | | - // with no corresponding page, and there just happens to exist a |
128 | | - // page with no file at the corrected title, it's probably not a |
129 | | - // coincidence and we shouldn't shy from reuniting them. |
130 | | - $conflict = Title::makeTitle( NS_FILE, $final )->exists(); |
131 | | - } |
132 | | - if( !$conflict ) { |
133 | | - break; |
134 | | - } |
| 119 | + while( $db->selectField( 'image', 'img_name', array( 'img_name' => $final ), __METHOD__ ) || |
| 120 | + Title::makeTitle( NS_FILE, $final )->exists() ) { |
135 | 121 | $this->log( "Rename conflicts with '$final'..." ); |
136 | 122 | $version++; |
137 | 123 | $final = $this->appendTitle( $new, "_$version" ); |