global $oldid, $redirect, $section;
global $wgLang;
- if($wpSection) { $section=$wpSection; }
+ if(isset($wpSection)) { $section=$wpSection; }
$sk = $wgUser->getSkin();
$isConflict = false;
$now = wfTimestampNow();
$won = wfInvertTimestamp( $now );
wfSeedRandom();
- $rand = mt_rand() / mt_getrandmax();
+ $rand = number_format( mt_rand() / mt_getrandmax(), 12, ".", "" );
$sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text," .
"cur_comment,cur_user,cur_timestamp,cur_minor_edit,cur_counter," .
"cur_restrictions,cur_user_text,cur_is_redirect," .
function showArticle( $text, $subtitle )
{
- global $wgOut, $wgTitle, $wgUser, $wgLinkCache;
+ global $wgOut, $wgTitle, $wgUser, $wgLinkCache, $wgUseBetterLinksUpdate;
$wgLinkCache = new LinkCache();
- $wgOut->addWikiText( $text ); # Just to update links
+
+ # Get old version of link table to allow incremental link updates
+ if ( $wgUseBetterLinksUpdate ) {
+ $wgLinkCache->preFill( $wgTitle );
+ $wgLinkCache->clear();
+ }
+
+ # Now update the link cache by parsing the text
+ $wgOut->addWikiText( $text );
$this->editUpdates( $text );
if( preg_match( "/^#redirect/i", $text ) )
global $wgUser, $wgCacheEpoch;
if(!file_exists( $fn = $this->fileCacheName() ) ) return false;
$cachetime = wfUnix2Timestamp( filemtime( $fn ) );
- $good = ( $this->mTouched <= $cachetime ) &&
- ($wgCacheEpoch <= $cachetime );
+ $good = (( $this->mTouched <= $cachetime ) &&
+ ($wgCacheEpoch <= $cachetime ));
wfDebug(" isFileCacheGood() - cachetime $cachetime, touched {$this->mTouched} epoch {$wgCacheEpoch}, good $good\n");
return $good;
}
function loadFromFileCache() {
- global $wgUseGzip;
+ global $wgUseGzip, $wgOut;
wfDebug(" loadFromFileCache()\n");
$filename=$this->fileCacheName();
$filenamegz = "{$filename}.gz";
+ $wgOut->sendCacheControl();
if( $wgUseGzip
&& wfClientAcceptsGzip()
&& file_exists( $filenamegz)
function saveToFileCache( $text ) {
global $wgUseGzip, $wgCompressByDefault;
- wfDebug(" saveToFileCache()\n");
+ wfDebug(" saveToFileCache()\n", false);
$filename=$this->fileCacheName();
$mydir2=substr($filename,0,strrpos($filename,"/")); # subdirectory level 2
$mydir1=substr($mydir2,0,strrpos($mydir2,"/")); # subdirectory level 1
- if(!file_exists($mydir1)) { mkdir($mydir1,0777); } # create if necessary
- if(!file_exists($mydir2)) { mkdir($mydir2,0777); }
+ if(!file_exists($mydir1)) { mkdir($mydir1,0775); } # create if necessary
+ if(!file_exists($mydir2)) { mkdir($mydir2,0775); }
+
$f = fopen( $filename, "w" );
if($f) {
$now = wfTimestampNow();
if(wfClientAcceptsGzip()) {
header( "Content-Encoding: gzip" );
header( "Vary: Accept-Encoding" );
+ wfDebug(" sending NEW gzip now...\n" );
return $gzout;
}
}