Kipcool has submitted this change and it was merged.
Change subject: moved most SpecialPage from app to setup
......................................................................
moved most SpecialPage from app to setup
also changed two wg to wld
and built some special page credits
p2 corrections accdg to Kip's recommendation
also moved jobs from app to OWJobs.php,
removed some unnecessary globals and
removed some unnecessary require_once specially Wikidata.php
& WikiDataGlobal.php since it is already "required" since App.php.
Change-Id: I9e26aea619db73096f50066ac49c08f2c9abeea3
---
M App.php
M OmegaWiki/WikiDataGlobals.php
M OmegaWiki/Wikidata.php
A includes/setup/OWJobs.php
M includes/setup/OWSpecials.php
M includes/specials/SpecialDatasearch.php
M includes/specials/SpecialOWStatistics.php
7 files changed, 144 insertions(+), 67 deletions(-)
Approvals:
Kipcool: Verified; Looks good to me, approved
diff --git a/App.php b/App.php
index 3708fe4..14a3aea 100644
--- a/App.php
+++ b/App.php
@@ -73,15 +73,7 @@
$wgAutoloadClasses['NeedsTranslationTo'] = $dir .
'OmegaWiki/NeedsTranslationTo.php';
$wgAutoloadClasses['Search'] = $dir . 'OmegaWiki/Search.php';
-$wgAutoloadClasses['SpecialSuggest'] = $dir . 'OmegaWiki/SpecialSuggest.php';
-$wgAutoloadClasses['SpecialSelect'] = $dir . 'OmegaWiki/SpecialSelect.php';
-// $wgAutoloadClasses['SpecialTransaction'] = $dir .
'OmegaWiki/SpecialTransaction.php';
-$wgAutoloadClasses['SpecialNeedsTranslation'] = $dir .
'OmegaWiki/SpecialNeedsTranslation.php';
-$wgAutoloadClasses['SpecialImportLangNames'] = $dir .
'OmegaWiki/SpecialImportLangNames.php';
-$wgAutoloadClasses['SpecialAddCollection'] = $dir .
'OmegaWiki/SpecialAddCollection.php';
-$wgAutoloadClasses['SpecialConceptMapping'] = $dir .
'OmegaWiki/SpecialConceptMapping.php';
-$wgAutoloadClasses['SpecialCopy'] = $dir . 'OmegaWiki/SpecialCopy.php';
-
+// Special Pages
require_once( $wgWldSetupScriptPath . "OWSpecials.php" );
# FIXME: These should be modified to make Wikidata more reusable.
@@ -103,7 +95,7 @@
$wgGroupPermissions['bureaucrat']['addcollection'] = true;
$wgGroupPermissions['bureaucrat']['editClassAttributes'] = true;
-// Wikidata Configuration.
+// WikiLexicalData Configuration.
# Array of namespace ids and the handler classes they use.
$wdHandlerClasses = array();
@@ -138,23 +130,10 @@
$wdCopyAltDefinitions = false;
$wdCopyDryRunOnly = false;
-# FIXME: Should be renamed to prefix with wd rather than wg.
-$wgShowClassicPageTitles = false;
-$wgExpressionPageTitlePrefix = 'Multiple meanings';
-
# The site prefix allows us to have multiple sets of customized
# messages (for different, typically site-specific UIs)
# in a single database.
if ( !isset( $wdSiteContext ) ) $wdSiteContext = "uw";
-
-$wgSpecialPages['Suggest'] = 'SpecialSuggest';
-$wgSpecialPages['Select'] = 'SpecialSelect';
-// $wgSpecialPages['Transaction'] = 'SpecialTransaction';
-$wgSpecialPages['NeedsTranslation'] = 'SpecialNeedsTranslation';
-$wgSpecialPages['ImportLangNames'] = 'SpecialImportLangNames';
-$wgSpecialPages['AddCollection'] = 'SpecialAddCollection';
-$wgSpecialPages['ConceptMapping'] = 'SpecialConceptMapping';
-$wgSpecialPages['Copy'] = 'SpecialCopy';
#
## Hooks
@@ -171,11 +150,8 @@
$wgHooks['PageContentLanguage'][] =
'WikiLexicalDataHooks::onPageContentLanguage';
$wgHooks['SkinTemplateNavigation'][] =
'WikiLexicalDataHooks::onSkinTemplateNavigation';
-// Job Classes
-$wgAutoloadClasses['CreateExpressionListJob'] = $wgWldJobsScriptPath .
'OWExpressionListJob.php';
-$wgJobClasses['CreateExpressionList'] = 'CreateExpressionListJob';
-$wgAutoloadClasses['CreateDefinedExpressionListJob'] = $wgWldJobsScriptPath .
'OWDefinedExpressionListJob.php';
-$wgJobClasses['CreateDefinedExpressionList'] =
'CreateDefinedExpressionListJob';
+// Jobs
+require_once( $wgWldSetupScriptPath . "OWJobs.php" );
// LocalApp.php is optional. Its function is like LocalSettings.php,
// if you want to separate the MediaWiki configuration from the Wikidata
configuration
diff --git a/OmegaWiki/WikiDataGlobals.php b/OmegaWiki/WikiDataGlobals.php
index 6eb1f10..bdb3139 100644
--- a/OmegaWiki/WikiDataGlobals.php
+++ b/OmegaWiki/WikiDataGlobals.php
@@ -78,7 +78,16 @@
);
// Page titles
-$wgUseExpressionPageTitlePrefix = true; # malafaya: Use the expression
prefix "Multiple meanings:" from message ow_Multiple_meanings
+$wgWldUseExpressionPageTitlePrefix = true; # malafaya: Use the expression
prefix "Multiple meanings:" from message ow_Multiple_meanings
+$wgWldShowClassicPageTitles = false;
+$wgWldExpressionPageTitlePrefix = 'Multiple meanings';
+// NOTE: both wgWldUseExpressionPageTitlePrefix and wgWldExpressionPageTitles
+// seems to be unused based on ...
+// git grep -e wgWldUseExpressionPageTitlePrefix
+// and
+// git grep -e wgWldExpressionPageTitlePrefix
+//
+// If not going to be used. Should ow_Multiple_meanings @
Wikidata.i18n.php be removed also? ~he
// Search page
$wgWldSearchExternalIDDefault = false;
@@ -100,7 +109,6 @@
*
*/
$wgPropertyToColumnFilters = array();
-
/**
diff --git a/OmegaWiki/Wikidata.php b/OmegaWiki/Wikidata.php
index dc974c9..f6ef360 100644
--- a/OmegaWiki/Wikidata.php
+++ b/OmegaWiki/Wikidata.php
@@ -13,7 +13,7 @@
protected $transaction;
protected $queryTransactionInformation;
protected $showCommunityContribution;
-
+
// The following member variables control some application specific
preferences
protected $showClassicPageTitles = true; // Show classic page
titles instead of prettier page titles
@@ -24,12 +24,12 @@
protected $showDataSetPanel = false;
public function __construct( $title ) {
- global $wgShowClassicPageTitles, $wgPropertyToColumnFilters;
+ global $wgWldShowClassicPageTitles, $wgPropertyToColumnFilters;
$this->title = $title;
- if ( isset( $wgShowClassicPageTitles ) ) {
- $this->showClassicPageTitles = $wgShowClassicPageTitles;
+ if ( isset( $wgWldShowClassicPageTitles ) ) {
+ $this->showClassicPageTitles =
$wgWldShowClassicPageTitles;
}
if ( isset( $wgPropertyToColumnFilters ) ) {
$this->propertyToColumnFilters =
$wgPropertyToColumnFilters;
@@ -41,9 +41,8 @@
}
protected function outputViewHeader() {
- global
- $wgOut;
-
+ global $wgOut;
+
if ( $this->showDataSetPanel ) {
$wgOut->addHTML( $this->getDataSetPanel() );
}
@@ -63,19 +62,19 @@
$wgOut->setPageTitle( $myTitle );
$this->queryTransactionInformation = new
QueryLatestTransactionInformation();
-
+
$viewInformation = new ViewInformation();
$viewInformation->showRecordLifeSpan = false;
$viewInformation->queryTransactionInformation =
$this->queryTransactionInformation;
$viewInformation->setPropertyToColumnFilters(
$this->propertyToColumnFilters );
-
+
$this->viewInformation = $viewInformation;
// Not clear why this is here. Works well without.
// initializeOmegaWikiAttributes( $viewInformation );
// initializeObjectAttributeEditors( $viewInformation );
}
-
+
protected function getDataSetPanel() {
global $wgUser;
$dc = wdGetDataSetContext();
@@ -103,13 +102,13 @@
$viewInformation->queryTransactionInformation =
$referenceQueryTransactionInformation;
$viewInformation->setPropertyToColumnFilters(
$this->propertyToColumnFilters );
$viewInformation->viewOrEdit = "edit";
-
+
$this->viewInformation = $viewInformation;
initializeOmegaWikiAttributes( $this->viewInformation );
initializeObjectAttributeEditors( $this->viewInformation );
}
-
+
public function saveWithinTransaction() {
global $wgUser, $wgRequest;
@@ -131,7 +130,7 @@
/**
* @return true if permission to edit, false if not
- **/
+ */
public function edit() {
global $wgOut, $wgRequest, $wgUser;
@@ -139,7 +138,7 @@
if ( $wgUser->isBlockedFrom( $this->getTitle(), false ) ) {
$wgOut->blockedPage() ;
- return false;
+ return false;
}
$dc = wdGetDataSetContext();
@@ -157,18 +156,18 @@
$viewInformation->queryTransactionInformation = new
QueryLatestTransactionInformation();
$viewInformation->viewOrEdit = "edit";
$viewInformation->setPropertyToColumnFilters(
$this->propertyToColumnFilters );
-
+
$this->viewInformation = $viewInformation;
-
+
initializeOmegaWikiAttributes( $this->viewInformation );
initializeObjectAttributeEditors( $this->viewInformation );
return true;
}
-
+
public function history() {
global $wgOut, $wgRequest;
-
+
$wgOut->enableClientCache( false );
$title = $this->title->getPrefixedText();
@@ -187,13 +186,13 @@
$this->showRecordLifeSpan = true;
$this->transaction = 0;
}
-
+
# Up to which transaction to view the data
if ( $this->transaction == 0 )
$this->queryTransactionInformation = new
QueryHistoryTransactionInformation();
else
$this->queryTransactionInformation = new
QueryAtTransactionInformation( $this->transaction, $this->showRecordLifeSpan );
-
+
$transactionId = $wgRequest->getInt( 'transaction' );
$wgOut->addHTML( getOptionPanel(
@@ -208,16 +207,16 @@
$viewInformation->showRecordLifeSpan =
$this->showRecordLifeSpan;
$viewInformation->queryTransactionInformation =
$this->queryTransactionInformation;
$viewInformation->setPropertyToColumnFilters(
$this->propertyToColumnFilters );
-
+
$this->viewInformation = $viewInformation;
initializeOmegaWikiAttributes( $this->viewInformation );
initializeObjectAttributeEditors( $viewInformation );
}
-
+
protected function outputEditHeader() {
global $wgOut, $wgUser;
-
+
$title = $this->title->getPrefixedText();
if ( !$this->showClassicPageTitles )
@@ -231,13 +230,13 @@
$wgOut->addHTML(
'<form method="post" action="">' .
- '<input type="hidden" name="transaction"
value="' . getLatestTransactionId() . '"/>'
+ '<input type="hidden" name="transaction" value="' .
getLatestTransactionId() . '"/>'
);
}
-
+
protected function outputEditFooter() {
global $wgOut, $wgUser;
-
+
$wgOut->addHTML(
'<div class="option-panel">' .
'<table cellpadding="0" cellspacing="0"><tr>' .
@@ -247,7 +246,7 @@
getSubmitButton( "save", wfMessage( "ow_save"
)->text() ) .
'</div>'
);
-
+
$wgOut->addHTML( '</form>' );
if ( $wgUser->isAnon() ) {
diff --git a/includes/setup/OWJobs.php b/includes/setup/OWJobs.php
new file mode 100644
index 0000000..4f1ff76
--- /dev/null
+++ b/includes/setup/OWJobs.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Job Setup
+ *
+ */
+
+ # Alert the user that this is not a valid access point to MediaWiki if they
try to access the special pages file directly.
+if ( !defined( 'MEDIAWIKI' ) ) {
+ echo
+ 'To install my extension, put the following line in LocalSettings.php:'
.
+ "\n" .
+ 'require_once( "' . $wgWldScriptPath . 'OWJobs.php" );
+ ';
+ exit( 1 );
+}
+
+# Location of the job classes (Tell MediaWiki to load this file)
+$wgAutoloadClasses['CreateExpressionListJob'] = $wgWldJobsScriptPath .
'OWExpressionListJob.php';
+$wgAutoloadClasses['CreateDefinedExpressionListJob'] = $wgWldJobsScriptPath .
'OWDefinedExpressionListJob.php';
+
+# Tell MediaWiki about the jobs and its class name
+$wgJobClasses['CreateExpressionList'] = 'CreateExpressionListJob';
+$wgJobClasses['CreateDefinedExpressionList'] =
'CreateDefinedExpressionListJob';
+
+// Return true so that MediaWiki continues to load extensions.
+return true;
diff --git a/includes/setup/OWSpecials.php b/includes/setup/OWSpecials.php
index aaa33a9..5baa4a6 100644
--- a/includes/setup/OWSpecials.php
+++ b/includes/setup/OWSpecials.php
@@ -4,7 +4,6 @@
*
* TODO: transfer all special page configuration to this script
*/
-global $wgWldScriptPath, $wgWldSpecialsScriptPath;
# Alert the user that this is not a valid access point to MediaWiki if they
try to access the special pages file directly.
if ( !defined( 'MEDIAWIKI' ) ) {
@@ -17,18 +16,53 @@
}
$wgExtensionCredits['specialpage'][] = array(
- 'name' => 'SpecialConceptMapping',
- 'author' => 'Kim Bruning',
+ 'name' => 'SpecialCopy',
+ 'author' => array(
+ 'Erik Möller',
+ 'Kim Bruning',
+ 'Alan Smithee',
+ ),
);
$wgExtensionCredits['specialpage'][] = array(
- 'name' => 'SpecialCopy',
- 'author' => 'Alan Smithee',
+ 'name' => 'SpecialConceptMapping',
+ 'author' => array(
+ 'Erik Möller',
+ 'Kim Bruning',
+ ),
+);
+
+$wgExtensionCredits['specialpage'][] = array(
+ 'name' => 'SpecialSuggest',
+ 'author' => array(
+ 'Peter-Jan Roes',
+ 'Kim Bruning',
+ ),
+);
+
+$wgExtensionCredits['specialpage'][] = array(
+ 'name' => 'SpecialAddCollection',
+ 'author' => array(
+ 'Erik Möller',
+ 'Kim Bruning',
+ ),
);
$wgExtensionCredits['specialpage'][] = array(
'name' => 'SpecialDatasearch',
- 'author' => 'Kipcool',
+ 'author' => array(
+ 'Peter-Jan Roes',
+ 'Karsten Uil',
+ 'Kipcool',
+ ),
+);
+
+$wgExtensionCredits['specialpage'][] = array(
+ 'name' => 'SpecialNeedsTranslation',
+ 'author' => array(
+ 'Peter-Jan Roes',
+ 'Kipcool',
+ ),
);
$wgExtensionCredits['specialpage'][] = array(
@@ -42,19 +76,56 @@
);
# Location of the SpecialMyExtension class (Tell MediaWiki to load this file)
+$wgAutoloadClasses['SpecialCopy'] = $dir . 'OmegaWiki/SpecialCopy.php';
+$wgAutoloadClasses['SpecialSelect'] = $dir . 'OmegaWiki/SpecialSelect.php';
+$wgAutoloadClasses['SpecialSuggest'] = $dir . 'OmegaWiki/SpecialSuggest.php';
+
+$wgAutoloadClasses['SpecialAddCollection'] = $dir .
'OmegaWiki/SpecialAddCollection.php';
+$wgAutoloadClasses['SpecialConceptMapping'] = $dir .
'OmegaWiki/SpecialConceptMapping.php';
$wgAutoloadClasses['SpecialDatasearch'] = $wgWldSpecialsScriptPath .
'SpecialDatasearch.php';
+$wgAutoloadClasses['SpecialImportLangNames'] = $dir .
'OmegaWiki/SpecialImportLangNames.php';
+$wgAutoloadClasses['SpecialNeedsTranslation'] = $dir .
'OmegaWiki/SpecialNeedsTranslation.php';
+
$wgAutoloadClasses['SpecialOWStatistics'] = $wgWldSpecialsScriptPath .
'SpecialOWStatistics.php';
-$wgAutoloadClasses[ 'SpecialOWDownloads' ] = $wgWldSpecialsScriptPath .
'SpecialOWDownloads.php';
+$wgAutoloadClasses['SpecialOWDownloads'] = $wgWldSpecialsScriptPath .
'SpecialOWDownloads.php';
+
+// $wgAutoloadClasses['SpecialTransaction'] = $dir .
'OmegaWiki/SpecialTransaction.php';
# Tell MediaWiki about the new special page and its class name
+$wgSpecialPages['Copy'] = 'SpecialCopy';
+$wgSpecialPages['Select'] = 'SpecialSelect';
+$wgSpecialPages['Suggest'] = 'SpecialSuggest';
+
+$wgSpecialPages['AddCollection'] = 'SpecialAddCollection';
+$wgSpecialPages['ConceptMapping'] = 'SpecialConceptMapping';
$wgSpecialPages['ow_data_search'] = 'SpecialDatasearch';
+$wgSpecialPages['ImportLangNames'] = 'SpecialImportLangNames';
+$wgSpecialPages['NeedsTranslation'] = 'SpecialNeedsTranslation';
+
$wgSpecialPages['ow_statistics'] = 'SpecialOWStatistics';
$wgSpecialPages['ow_downloads'] = 'SpecialOWDownloads';
+// $wgSpecialPages['Transaction'] = 'SpecialTransaction';
+
# Tell MediaWiki about which group the new special page belongs to
+/**
+ * == UnlistedSpecialPage ==
+ * SpecialCopy
+ * SpecialSelect
+ * SpecialSuggest
+ */
+
+$wgSpecialPageGroups[ 'AddCollection' ] = 'other';
+$wgSpecialPageGroups[ 'ConceptMapping' ] = 'other';
$wgSpecialPageGroups[ 'ow_data_search' ] = 'wiki';
+$wgSpecialPageGroups[ 'ImportLangNames' ] = 'other';
+$wgSpecialPageGroups[ 'NeedsTranslation' ] = 'maintenance';
+
$wgSpecialPageGroups[ 'ow_statistics' ] = 'wiki';
$wgSpecialPageGroups[ 'ow_downloads' ] = 'wiki';
# Location of an aliases file (Tell MediaWiki to load this file)
//$wgExtensionMessagesFiles[ 'OWSpecialsAlias' ] = #dir .
'../i18n/OWSpecials.alias.php';
+
+// Return true so that MediaWiki continues to load extensions.
+return true;
diff --git a/includes/specials/SpecialDatasearch.php
b/includes/specials/SpecialDatasearch.php
index 2bc5d00..1e995e2 100644
--- a/includes/specials/SpecialDatasearch.php
+++ b/includes/specials/SpecialDatasearch.php
@@ -3,8 +3,6 @@
if ( !defined( 'MEDIAWIKI' ) ) die();
global $wgWldOwScriptPath;
-require_once( $wgWldOwScriptPath . "Wikidata.php" );
-require_once( $wgWldOwScriptPath . "WikiDataGlobals.php" );
require_once( $wgWldOwScriptPath . "WikiDataAPI.php" );
require_once( $wgWldOwScriptPath . "forms.php" );
require_once( $wgWldOwScriptPath . "type.php" );
diff --git a/includes/specials/SpecialOWStatistics.php
b/includes/specials/SpecialOWStatistics.php
index 8b0c1d8..bc5e6d5 100644
--- a/includes/specials/SpecialOWStatistics.php
+++ b/includes/specials/SpecialOWStatistics.php
@@ -2,7 +2,6 @@
if ( !defined( 'MEDIAWIKI' ) ) die();
global $wgWldOwScriptPath;
-require_once( $wgWldOwScriptPath . 'Wikidata.php' );
require_once( $wgWldOwScriptPath . 'languages.php' );
class SpecialOWStatistics extends SpecialPage {
--
To view, visit https://gerrit.wikimedia.org/r/71576
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9e26aea619db73096f50066ac49c08f2c9abeea3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikiLexicalData
Gerrit-Branch: master
Gerrit-Owner: Hiong3-eng5 <[email protected]>
Gerrit-Reviewer: Hiong3-eng5 <[email protected]>
Gerrit-Reviewer: Kipcool <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits