+ /**
+ * Move a file associated with a page to a new location.
+ * Can also be used to revert after a DB failure.
+ *
+ * @private
+ * @param Title Old location to move the file from.
+ * @param Title New location to move the file to.
+ * @return Status
+ */
+ private function moveFile( $oldTitle, $newTitle ) {
+ $status = Status::newFatal(
+ 'cannotdelete',
+ $oldTitle->getPrefixedText()
+ );
+
+ $file = wfLocalFile( $oldTitle );
+ $file->load( File::READ_LATEST );
+ if ( $file->exists() ) {
+ $status = $file->move( $newTitle );
+ }
+
+ // Clear RepoGroup process cache
+ RepoGroup::singleton()->clearCache( $oldTitle );
+ RepoGroup::singleton()->clearCache( $newTitle ); # clear false negative cache
+ return $status;
+ }
+