$this->mFlags |= DBO_TRX;
}
}
+
+ /*
+ // Faster read-only access
+ if ( wfReadOnly() ) {
+ $this->mFlags |= DBO_PERSISTENT;
+ $this->mFlags &= ~DBO_TRX;
+ }*/
/** Get the default table prefix*/
if ( $tablePrefix == 'get from global' ) {
$success = false;
- @/**/$this->mConn = mysql_connect( $server, $user, $password );
+ if ( $this->mFlags & DBO_PERSISTENT ) {
+ @/**/$this->mConn = mysql_pconnect( $server, $user, $password );
+ } else {
+ @/**/$this->mConn = mysql_connect( $server, $user, $password );
+ }
+
if ( $dbName != '' ) {
if ( $this->mConn !== false ) {
$success = @/**/mysql_select_db( $dbName, $this->mConn );
wfDebug("SQL ERROR (ignored): " . $error . "\n");
} else {
$sql1line = str_replace( "\n", "\\n", $sql );
- wfLogDBError("$fname\t$errno\t$error\t$sql1line\n");
+ wfLogDBError("$fname\t{$this->mServer}\t$errno\t$error\t$sql1line\n");
wfDebug("SQL ERROR: " . $error . "\n");
if ( $wgCommandLineMode || !$this->mOut || empty( $wgFullyInitialised ) ) {
$message = "A database error has occurred\n" .
define( 'DBO_IGNORE', 4 );
define( 'DBO_TRX', 8 );
define( 'DBO_DEFAULT', 16 );
+define( 'DBO_PERSISTENT', 32 );
/**#@-*/
/**#@+
"width=\"$width\" height=\"$height\"" );
}
+/**
+ * Is an image on the bad image list?
+ */
+function wfIsBadImage( $name ) {
+ global $wgLang;
+
+ $lines = explode("\n", wfMsgForContent( 'bad_image_list' ));
+ foreach ( $lines as $line ) {
+ if ( preg_match( '/^\*\s*\[\[:(' . $wgLang->getNsText( NS_IMAGE ) . ':[^\]]*)\]\]/', $line, $m ) ) {
+ $t = Title::newFromText( $m[1] );
+ if ( $t->getDBkey() == $name ) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+
/**
* Wrapper class for thumbnail images
}
# Now save it back to the DB:
- $outmd5_sql = pack('H32', $this->hash);
-
- $md5_sql = pack('H32', $this->md5); # Binary packed, not hex
+ if ( !wfReadOnly() ) {
+ $outmd5_sql = pack('H32', $this->hash);
- $dbw =& wfGetDB( DB_MASTER );
- $dbw->replace( 'math', array( 'math_inputhash' ),
- array(
- 'math_inputhash' => $md5_sql,
- 'math_outputhash' => $outmd5_sql,
- 'math_html_conservativeness' => $this->conservativeness,
- 'math_html' => $this->html,
- 'math_mathml' => $this->mathml,
- ), $fname, array( 'IGNORE' )
- );
+ $md5_sql = pack('H32', $this->md5); # Binary packed, not hex
+
+ $dbw =& wfGetDB( DB_MASTER );
+ $dbw->replace( 'math', array( 'math_inputhash' ),
+ array(
+ 'math_inputhash' => $md5_sql,
+ 'math_outputhash' => $outmd5_sql,
+ 'math_html_conservativeness' => $this->conservativeness,
+ 'math_html' => $this->html,
+ 'math_mathml' => $this->mathml,
+ ), $fname, array( 'IGNORE' )
+ );
+ }
}
if ( $ns == NS_IMAGE ) {
wfProfileIn( "$fname-image" );
-
- # recursively parse links inside the image caption
- # actually, this will parse them in any other parameters, too,
- # but it might be hard to fix that, and it doesn't matter ATM
- $text = $this->replaceExternalLinks($text);
- $text = $this->replaceInternalLinks($text);
-
- # cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
- $s .= $prefix . str_replace('http://', 'http-noparse://', $sk->makeImageLinkObj( $nt, $text ) ) . $trail;
- $wgLinkCache->addImageLinkObj( $nt );
-
+ if ( !wfIsBadImage( $nt->getDBkey() ) ) {
+ # recursively parse links inside the image caption
+ # actually, this will parse them in any other parameters, too,
+ # but it might be hard to fix that, and it doesn't matter ATM
+ $text = $this->replaceExternalLinks($text);
+ $text = $this->replaceInternalLinks($text);
+
+ # cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
+ $s .= $prefix . str_replace('http://', 'http-noparse://', $sk->makeImageLinkObj( $nt, $text ) ) . $trail;
+ $wgLinkCache->addImageLinkObj( $nt );
+
+ wfProfileOut( "$fname-image" );
+ continue;
+ }
wfProfileOut( "$fname-image" );
- continue;
+
}
if ( $ns == NS_CATEGORY ) {
function userCan($action) {
$fname = 'Title::userCanEdit';
wfProfileIn( $fname );
-
+
global $wgUser;
if( NS_SPECIAL == $this->mNamespace ) {
wfProfileOut( $fname );
* @access public
*/
function invalidateCache() {
+ if ( wfReadOnly() ) {
+ return;
+ }
+
$now = wfTimestampNow();
$dbw =& wfGetDB( DB_MASTER );
$success = $dbw->update( 'page',
# Decide whether or not each one needs to be overwritten
$existingTitles = array();
while ( $row ) {
- if ( $row->rev_user_text != $username ) {
+ if ( $row->rev_user_text != $username && $row->rev_user_text != 'Template namespace initialisation script' ) {
$existingTitles[$row->page_title] = 'keep';
} else {
$existingTitles[$row->page_title] = 'chuck';
ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" );
require_once( "$IP/includes/Defines.php" );
- require_once( "/home/wikipedia/common/php-new/CommonSettings.php" );
+ require_once( "/home/wikipedia/common/php-1.4/CommonSettings.php" );
} else {
$wgWikiFarm = false;
$settingsFile = "$IP/LocalSettings.php";
* @subpackage Maintenance
*/
+$wgForceLoadBalancing = (getenv('MW_BALANCE') ? true : false);
+
/** */
require_once( "commandLine.inc" );
-do {
- $line = readconsole( "> " );
+$line = readconsole( "> " );
+
+while ( $line !== false ) {
$val = eval( $line . ";" );
if( is_null( $val ) ) {
echo "\n";
if ( function_exists( "readline_add_history" ) ) {
readline_add_history( $line );
}
-} while ( 1 );
+ $line = readconsole( "> " );
+}
+
+print "\n";
?>
'207.142.131.244',
'207.142.131.249',
'207.142.131.250',
-
+ '207.142.131.216',
+ '10.0.%',
);
$databases = array(
'%wikiquote',
'%wiktionary',
'%wikisource',
+ '%wikinews',
+ '%wikiversity',
+ '%wikimedia',
);
foreach( $hosts as $host ) {