jenkins-bot has submitted this change and it was merged.

Change subject: (Bug 50755) Remove MigrationJob/SMWMigrate
......................................................................


(Bug 50755) Remove MigrationJob/SMWMigrate

MigrationJob/SMWMigrate makes reference to SMWSQLStore2
which no longer exists in 1.9 therefore eliminate related classes.

* Remove MigrationJob class
* Remove SMWMigrate class

Change-Id: Ic507f33b86d858dca4e30b7463431e05e9f9e7c8
---
M includes/Setup.php
D includes/jobs/MigrationJob.php
D maintenance/SMW_migration.php
3 files changed, 0 insertions(+), 179 deletions(-)

Approvals:
  Mwjames: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Setup.php b/includes/Setup.php
index 17b4054..2876b2f 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -427,10 +427,6 @@
        $wgJobClasses['SMW\PropertySubjectsUpdateDispatcherJob']      = 
'SMW\PropertySubjectsUpdateDispatcherJob';
        $wgAutoloadClasses['SMW\PropertySubjectsUpdateDispatcherJob'] = $smwgIP 
. 'includes/jobs/PropertySubjectsUpdateDispatcherJob.php';
 
-       // Store migration job class
-       $wgJobClasses['SMWMigrationJob']          = 'SMW\MigrationJob';
-       $wgAutoloadClasses['SMW\MigrationJob']    = $smwgIP . 
'includes/jobs/MigrationJob.php';
-
        // API modules
        $wgAutoloadClasses['SMW\ApiBase']    = $smwgIP . 
'includes/api/ApiBase.php';
        $wgAutoloadClasses['SMW\ApiQuery']   = $smwgIP . 
'includes/api/ApiQuery.php';
diff --git a/includes/jobs/MigrationJob.php b/includes/jobs/MigrationJob.php
deleted file mode 100644
index f951494..0000000
--- a/includes/jobs/MigrationJob.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-namespace SMW;
-use Job, Title;
-
-/**
- * Migration job Store2 > Store3
- *
- * @since 1.9
- *
- * @file
- * @ingroup SMW
- *
- * @licence GNU GPL v2+
- * @author mwjames
- */
-class MigrationJob extends Job {
-
-       function __construct( $title, $params ) {
-               parent::__construct( 'SMWMigrationJob', $title, $params );
-       }
-
-       /**
-        * Handles the batch run process
-        *
-        * @return boolean status
-        */
-       public function run() {
-               // pos == 0 means we start from scratch and have to pack jobs
-               if ( $this->params['pos'] == 0 ){
-                $this->packJobs();
-               } else {
-                $this->unpackJobs();
-               }
-               return true;
-       }
-
-       /**
-        * Handles the packing process
-        *
-        * @since 1.9
-        */
-       private function packJobs(){
-               $i = 0;
-
-               // DB instance
-               $dbw = wfGetDB( DB_MASTER );
-               $oldStore = new \SMWSQLStore2();
-               $newStore = new \SMWSQLStore3();
-               $res = $dbw->select(
-                       'smw_ids',
-                       array(
-                               'smw_id'
-                       )
-               );
-
-               // Process
-               foreach ( $res as $row ) {
-                       // Collect id's
-                       $i++;
-                       $ids[] = $row->smw_id;
-
-                       // Pack ids into batches and create a self-reference
-                       if ( $i % $this->params['b'] == 0 ){
-                               $title = Title::newFromText( $i );
-                               Job::factory( 'SMWMigrationJob', $title, array( 
'pos' => $i , 'id' => serialize ( $ids ), 'i' => $this->params['i'] ) 
)->insert();
-                               $ids = array();
-                       }
-               }
-
-               // Get leftovers that wheren't in the last batch
-               if ( $ids !== array() ){
-                       $title = Title::newFromText( $i );
-                       Job::factory( 'SMWMigrationJob', $title, array( 'pos' 
=> $i , 'id' => serialize ( $ids ), 'i' => $this->params['i'] ) )->insert();
-                       $ids = array();
-               }
-       }
-
-       /**
-        * Handle the unpacking process
-        *
-        * @since 1.9
-        */
-       private function unpackJobs(){
-               $dbw = wfGetDB( DB_MASTER );
-               $oldStore = new \SMWSQLStore2();
-               $newStore = new \SMWSQLStore3();
-
-               // Somewhat lazy but it is the simplest way to get
-               // back the array of id stored with this batch
-               $runningId = unserialize ( $this->params['id'] );
-
-               foreach ( $runningId as $id ) {
-
-                       $res = $dbw->select(
-                               'smw_ids',
-                               array(
-                                       'smw_title',
-                                       'smw_namespace',
-                                       'smw_iw',
-                                       'smw_subobject'
-                               ),
-                               array( 'smw_id' => $id )
-                       );
-
-                       foreach ( $res as $row ) {
-                               // Only for titles that are "real"
-                               if ( $row->smw_title !== '' && 
$row->smw_title{0} !== '_' ) {
-                                       $subject = new \SMWDIWikiPage( 
$row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject );
-                                       
$newStore->getWriter()->doFlatDataUpdate( $oldStore->getSemanticData( $subject 
), $dbw );
-                               }
-                       }
-               }
-
-               // Sleep interval before to continue
-               if ( $this->params['i'] ) {
-                       sleep( $this->params['i'] );
-               }
-               wfWaitForSlaves();
-       }
-}
\ No newline at end of file
diff --git a/maintenance/SMW_migration.php b/maintenance/SMW_migration.php
deleted file mode 100644
index fffd214..0000000
--- a/maintenance/SMW_migration.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * This Command line Script will setup Store3 and migrate Semantics from 
Store2 to Store3(version 1.8)
- * As of now it is only recommended for users migrating from Store2 (version 
1.7)
- * If you are making a fresh installation please follow the installation
- * guidelines at http://www.semantic-mediawiki.org/wiki/Installation (you 
don't need this)
- *
- * @file
- * @ingroup SMWMaintenance
- * @author Nischay Nahata
- * @author mwjames
- */
-
-/**
- * @defgroup SMWMaintenance SMWMaintenance
- * This group contains all parts of SMW that are maintenance scripts.
- * @ingroup SMW
- */
-
-require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
-       ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php'
-       : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
-
-class SMWMigrate extends Maintenance {
-       public function __construct() {
-               parent::__construct();
-               $this->mDescription = 'Sets up the SMW storage backend for 
Store3 (Version 1.8) This does not depend on your default backend.';
-               $this->addOption( 'setup', 'Setup all tables needed for 
Store3.' );
-               $this->addOption( 'migrate', 'Migrate Semantics of pages to 
Store3. This will still leave Store2 data intact so don\'t worry' );
-               $this->addOption( 'b', 'Batch size', false, true );
-               $this->addOption( 'i', 'Sleep interval between batch inserts', 
false, true );
-       }
-
-       public function execute() {
-               if ( $this->hasOption( 'setup' ) ) {
-                       $store = new SMWSQLStore3;
-                       $store->setup();
-               } elseif ( $this->hasOption( 'migrate' ) ) {
-                       $batchsize = $this->getOption( 'b', 500 );
-                       $interval  = $this->getOption( 'i', 0 );
-
-                       // We do all the hard work in batch
-                       Job::factory(
-                               'SMWMigrationJob',
-                               Title::newFromText( 'MigrationPackingJob' ),
-                               array( 'pos' => 0, 'b' => $batchsize, 'i' => 
$interval )
-                       )->insert();
-               }
-       }
-}
-
-$maintClass = 'SMWMigrate';
-require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/75277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic507f33b86d858dca4e30b7463431e05e9f9e7c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Kghbln <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to