add initEncoding method to proxy class
[lhc/web/wiklou.git] / index.php
index 26bacbf..ec62796 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,4 +1,5 @@
 <?php
+
 #apd_set_pprof_trace();
 # Main wiki script; see design.doc
 #
@@ -69,6 +70,12 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
        $wgOut->errorpage( 'badtitle', 'badtitletext' );
 } else if ( $wgTitle->getInterwiki() != '' ) {
+       if( $wgUseLatin1 ) {
+               # Conversion from UTF-8 may truncate or corrupt non-Latin links.
+               # Grab a fresh copy without doing the automated conversion checks.
+               $interwiki = Title::newFromUrl( $_REQUEST['title'] );
+               if( !is_null( $interwiki ) ) $wgTitle = $interwiki;
+       }
        $url = $wgTitle->getFullURL();
        # Check for a redirect loop
        if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $wgTitle->isLocal() ) {
@@ -84,12 +91,12 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        /* redirect to canonical url, make it a 301 to allow caching */
        $wgOut->setSquidMaxage( 1200 );
        $wgOut->redirect( $wgTitle->getFullURL(), '301');
-} else if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
+} else if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
        # actions that need to be made when we have a special pages
        require_once( 'includes/SpecialPage.php' );
        SpecialPage::executePath( $wgTitle );
 } else {
-       if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
+       if ( NS_MEDIA == $wgTitle->getNamespace() ) {
                $wgTitle = Title::makeTitle( NS_IMAGE, $wgTitle->getDBkey() );
        }
 
@@ -203,6 +210,11 @@ $wgLoadBalancer->saveMasterPos();
 $wgLoadBalancer->commitAll();
 
 $wgOut->output();
+
+foreach ( $wgPostCommitUpdateList as $up ) {
+       $up->doUpdate();
+}
+
 wfProfileOut( 'main-cleanup' );
 
 logProfilingData();