Jayprakash12345 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405597 )
Change subject: Convert BibManager to use extension registation ...................................................................... Convert BibManager to use extension registation Bug: T185424 Change-Id: I7cba88922da1b472ca4874eb356c9ff8a7fb1028 --- M BibManager.php A extension.json 2 files changed, 124 insertions(+), 111 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BibManager refs/changes/97/405597/1 diff --git a/BibManager.php b/BibManager.php index 1dcc529..247b945 100644 --- a/BibManager.php +++ b/BibManager.php @@ -18,115 +18,16 @@ http://www.gnu.org/copyleft/gpl.html */ -if ( !defined( 'MEDIAWIKI' ) ) { - echo 'To install BibManager, put the following line in LocalSettings.php: ' - .'include_once( "$IP/extensions/BibManager/BibManager.php" );' . "\n"; - exit( 1 ); +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'BibManager' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['BibManager'] = __DIR__ . '/i18n'; + wfWarn( + 'Deprecated PHP entry point used for the BibManager extension. ' . + 'Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); + return; +} else { + die( 'This version of the BibManager extension requires MediaWiki 1.29+' ); } - -$wgExtensionCredits['specialpage'][] = array ( - 'path' => __FILE__, - 'name' => 'BibManager', - 'author' => array ( - 'Hornemann Institut', 'Hallo Welt! Medienwerkstatt GmbH', - 'Tobias Weichart', 'Robert Vogel' - ), - 'url' => 'http://www.mediawiki.org/wiki/Extension:BibManager', - 'version' => '1.23.0', - 'descriptionmsg' => 'bibmanager-desc', -); - -//Register classes -$wgAutoloadClasses['Structures_BibTex'] = __DIR__ . '/includes/libs/Structures_BibTex/BibTex.php'; //External library for parsing - -$wgAutoloadClasses['BibManagerHooks'] = __DIR__ . '/includes/BibManagerHooks.php'; -$wgAutoloadClasses['BibManagerFieldsList'] = __DIR__ . '/includes/BibManagerFieldsList.php'; -$wgAutoloadClasses['BibManagerLocalMWDatabaseRepo'] = __DIR__ . '/includes/BibManagerLocalMWDatabaseRepo.php'; -$wgAutoloadClasses['BibManagerPagerList'] = __DIR__ . '/includes/BibManagerPagerList.php'; -$wgAutoloadClasses['BibManagerPagerListAuthors'] = __DIR__ . '/includes/BibManagerPagerListAuthors.php'; -$wgAutoloadClasses['BibManagerRepository'] = __DIR__ . '/includes/BibManagerRepository.php'; -$wgAutoloadClasses['BibManagerValidator'] = __DIR__ . '/includes/BibManagerValidator.php'; -$wgAutoloadClasses['BibManagerLocalMWDatabaseRepo'] = __DIR__ . '/includes/BibManagerLocalMWDatabaseRepo.php'; -$wgAutoloadClasses['BibManagerRepository'] = __DIR__ . '/includes/BibManagerRepository.php'; - -//SpecialPages -$wgAutoloadClasses['SpecialBibManagerList'] = __DIR__ . '/includes/specials/SpecialBibManagerList.php'; -$wgAutoloadClasses['SpecialBibManagerListAuthors'] = __DIR__ . '/includes/specials/SpecialBibManagerListAuthors.php'; -$wgAutoloadClasses['SpecialBibManagerImport'] = __DIR__ . '/includes/specials/SpecialBibManagerImport.php'; -$wgAutoloadClasses['SpecialBibManagerExport'] = __DIR__ . '/includes/specials/SpecialBibManagerExport.php'; -$wgAutoloadClasses['SpecialBibManagerCreate'] = __DIR__ . '/includes/specials/SpecialBibManagerCreate.php'; -$wgAutoloadClasses['SpecialBibManagerDelete'] = __DIR__ . '/includes/specials/SpecialBibManagerDelete.php'; -$wgAutoloadClasses['SpecialBibManagerEdit'] = __DIR__ . '/includes/specials/SpecialBibManagerEdit.php'; - -//Add I18N -$wgMessagesDirs['BibManager'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['BibManagerAlias'] = __DIR__ . '/BibManager.alias.php'; - -//Add SpecialPages -$wgSpecialPages['BibManagerList'] = 'SpecialBibManagerList'; -$wgSpecialPages['BibManagerListAuthors'] = 'SpecialBibManagerListAuthors'; -$wgSpecialPages['BibManagerImport'] = 'SpecialBibManagerImport'; -$wgSpecialPages['BibManagerExport'] = 'SpecialBibManagerExport'; -$wgSpecialPages['BibManagerDelete'] = 'SpecialBibManagerDelete'; -$wgSpecialPages['BibManagerCreate'] = 'SpecialBibManagerCreate'; -$wgSpecialPages['BibManagerEdit'] = 'SpecialBibManagerEdit'; - -//Add Hookhandler -$wgHooks['ParserFirstCallInit'][] = 'BibManagerHooks::onParserFirstCallInit'; -$wgHooks['BeforePageDisplay'][] = 'BibManagerHooks::onBeforePageDisplay'; -//$wgHooks['SkinAfterContent'][] = 'BibManagerHooks::onSkinAfterContent'; -$wgHooks['LoadExtensionSchemaUpdates'][] = 'BibManagerHooks::onLoadExtensionSchemaUpdates'; - -$resourceModuleTemplate = array( - 'localBasePath' => __DIR__.'/resources', - 'remoteExtPath' => 'BibManager/resources' -); - -$wgResourceModules['ext.bibManager.styles'] = array( - 'styles' => 'ext.bibManager.css', -) + $resourceModuleTemplate; - -$wgResourceModules['ext.bibManager.List'] = array( - 'scripts' => 'ext.bibManager.List.js', - 'dependencies' => 'ext.bibManager.styles' -) + $resourceModuleTemplate; - -$wgResourceModules['ext.bibManager.Edit'] = array( - 'scripts' => 'ext.bibManager.Edit.js', - 'dependencies' => 'ext.bibManager.styles' -) + $resourceModuleTemplate; - -unset( $resourceModuleTemplate ); - -//Config Variables -$wgBibManagerRepoClass = 'BibManagerLocalMWDatabaseRepo'; -$wgBibManagerCitationFormats = array ( - '-' => '%author%: %title%, %year%', - 'article' => '%author% (%year%): %title%. <em>%journal%</em>, %volume%, %pages%', - 'book' => '%author% (%year%): %title%. (%edition%). <em>%publisher%</em>, %address%, %pages%', - 'booklet' => '%title%', - 'conference' => '%author% (%year%): %title%. %booktitle%', - 'inbook' => '%author% (%year%): %title%. (%edition%). <em>%publisher%</em>, %address%, %pages%, %editor%, %chapter%', - 'incollection' => '%author% (%year%): %title%. %booktitle%', - 'inproceedings' => '%author% (%year%): %title%. <em>%publisher%</em>, %booktitle%', - 'manual' => '%title%', - 'mastersthesis' => '%author% (%year%): %title%. %school%', - 'misc' => '%author%: %title%, %year%', - 'phdthesis' => '%author% (%year%): %title%. %school%', - 'proceedings' => '%title% (%year%)', - 'techreport' => '%author% (%year%): %title%. %institution%.', - 'unpublished' => '%author%: %title%. %note%.' -); - -//$wgBibManagerSkinAfterContentBibListConfig = array( 'hr' => true, 'hideonemptylist' => true ); //For future use. -$wgBibManagerCitationArticleNamespace = NS_MAIN; -$wgBibManagerScholarLink = 'http://scholar.google.com/scholar?q=%title%'; - -// Basic permissions -$wgGroupPermissions['sysop']['bibmanageredit'] = true; -$wgGroupPermissions['sysop']['bibmanagerdelete'] = true; -$wgGroupPermissions['sysop']['bibmanagercreate'] = true; - -$wgAvailableRights[] = 'bibmanageredit'; -$wgAvailableRights[] = 'bibmanagerdelete'; -$wgAvailableRights[] = 'bibmanagercreate'; diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..79aaa88 --- /dev/null +++ b/extension.json @@ -0,0 +1,112 @@ +{ + "name": "BibManager", + "version": "1.23.0", + "author": [ + "Hornemann Institut", + "Hallo Welt! Medienwerkstatt GmbH", + "Tobias Weichart", + "Robert Vogel" + ], + "url": "http://www.mediawiki.org/wiki/Extension:BibManager", + "descriptionmsg": "bibmanager-desc", + "type": "specialpage", + "AvailableRights": [ + "bibmanageredit", + "bibmanagerdelete", + "bibmanagercreate" + ], + "GroupPermissions": { + "sysop": { + "bibmanageredit": true, + "bibmanagerdelete": true, + "bibmanagercreate": true + } + }, + "SpecialPages": { + "BibManagerList": "SpecialBibManagerList", + "BibManagerListAuthors": "SpecialBibManagerListAuthors", + "BibManagerImport": "SpecialBibManagerImport", + "BibManagerExport": "SpecialBibManagerExport", + "BibManagerDelete": "SpecialBibManagerDelete", + "BibManagerCreate": "SpecialBibManagerCreate", + "BibManagerEdit": "SpecialBibManagerEdit" + }, + "MessagesDirs": { + "BibManager": [ + "i18n" + ] + }, + "ExtensionMessagesFiles": { + "BibManagerAlias": "BibManager.alias.php" + }, + "AutoloadClasses": { + "Structures_BibTex": "includes/libs/Structures_BibTex/BibTex.php", + "BibManagerHooks": "includes/BibManagerHooks.php", + "BibManagerFieldsList": "includes/BibManagerFieldsList.php", + "BibManagerLocalMWDatabaseRepo": "includes/BibManagerLocalMWDatabaseRepo.php", + "BibManagerPagerList": "includes/BibManagerPagerList.php", + "BibManagerPagerListAuthors": "includes/BibManagerPagerListAuthors.php", + "BibManagerRepository": "includes/BibManagerRepository.php", + "BibManagerValidator": "includes/BibManagerValidator.php", + "SpecialBibManagerList": "includes/specials/SpecialBibManagerList.php", + "SpecialBibManagerListAuthors": "includes/specials/SpecialBibManagerListAuthors.php", + "SpecialBibManagerImport": "includes/specials/SpecialBibManagerImport.php", + "SpecialBibManagerExport": "includes/specials/SpecialBibManagerExport.php", + "SpecialBibManagerCreate": "includes/specials/SpecialBibManagerCreate.php", + "SpecialBibManagerDelete": "includes/specials/SpecialBibManagerDelete.php", + "SpecialBibManagerEdit": "includes/specials/SpecialBibManagerEdit.php" + }, + "ResourceModules": { + "ext.bibManager.styles": { + "styles": "ext.bibManager.css" + }, + "ext.bibManager.List": { + "scripts": "ext.bibManager.List.js", + "dependencies": "ext.bibManager.styles" + }, + "ext.bibManager.Edit": { + "scripts": "ext.bibManager.Edit.js", + "dependencies": "ext.bibManager.styles" + } + }, + "ResourceFileModulePaths": { + "localBasePath": "resources", + "remoteExtPath": "BibManager/resources" + }, + "Hooks": { + "ParserFirstCallInit": "BibManagerHooks::onParserFirstCallInit", + "BeforePageDisplay": "BibManagerHooks::onBeforePageDisplay", + "LoadExtensionSchemaUpdates": "BibManagerHooks::onLoadExtensionSchemaUpdates" + }, + "config": { + "BibManagerRepoClass": { + "value": "BibManagerLocalMWDatabaseRepo" + }, + "BibManagerCitationFormats": { + "value": { + "-": "%author%: %title%, %year%", + "article": "%author% (%year%): %title%. <em>%journal%</em>, %volume%, %pages%", + "book": "%author% (%year%): %title%. (%edition%). <em>%publisher%</em>, %address%, %pages%", + "booklet": "%title%", + "conference": "%author% (%year%): %title%. %booktitle%", + "inbook": "%author% (%year%): %title%. (%edition%). <em>%publisher%</em>, %address%, %pages%, %editor%, %chapter%", + "incollection": "%author% (%year%): %title%. %booktitle%", + "inproceedings": "%author% (%year%): %title%. <em>%publisher%</em>, %booktitle%", + "manual": "%title%", + "mastersthesis": "%author% (%year%): %title%. %school%", + "misc": "%author%: %title%, %year%", + "phdthesis": "%author% (%year%): %title%. %school%", + "proceedings": "%title% (%year%)", + "techreport": "%author% (%year%): %title%. %institution%.", + "unpublished": "%author%: %title%. %note%." + } + }, + "BibManagerCitationArticleNamespace": { + "value": 0 + }, + "BibManagerScholarLink": { + "value": "http://scholar.google.com/scholar?q=%title%" + } + }, + "manifest_version": 2 +} -- To view, visit https://gerrit.wikimedia.org/r/405597 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7cba88922da1b472ca4874eb356c9ff8a7fb1028 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BibManager Gerrit-Branch: master Gerrit-Owner: Jayprakash12345 <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
