Adrian Lang has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172704

Change subject: Move wikibase.dataTypes from lib to repo
......................................................................

Move wikibase.dataTypes from lib to repo

It's only used in repo.

Change-Id: If4e31db707ce582af10ed42a714fe95e55f1ea34
---
M lib/resources/Resources.php
M lib/tests/qunit/resources.php
M repo/resources/Resources.php
R repo/resources/dataTypes/wikibase.dataTypes.js
R repo/tests/qunit/dataTypes/wikibase.dataTypes.tests.js
M repo/tests/qunit/resources.php
6 files changed, 33 insertions(+), 41 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/04/172704/1

diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index d3fb44f..fcd1cbd 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -1,8 +1,5 @@
 <?php
 
-use Wikibase\Client\WikibaseClient;
-use Wikibase\Repo\WikibaseRepo;
-
 /**
  * @licence GNU GPL v2+
  * @author Daniel Werner
@@ -23,22 +20,6 @@
        );
 
        $modules = array(
-
-               'mw.config.values.wbDataTypes' => $moduleTemplate + array(
-                       'class' => 'DataTypes\DataTypesModule',
-                       'datatypefactory' => function() {
-                               // TODO: relative uglynes here! Get rid of this 
method!
-                               if ( defined( 'WB_VERSION' ) ) { // repo mode
-                                       $wikibase = 
WikibaseRepo::getDefaultInstance();
-                               } elseif ( defined( 'WBC_VERSION' ) ) { // 
client mode
-                                       $wikibase = 
WikibaseClient::getDefaultInstance();
-                               } else {
-                                       throw new \RuntimeException( "Neither 
repo nor client found!" );
-                               }
-                               return $wikibase->getDataTypeFactory();
-                       },
-                       'datatypesconfigvarname' => 'wbDataTypes',
-               ),
 
                'mw.config.values.wbSiteDetails' => $moduleTemplate + array(
                        'class' => 'Wikibase\SitesModule',
@@ -148,18 +129,6 @@
                                'jquery.effects.blind',
                                'jquery.inputautoexpand',
                                'jquery.ui.widget',
-                       ),
-               ),
-
-               'wikibase.dataTypes' => $moduleTemplate + array(
-                       'scripts' => array(
-                               'wikibase.dataTypes/wikibase.dataTypes.js',
-                       ),
-                       'dependencies' => array(
-                               'dataTypes.DataType',
-                               'dataTypes.DataTypeStore',
-                               'mw.config.values.wbDataTypes',
-                               'wikibase',
                        ),
                ),
 
diff --git a/lib/tests/qunit/resources.php b/lib/tests/qunit/resources.php
index 1fda429..bc50853 100644
--- a/lib/tests/qunit/resources.php
+++ b/lib/tests/qunit/resources.php
@@ -62,16 +62,6 @@
                        ),
                ),
 
-               'wikibase.dataTypes.tests' => $moduleBase + array(
-                       'scripts' => array(
-                               
'wikibase.dataTypes/wikibase.dataTypes.tests.js',
-                       ),
-                       'dependencies' => array(
-                               'dataTypes.DataTypeStore',
-                               'wikibase.dataTypes',
-                       ),
-               ),
-
                'wikibase.api.RepoApi.tests' => $moduleBase + array(
                        'scripts' => array(
                                'wikibase.RepoApi/wikibase.RepoApi.tests.js',
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index 95fd25c..d8e8002 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -1,4 +1,7 @@
 <?php
+
+use Wikibase\Repo\WikibaseRepo;
+
 /**
  * Wikibase Repo ResourceLoader modules
  *
@@ -50,6 +53,26 @@
                        ),
                ),
 
+               'mw.config.values.wbDataTypes' => $moduleTemplate + array(
+                       'class' => 'DataTypes\DataTypesModule',
+                       'datatypefactory' => function() {
+                               return 
WikibaseRepo::getDefaultInstance()->getDataTypeFactory();
+                       },
+                       'datatypesconfigvarname' => 'wbDataTypes',
+               ),
+
+               'wikibase.dataTypes' => $moduleTemplate + array(
+                       'scripts' => array(
+                               'dataTypes/wikibase.dataTypes.js',
+                       ),
+                       'dependencies' => array(
+                               'dataTypes.DataType',
+                               'dataTypes.DataTypeStore',
+                               'mw.config.values.wbDataTypes',
+                               'wikibase',
+                       ),
+               ),
+
                'wikibase.templates' => $moduleTemplate + array(
                        'class' => 'Wikibase\TemplateModule',
                        'scripts' => 'templates.js',
diff --git a/lib/resources/wikibase.dataTypes/wikibase.dataTypes.js 
b/repo/resources/dataTypes/wikibase.dataTypes.js
similarity index 100%
rename from lib/resources/wikibase.dataTypes/wikibase.dataTypes.js
rename to repo/resources/dataTypes/wikibase.dataTypes.js
diff --git a/lib/tests/qunit/wikibase.dataTypes/wikibase.dataTypes.tests.js 
b/repo/tests/qunit/dataTypes/wikibase.dataTypes.tests.js
similarity index 100%
rename from lib/tests/qunit/wikibase.dataTypes/wikibase.dataTypes.tests.js
rename to repo/tests/qunit/dataTypes/wikibase.dataTypes.tests.js
diff --git a/repo/tests/qunit/resources.php b/repo/tests/qunit/resources.php
index b2730c7..d550276 100644
--- a/repo/tests/qunit/resources.php
+++ b/repo/tests/qunit/resources.php
@@ -36,6 +36,16 @@
                        ),
                ),
 
+               'wikibase.dataTypes.tests' => $moduleBase + array(
+                       'scripts' => array(
+                               'dataTypes/wikibase.dataTypes.tests.js',
+                       ),
+                       'dependencies' => array(
+                               'dataTypes.DataTypeStore',
+                               'wikibase.dataTypes',
+                       ),
+               ),
+
        );
 
        return $modules;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4e31db707ce582af10ed42a714fe95e55f1ea34
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang <[email protected]>

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

Reply via email to