From: Ilmari Karonen Date: Mon, 1 Dec 2008 17:14:30 +0000 (+0000) Subject: Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit). X-Git-Tag: 1.31.0-rc.0~44155 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=34fb6297cdd897542647d4281bd4ec969367ee53;p=lhc%2Fweb%2Fwiklou.git Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit). This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004). --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d8315158aa..428e567d14 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -64,7 +64,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN For backward compatibility purposes, Image still works. External tools may need to be updated. * The constants NS_FILE and NS_FILE_TALK can now be used instead of NS_IMAGE and - NS_IMAGE_TALK. The old constants are retained as aliases for compatibility. + NS_IMAGE_TALK. The old constants are retained as aliases for compatibility, + and should still be used in code meant to be compatible with v1.13 or older. * MediaWiki can be forced to use private IPs forwarded by a proxy server by using $wgUsePrivateIPs. diff --git a/img_auth.php b/img_auth.php index 4b625e3972..9141018103 100644 --- a/img_auth.php +++ b/img_auth.php @@ -48,7 +48,7 @@ if( preg_match( '!\d+px-(.*)!i', $name, $m ) ) $name = $m[1]; wfDebugLog( 'img_auth', "\$name is {$name}" ); -$title = Title::makeTitleSafe( NS_IMAGE, $name ); +$title = Title::makeTitleSafe( NS_FILE, $name ); if( !$title instanceof Title ) { wfDebugLog( 'img_auth', "Unable to construct a valid Title from `{$name}`" ); wfForbidden(); diff --git a/includes/Article.php b/includes/Article.php index fba1f82485..262806e26c 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1219,7 +1219,7 @@ class Article { $where = array( 'rd_from' => $this->getId() ); $dbw->delete( 'redirect', $where, __METHOD__); } - if( $this->getTitle()->getNamespace() == NS_IMAGE ) { + if( $this->getTitle()->getNamespace() == NS_FILE ) { RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() ); } wfProfileOut( __METHOD__ ); @@ -3172,7 +3172,7 @@ class Article { $wgMessageCache->replace( $title->getDBkey(), false ); } # Images - if( $title->getNamespace() == NS_IMAGE ) { + if( $title->getNamespace() == NS_FILE ) { $update = new HTMLCacheUpdate( $title, 'imagelinks' ); $update->doUpdate(); } @@ -3518,7 +3518,7 @@ class Article { if( $ns == NS_CATEGORY ) { $addFields[] = 'cat_subcats = cat_subcats + 1'; $removeFields[] = 'cat_subcats = cat_subcats - 1'; - } elseif( $ns == NS_IMAGE ) { + } elseif( $ns == NS_FILE ) { $addFields[] = 'cat_files = cat_files + 1'; $removeFields[] = 'cat_files = cat_files - 1'; } diff --git a/includes/Category.php b/includes/Category.php index ff4643c24c..78567adddc 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -257,7 +257,7 @@ class Category { } $cond1 = $dbw->conditional( 'page_namespace='.NS_CATEGORY, 1, 'NULL' ); - $cond2 = $dbw->conditional( 'page_namespace='.NS_IMAGE, 1, 'NULL' ); + $cond2 = $dbw->conditional( 'page_namespace='.NS_FILE, 1, 'NULL' ); $result = $dbw->selectRow( array( 'categorylinks', 'page' ), array( 'COUNT(*) AS pages', diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 47393e5711..f150e372e9 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -234,7 +234,7 @@ class CategoryViewer { if( $title->getNamespace() == NS_CATEGORY ) { $cat = Category::newFromRow( $x, $title ); $this->addSubcategoryObject( $cat, $x->cl_sortkey, $x->page_len ); - } elseif( $this->showGallery && $title->getNamespace() == NS_IMAGE ) { + } elseif( $this->showGallery && $title->getNamespace() == NS_FILE ) { $this->addImage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect ); } else { $this->addPage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect ); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3c9de2a7c9..6f48361595 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1915,7 +1915,7 @@ $wgNamespacesWithSubpages = array( NS_USER => true, NS_USER_TALK => true, NS_PROJECT_TALK => true, - NS_IMAGE_TALK => true, + NS_FILE_TALK => true, NS_MEDIAWIKI_TALK => true, NS_TEMPLATE_TALK => true, NS_HELP_TALK => true, diff --git a/includes/EditPage.php b/includes/EditPage.php index a974ca7aac..ea4c056e27 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -738,7 +738,7 @@ class EditPage { } # Check image redirect - if ( $this->mTitle->getNamespace() == NS_IMAGE && + if ( $this->mTitle->getNamespace() == NS_FILE && Title::newFromRedirect( $this->textbox1 ) instanceof Title && !$wgUser->isAllowed( 'upload' ) ) { if ( $wgUser->isAnon() ) { @@ -1971,7 +1971,7 @@ END array( 'image' => $wgLang->getImageFile('button-image'), 'id' => 'mw-editbutton-image', - 'open' => '[['.$wgContLang->getNsText(NS_IMAGE).':', + 'open' => '[['.$wgContLang->getNsText(NS_FILE).':', 'close' => ']]', 'sample' => wfMsg('image_sample'), 'tip' => wfMsg('image_tip'), diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 492a3e06e9..f3f525c11d 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -244,7 +244,7 @@ class ImageGallery $img = wfFindFile( $nt, $time ); - if( $nt->getNamespace() != NS_IMAGE || !$img ) { + if( $nt->getNamespace() != NS_FILE || !$img ) { # We're dealing with a non-image, spit out the name and be done with it. $thumbhtml = "\n\t\t\t".'
' . htmlspecialchars( $nt->getText() ) . '
'; diff --git a/includes/ImagePage.php b/includes/ImagePage.php index cd0ef0aae4..0638a5b869 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -57,7 +57,7 @@ class ImagePage extends Article { global $wgOut, $wgShowEXIF, $wgRequest, $wgUser; $this->loadFile(); - if( $this->mTitle->getNamespace() == NS_IMAGE && $this->img->getRedirected() ) { + if( $this->mTitle->getNamespace() == NS_FILE && $this->img->getRedirected() ) { if( $this->mTitle->getDBkey() == $this->img->getName() ) { // mTitle is the same as the redirect target so ask Article // to perform the redirect for us. @@ -66,7 +66,7 @@ class ImagePage extends Article { // mTitle is not the same as the redirect target so it is // probably the redirect page itself. Fake the redirect symbol $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); - $wgOut->addHTML( $this->viewRedirect( Title::makeTitle( NS_IMAGE, $this->img->getName() ), + $wgOut->addHTML( $this->viewRedirect( Title::makeTitle( NS_FILE, $this->img->getName() ), /* $appendSubtitle */ true, /* $forceKnown */ true ) ); $this->viewUpdates(); return; @@ -76,7 +76,7 @@ class ImagePage extends Article { $diff = $wgRequest->getVal( 'diff' ); $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); - if( $this->mTitle->getNamespace() != NS_IMAGE || ( isset( $diff ) && $diffOnly ) ) + if( $this->mTitle->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) ) return Article::view(); if( $wgShowEXIF && $this->displayImg->exists() ) { @@ -152,7 +152,7 @@ class ImagePage extends Article { if( $from == $to ) { return null; } - return $this->mRedirectTarget = Title::makeTitle( NS_IMAGE, $to ); + return $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to ); } public function followRedirect() { $this->loadFile(); @@ -164,7 +164,7 @@ class ImagePage extends Article { if( $from == $to ) { return false; } - return Title::makeTitle( NS_IMAGE, $to ); + return Title::makeTitle( NS_FILE, $to ); } public function isRedirect( $text = false ) { $this->loadFile(); @@ -222,7 +222,7 @@ class ImagePage extends Article { protected function showTOC( $metadata ) { global $wgLang; $r = '