/**
* @param Database &$db To perform updates on
* @param bool $shared Whether to perform updates on shared tables
- * @param Maintenance $maintenance Maintenance object which created us
+ * @param Maintenance|null $maintenance Maintenance object which created us
*/
protected function __construct( Database &$db, $shared, Maintenance $maintenance = null ) {
$this->db = $db;
* Output some text. If we're running from web, escape the text first.
*
* @param string $str Text to output
+ * @param-taint $str escapes_html
*/
public function output( $str ) {
if ( $this->maintenance->isQuiet() ) {
* Obviously, only use this for updates that occur after the updatelog table was
* created!
* @param string $key Name of key to insert
- * @param string $val [optional] Value to insert along with the key
+ * @param string|null $val [optional] Value to insert along with the key
*/
public function insertUpdateRow( $key, $val = null ) {
$this->db->clearFlag( DBO_DDLMODE );
*
* @param string $path Path to the patch file
* @param bool $isFullPath Whether to treat $path as a relative or not
- * @param string $msg Description of the patch
+ * @param string|null $msg Description of the patch
* @return bool False if patch is skipped.
*/
protected function applyPatch( $path, $isFullPath = false, $msg = null ) {
$this->output( "done.\n" );
}
}
+
+ /**
+ * Populates the MCR content tables
+ * @since 1.32
+ */
+ protected function populateContentTables() {
+ global $wgMultiContentRevisionSchemaMigrationStage;
+ if ( ( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) &&
+ !$this->updateRowExists( 'PopulateContentTables' )
+ ) {
+ $this->output(
+ "Migrating revision data to the MCR 'slot' and 'content' tables, printing progress markers.\n" .
+ "For large databases, you may want to hit Ctrl-C and do this manually with\n" .
+ "maintenance/populateContentTables.php.\n"
+ );
+ $task = $this->maintenance->runChild(
+ PopulateContentTables::class, 'populateContentTables.php'
+ );
+ $ok = $task->execute();
+ $this->output( $ok ? "done.\n" : "errors were encountered.\n" );
+ if ( $ok ) {
+ $this->insertUpdateRow( 'PopulateContentTables' );
+ }
+ }
+ }
}