Jean-Frédéric has uploaded a new change for review.

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

Change subject: Migrate to use Intuition as a library
......................................................................

Migrate to use Intuition as a library

Instead of relying on a local installation.

This is the more modern way of using Intuition,
and paves the way to have messages used locally.

This also makes it easier to have a local
development environment.

- Add Intuition as a dependency in composer.json
- Change loader in common.php to load from the vendor
  directory rather than relative to the $tsI18nDir variable
  (which points to an hardocoded path on ToolLabs NFS)
- Remove tsI18nDir variable from Defaults.php

Bug: T134565
Change-Id: I6feac5712065d61e967eefdacb4206fe663ff9ef
---
M api/common.php
M api/includes/Defaults.php
M composer.json
3 files changed, 15 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage 
refs/changes/76/291776/1

diff --git a/api/common.php b/api/common.php
index e669644..f8c3ea3 100644
--- a/api/common.php
+++ b/api/common.php
@@ -20,19 +20,19 @@
        require dirname( dirname( __FILE__ ) ) . "/{$config_override}";
 }
 
-/* Localization */
-if ( $tsI18nDir ) {
-       require_once( "$tsI18nDir/ToolStart.php" );
-       $opts = array(
-               'domain' => 'MonumentsAPI', // name of your main text-domain 
here
-               'globalfunctions' => true, // defines _(), _e() and _g() as 
shortcut for $I18N->msg( .. )
-               'suppresserrors' => false, // Krinkle heeft het stukgemaakt
-               );
-       $I18N = new TsIntuition( $opts );
-} else {
-       $I18N = null;
-}
+/* Localization
+ * We are loading Intuition as a library via Composer
+ */
+require_once __DIR__ . '/../vendor/autoload.php';
 
+$opts = array(
+       'domain' => 'MonumentsAPI', // name of your main text-domain here
+       'globalfunctions' => true, // defines _(), _e() and _g() as shortcut 
for $I18N->msg( .. )
+       'suppresserrors' => false, // Krinkle heeft het stukgemaakt
+       );
+$I18N = new Intuition( $opts );
+
+/* Database */
 $dbStatus = Database::define($dbServer, $dbDatabase, $dbUser,
        isset( $toolserver_password )? $toolserver_password : $dbPassword );
 if (!$dbStatus) {
diff --git a/api/includes/Defaults.php b/api/includes/Defaults.php
index a266e72..fa826ab 100644
--- a/api/includes/Defaults.php
+++ b/api/includes/Defaults.php
@@ -5,7 +5,6 @@
 $dbDatabase = 's51138__heritage_p';
 $dbPassword = '<set password in database.inc';
 $dbMiserMode = false;
-$tsI18nDir = '/data/project/intuition/src/Intuition';
 $cacheDir = '/data/project/heritage/temp';
 $cldrPath = false;
 $subdivisionsPath = false;
diff --git a/composer.json b/composer.json
index 533ddd2..e2e31bb 100644
--- a/composer.json
+++ b/composer.json
@@ -8,5 +8,8 @@
             "parallel-lint . --exclude vendor",
             "phpunit api/tests"
         ]
+    },
+    "require": {
+        "Krinkle/intuition": "^0.2.3"
     }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6feac5712065d61e967eefdacb4206fe663ff9ef
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <[email protected]>

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

Reply via email to