}
if ( $wgCookieSecure === 'detect' ) {
- $wgCookieSecure = ( WebRequest::detectProtocol() === 'https:' );
+ $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
}
// Disable MWDebug for command line mode, this prevents MWDebug from eating up
* @since 1.20
*
* @file
- * @ingroup Diff
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @return integer
*/
protected function getNewOffset() {
- while ( true ) {
- if ( !$this->offsetExists( $this->indexOffset ) ) {
- return $this->indexOffset;
- }
-
+ while ( $this->offsetExists( $this->indexOffset ) ) {
$this->indexOffset++;
}
+
+ return $this->indexOffset;
}
/**
}
public function execute() {
+ global $wgUploadStashMaxAge;
+
$repo = RepoGroup::singleton()->getLocalRepo();
$dbr = $repo->getSlaveDb();
// how far back should this look for files to delete?
- global $wgUploadStashMaxAge;
+ $cutoff = time() - $wgUploadStashMaxAge;
$this->output( "Getting list of files to clean up...\n" );
$res = $dbr->select(
'uploadstash',
'us_key',
- 'us_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( time() - $wgUploadStashMaxAge ) ),
+ 'us_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $cutoff ) ),
__METHOD__
);
}
}
$this->output( "$i done\n" );
+
+ $tempRepo = $repo->getTempRepo();
+ $dir = $tempRepo->getZonePath( 'thumb' );
+ $iterator = $tempRepo->getBackend()->getFileList( array( 'dir' => $dir ) );
+
+ $this->output( "Deleting old thumbnails...\n" );
+ $i = 0;
+ foreach ( $iterator as $file ) {
+ if ( wfTimestamp( TS_UNIX, $tempRepo->getFileTimestamp( "$dir/$file" ) ) < $cutoff ) {
+ $tempRepo->quickPurge( "$dir/$file" );
+ }
+ if ( $i % 100 == 0 ) {
+ $this->output( "$i\n" );
+ }
+ }
+ $this->output( "$i done\n" );
}
}
</p>
!!end
+!! test
+Handling html with a div self-closing tag
+!! input
+<div title />
+<div title/>
+<div title/ >
+<div title=bar />
+<div title=bar/>
+<div title=bar/ >
+!! result
+<p><div title />
+<div title/>
+</p>
+<div>
+<p><div title=bar />
+<div title=bar/>
+</p>
+<div title="bar/"></div>
+</div>
+
+!! end
+
+!! test
+Handling html with a br self-closing tag
+!! input
+<br title />
+<br title/>
+<br title/ >
+<br title=bar />
+<br title=bar/>
+<br title=bar/ >
+!! result
+<p><br title="title" />
+<br title="title" />
+<br />
+<br title="bar" />
+<br title="bar" />
+<br title="bar/" />
+</p>
+!! end
+
!! test
Horizontal ruler (should it add that extra space?)
!! input