36 public function publish( $srcPath, $flags = 0, array $options = [] ): never {
44 public function restore( $versions = [], $unsuppress =
false ): never {
45 $this->readOnlyError();
54 $this->readOnlyError();
60 public function move( $target ): never {
61 $this->readOnlyError();
69 return File::getDescriptionUrl();
78 if ( !$this->repo->fetchDescription ) {
82 if ( $lang ===
null ) {
83 wfDeprecatedMsg(
'Calling File::getDescriptionText without a lang parameter ' .
84 'was deprecated in MediaWiki 1.46',
'1.46' );
89 $renderUrl = $this->repo->getDescriptionRenderUrl( $this->getName(), $lang->getCode() );
94 $touched = $this->repo->getReplicaDB()->newSelectQueryBuilder()
95 ->select(
'page_touched' )
97 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
98 ->caller( __METHOD__ )->fetchField();
99 if ( $touched ===
false ) {
103 $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
106 return $cache->getWithSetCallback(
107 $this->repo->getLocalCacheKey(
108 'file-foreign-description',
110 md5( $this->getName() ),
113 $this->repo->descriptionCacheExpiry ?: $cache::TTL_UNCACHEABLE,
114 static function ( $oldValue, &$ttl, array &$setOpts ) use ( $renderUrl, $fname ) {
115 wfDebug(
"Fetching shared description from $renderUrl" );
116 $res = MediaWikiServices::getInstance()->getHttpRequestFactory()->
117 get( $renderUrl, [], $fname );
119 $ttl = WANObjectCache::TTL_UNCACHEABLE;
135 $dbr = $this->repo->getReplicaDB();
136 $pageId = $dbr->newSelectQueryBuilder()
137 ->select(
'page_id' )
139 ->where( [
'page_namespace' =>
NS_FILE,
'page_title' => $this->title->getDBkey() ] )
140 ->caller( __METHOD__ )->fetchField();
142 if ( $pageId !==
false ) {
143 $url = $this->repo->makeUrl( [
'curid' => $pageId ] );
144 if (
$url !==
false ) {
154class_alias( ForeignDBFile::class,
'ForeignDBFile' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.