Yaron Koren has submitted this change and it was merged.
Change subject: Fix for defining constants when using extension.json
......................................................................
Fix for defining constants when using extension.json
Change-Id: Ib779b283e8cbfe89bbef827a1fb07436005a9d31
---
M Cargo.hooks.php
M Cargo.php
2 files changed, 22 insertions(+), 16 deletions(-)
Approvals:
Yaron Koren: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/Cargo.hooks.php b/Cargo.hooks.php
index 87766b7..0533787 100644
--- a/Cargo.hooks.php
+++ b/Cargo.hooks.php
@@ -11,6 +11,8 @@
public static function registerExtension() {
global $cgScriptPath, $wgScriptPath, $wgCargoFieldTypes,
$wgCargoAllowedSQLFunctions, $wgGroupPermissions;
+ define( 'CARGO_VERSION', '1.0-alpha' );
+
// Script path.
$cgScriptPath = $wgScriptPath . '/extensions/Cargo';
@@ -31,8 +33,14 @@
$wgGroupPermissions['sysop']['recreatecargodata'] = true;
$wgGroupPermissions['sysop']['deletecargodata'] = true;
- }
+ define( 'CARGO_STORE_CREATION_DATE', 1 );
+ define( 'CARGO_STORE_MODIFICATION_DATE', 2 );
+ define( 'CARGO_STORE_CREATOR', 3 );
+ define( 'CARGO_STORE_FULL_TEXT', 4 );
+ define( 'CARGO_STORE_CATEGORIES', 5 );
+ define( 'CARGO_STORE_NUM_REVISIONS', 6 );
+ }
public static function registerParserFunctions( &$parser ) {
$parser->setFunctionHook( 'cargo_declare', array(
'CargoDeclare', 'run' ) );
@@ -65,8 +73,9 @@
// the language of the user.
$vars['wgCargoMonthNames'] =
$out->getLanguage()->getMonthNamesArray();
/**
- * @todo all these arrays should perhaps be switched to start
keys from 1, in order to
- * match built-in arrys, such as wgMonthNames.
+ * @TODO - all these arrays should perhaps be switched to start
+ * keys from 1, in order to match built-in arrys, such as
+ * $wgMonthNames.
*/
array_shift( $vars['wgCargoMonthNames'] ); //start keys from 0
diff --git a/Cargo.php b/Cargo.php
index 90aa8a0..699a8f1 100644
--- a/Cargo.php
+++ b/Cargo.php
@@ -6,18 +6,6 @@
* @author Yaron Koren
*/
-// We need to set this at the top, so that it is also defined if
-// wfLoadExtension() is called, because its presence is used by other
-// extensions to determine whether Cargo is installed.
-define( 'CARGO_VERSION', '1.0-alpha' );
-
-define( 'CARGO_STORE_CREATION_DATE', 1 );
-define( 'CARGO_STORE_MODIFICATION_DATE', 2 );
-define( 'CARGO_STORE_CREATOR', 3 );
-define( 'CARGO_STORE_FULL_TEXT', 4 );
-define( 'CARGO_STORE_CATEGORIES', 5 );
-define( 'CARGO_STORE_NUM_REVISIONS', 6 );
-
// There are bugs in MW 1.25 and 1.26 that make extension.json
// unusable for Cargo - for simplicity's sake, don't load extensions
// unless we're at version 1.27 or higher.
@@ -35,7 +23,16 @@
return;
}
-// All the rest is for backward compatibility, for MW 1.25 and lower.
+// All the rest is for backward compatibility, for MW 1.26 and lower.
+
+define( 'CARGO_VERSION', '1.0-alpha' );
+
+define( 'CARGO_STORE_CREATION_DATE', 1 );
+define( 'CARGO_STORE_MODIFICATION_DATE', 2 );
+define( 'CARGO_STORE_CREATOR', 3 );
+define( 'CARGO_STORE_FULL_TEXT', 4 );
+define( 'CARGO_STORE_CATEGORIES', 5 );
+define( 'CARGO_STORE_NUM_REVISIONS', 6 );
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
--
To view, visit https://gerrit.wikimedia.org/r/279378
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib779b283e8cbfe89bbef827a1fb07436005a9d31
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits