added $wgUseValidation
[lhc/web/wiklou.git] / index.php
index 9eb5e29..85403d9 100644 (file)
--- a/index.php
+++ b/index.php
@@ -11,6 +11,7 @@ if(!file_exists("LocalSettings.php")) {
 }
 
 define( "MEDIAWIKI", true );
+require_once( "./includes/Defines.php" );
 require_once( "./LocalSettings.php" );
 require_once( "includes/Setup.php" );
 
@@ -95,7 +96,6 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                $wgArticle = new Article( $wgTitle );
        }
 
-       wfQuery("BEGIN", DB_WRITE);
        switch( $action ) {
                case "view":
                        $wgOut->setSquidMaxage( $wgSquidMaxage );
@@ -108,6 +108,8 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                case "rollback":
                case "protect":
                case "unprotect":
+               case "validate":
+               case "info":
                        $wgArticle->$action();
                        break;
                case "print":
@@ -129,6 +131,10 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                                wfCreativeCommonsRdf( $wgArticle );
                        }
                        break;
+               case "credits":
+                       require_once( "includes/Credits.php" );
+                       showCreditsPage( $wgArticle );
+                       break;
                case "edit":
                case "submit":
                        if( !$wgCommandLineMode && !$wgRequest->checkSessionCookie() ) {
@@ -160,12 +166,23 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                default:
                        $wgOut->errorpage( "nosuchaction", "nosuchactiontext" );
        }
-       wfQuery("COMMIT", DB_WRITE);
 }
 
+# Deferred updates aren't really deferred anymore. It's important to report errors to the
+# user, and that means doing this before OutputPage::output(). Note that for page saves, 
+# the client will wait until the script exits anyway before following the redirect.
+foreach ( $wgDeferredUpdateList as $up ) {
+       $up->doUpdate();
+}
+
+$wgLoadBalancer->saveMasterPos();
+
+# Now commit any transactions, so that unreported errors after output() don't roll back the whole thing
+$wgLoadBalancer->commitAll();
+
 $wgOut->output();
 
-foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); }
 logProfilingData();
+$wgLoadBalancer->closeAll();
 wfDebug( "Request ended normally\n" );
 ?>