*/
if ( !defined( 'MEDIAWIKI' ) ) {
- require_once( dirname( __FILE__ ) . '/../commandLine.inc' );
+ require_once( __DIR__ . '/../commandLine.inc' );
$cs = new CheckStorage;
$fix = isset( $options['fix'] );
// ----------------------------------------------------------------------------------
/**
+ * Maintenance script to do various checks on external storage.
+ *
* @ingroup Maintenance ExternalStorage
*/
class CheckStorage {
const CONCAT_HEADER = 'O:27:"concatenatedgziphistoryblob"';
- var $oldIdMap, $errors;
- var $dbStore = null;
+ public $oldIdMap, $errors;
+ public $dbStore = null;
- var $errorDescriptions = array(
+ public $errorDescriptions = array(
'restore text' => 'Damaged text, need to be restored from a backup',
'restore revision' => 'Damaged revision row, need to be restored from a backup',
'unfixable' => 'Unexpected errors with no automated fixing method',
}
function restoreText( $revIds, $xml ) {
- global $wgTmpDirectory, $wgDBname;
+ global $wgDBname;
+ $tmpDir = wfTempDir();
if ( !count( $revIds ) ) {
return;
print "Restoring text from XML backup...\n";
- $revFileName = "$wgTmpDirectory/broken-revlist-$wgDBname";
- $filteredXmlFileName = "$wgTmpDirectory/filtered-$wgDBname.xml";
+ $revFileName = "$tmpDir/broken-revlist-$wgDBname";
+ $filteredXmlFileName = "$tmpDir/filtered-$wgDBname.xml";
// Write revision list
if ( !file_put_contents( $revFileName, implode( "\n", $revIds ) ) ) {
$this->errors['fixed'][$id] = true;
}
}
-