ForeignDBFile.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @ingroup FileRepo
  4. */
  5. class ForeignDBFile extends LocalFile {
  6. static function newFromTitle( $title, $repo, $unused = null ) {
  7. return new self( $title, $repo );
  8. }
  9. /**
  10. * Create a ForeignDBFile from a title
  11. * Do not call this except from inside a repo class.
  12. */
  13. static function newFromRow( $row, $repo ) {
  14. $title = Title::makeTitle( NS_FILE, $row->img_name );
  15. $file = new self( $title, $repo );
  16. $file->loadFromRow( $row );
  17. return $file;
  18. }
  19. function getCacheKey() {
  20. if ( $this->repo->hasSharedCache() ) {
  21. $hashedName = md5($this->name);
  22. return wfForeignMemcKey( $this->repo->dbName, $this->repo->tablePrefix,
  23. 'file', $hashedName );
  24. } else {
  25. return false;
  26. }
  27. }
  28. function publish( $srcPath, $flags = 0 ) {
  29. $this->readOnlyError();
  30. }
  31. function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '',
  32. $watch = false, $timestamp = false ) {
  33. $this->readOnlyError();
  34. }
  35. function restore( $versions = array(), $unsuppress = false ) {
  36. $this->readOnlyError();
  37. }
  38. function delete( $reason, $suppress = false ) {
  39. $this->readOnlyError();
  40. }
  41. function move( $target ) {
  42. $this->readOnlyError();
  43. }
  44. function getDescriptionUrl() {
  45. // Restore remote behaviour
  46. return File::getDescriptionUrl();
  47. }
  48. function getDescriptionText() {
  49. // Restore remote behaviour
  50. return File::getDescriptionText();
  51. }
  52. }