Changes

Jump to navigation Jump to search
15,597 bytes added ,  14:26, 19 March 2017
[[Category: McNair Admin]]
 
=Old Notes (from Alex Jiang)=
 
== Installing Ubuntu aka Trying RAID 10 (2/15/2016) ==
Well, I don't really trust the file to download onto the webserver properly from terminal, so I got an SFTP client and used that to copy the .ttf file onto the webserver. Still no dice.
 
== Setting up users (3/11/2016) ==
 
First, getting the ImportUsers extension for bulk account creation (using a CSV). Downloading the extension is as follows:
 
$ cd ~/Downloads
$ wget https://extdist.wmflabs.org/dist/extensions/ImportUsers-REL1_26-0fe9e22.tar.gz
$ tar -xzvf ImportUsers-REL1_26-0fe9e22.tar.gz
$ cd /var/lib/mediawiki/extensions
$ cp -r ~/Downloads/ImportUsers ./ImportUsers
 
Then edit LocalSettings.php and add this line:
 
require_once("$IP/extensions/ImportUsers/ImportUsers.php");
 
Then we just have to make a CSV with columns for username, password, email, real name, and user groups (optional). More info on the [https://www.mediawiki.org/wiki/Extension:ImportUsers extension documentation page].
 
I made a small little CSV to test the ImportUsers extensions:
user1,pass1,user1@example.com,Dummy One
user2,pass2,user2@example.com,Dummy Two
user3,pass3,user3@example.com,Dummy Three
 
After importing the users, run a maintenance script from the command line to update new user statistics:
 
$ cd /var/lib/mediawiki/maintenance
$ php initSiteStats.php
 
But this runs into some errors ([https://www.mediawiki.org/wiki/Manual:Maintenance_scripts this page] suggests setting the MW_INSTALL_PATH environment variable, but I can't find a good way to do that). I looked into the error messages and found [http://stackoverflow.com/questions/21257589/ubuntu-typing-php-in-terminal-shows-a-lot-of-errors this SO post] which seems to cover it. I don't know whether we need SNMP, so I decided to just install it to be safe:
 
$ sudo apt-get install snmp
 
And the error messages go away. Alternatively, you can disable the snmp module for PHP with:
 
$ sudo php5dismod snmp
 
We also want to limit account creation to sysops only [https://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_account_creation as done here]. To do this, edit LocalSettings.php and add these lines:
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
 
== BibTex citations with BibManager (3/11/2016) ==
 
The [https://www.mediawiki.org/wiki/Extension:BibManager BibManager extension] isn't actively maintained, but it doesn't seem like it needs to be constantly updated to accommodate for new features and was last updated for Mediawiki version 1.22, which isn't too bad.
 
Let's test on the test web server first.
 
== Bibtex citations with Bibtex (3/14/2016) ==
 
The [https://www.mediawiki.org/wiki/Extension:Bibtex Bibtex extension] doesn't look like it's being actively maintained, but it might work. I'm testing it on the test web server alongside BibManager.
 
== Ghost vs. WordPress (3/14/2016) ==
 
So it looks like we may choose Ghost over WordPress. We need something self-hostable, and ideally open-source (and both Ghost and WP satisfy those two conditions). However, I hear Ghost is more lightweight, so if we're not looking for a lot of extra functionality from third-party plugins, Ghost may be the better choice. I'm setting up Ghost on the [[Test Web Server Documentation#Installing Ghost (3/14/2016)|test web server]], so we'll see how it goes...
 
Turns out Ghost+apache is kinda difficult (definitely more difficult than WordPress+Apache), so let's just try WordPress.
 
The [[Test Web Server Documentation#Installing WordPress (3/14/2016)|test web server]] had a pretty easy time installing WordPress alongside the existing mediawiki site, so it seems that we'll use WP for the blog on this web server as well.
 
== Infoboxes (3/16/2016) ==
 
I decide to follow the instructions on [http://trog.qgl.org/20140923/setting-up-infobox-templates-in-mediawiki-v1-23/ this post]. Let's see how it goes.
 
Step 1:
 
Download and install the [https://www.mediawiki.org/wiki/Extension:Scribunto Scribunto extension].
 
cd ~/Downloads
$ wget https://extdist.wmflabs.org/dist/extensions/Scribunto-REL1_26-9fd4e64.tar.gz
$ tar -xzvf Scribunto-REL1_26-9fd4e64.tar.gz
$ cd /var/lib/mediawiki/extensions
$ cp -r ~/Downloads/Scribunto ./Scribunto
 
Add these two lines to LocalSettings.php:
require_once("$IP/extensions/Scribunto/Scribunto.php");
$wgScribuntoDefaultEngine = 'luastandalone';
 
And set execute permissions for Lua binaries in the extension:
 
$ chmod a+x /var/lib/mediawiki/extensions/Scribunto/engines/LuaStandalone/binaries/lua_5_1_5_linux_64_generic/lua
 
In addition, check that the PCRE version is at least 8.10 (preferable at least 8.33), PHP's mbstring extension is enabled, and PHP's proc_open function is not disabled using a phpinfo page.
 
Step 2:
 
Copy Wikipedia's [https://en.wikipedia.org/w/index.php?title=MediaWiki:Common.css&action=edit Common.css] stylesheet into the wiki's Common.css stylesheet.
 
Step 3:
 
Export the Infobox template from Wikipedia from the [https://en.wikipedia.org/wiki/Special:Export Special:Export] page. In the "add pages manually" text box, type Template:Infobox and then check all three checkboxes below: "Include only the current revision, not the full history", "Include templates", and "Save as file", then click the Export button and save the XML file.
 
Step 4:
 
Import that XML file onto the wiki using the Special:Import page. Choose the "Import to default locations" option.
 
Step 5:
 
Test your Infobox template by creating a new page on the mediawiki and using the Infobox template. I used the following code to test:
 
<nowiki>
{{Infobox
|title = An amazing Infobox
|header1 = It works!
|label2 = Configured by
|data2 = trog
|label3 = Web
|data3 = http://trog.qgl.org/20140923/setting-up-infobox-templates-in-mediawiki-v1-23/
}}</nowiki>
 
 
Debugging:
 
I seem to have the template functionality working, but it's not styled properly. So let's try exporting and importing Wikipedia's Common.css stylesheet instead of just copying and pasting. And let's also try exporting and importing Wikipedia's Common.js script into the wiki.
 
Wait, I fixed it by just removing the custom CSS code that I had from trying to change the font-face. If those two things conflict, we may have issues down the line...
 
I also uncovered something about HTMLTidy that may impact how well templates from Wikipedia run on our mediawiki [https://www.mediawiki.org/wiki/Manual:Using_content_from_Wikipedia#HTMLTidy]. It looks like we can either [https://www.mediawiki.org/wiki/Manual:$wgTidyConfig set an option] in LocalSettings.php to enable HTMLTidy or we can [https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Transwiki get the templates from another source].
 
== Installing WordPress (3/16/2016) ==
 
Same as the [[Test Web Server Documentation#Installing WordPress (3/14/2016)|test web server]]
 
== Google Analytics for Mediawiki and WordPress (3/16/2016) ==
 
There's an [https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration extension] for google analytics integration on Mediawiki, and it seems to have pretty robust support (you can exclude specific pages or categories from analytics, and you exclude user groups from analytics too).
 
There's an open-source alternative to google analytics called [http://www.openwebanalytics.com/ Open Web Analytics], and there's [https://www.mediawiki.org/wiki/Extension:Open_Web_Analytics a Mediawiki extension] for that too. Looks like Open Web Analytics has some cool extra features too like click heatmaps...
 
WordPress appears to have support for both Google Analytics and Open Web Analytics.
 
After looking around for other open-source alternatives, it appears Piwik is another strong contender. There's a demo of Piwik [http://demo.piwik.org/ here] and a demo of OWA [http://demo.openwebanalytics.com/owa/ here]. There's [https://www.mediawiki.org/wiki/Extension:Piwik_Integration a Mediawiki extension] for Piwik integration, and it seems to be pretty well maintained. WordPress also appears to support Piwik as well.
 
== Open-source Analytics Alternatives (3/21/2016) ==
 
Might as well try to keep everything open-source. I'll try out Open Web Analytics (OWA) on the test web server to play around with the interface.
 
OWA isn't going to work, as noted on the [[Test Web Server Documentation#Installing Open Web Analytics (3/21/2016)|test web server page]]. So let's try the [https://www.mediawiki.org/wiki/Extension:Piwik_Integration extension] for Piwik too.
 
So at least Piwik works. But here's the counterargument: in five years, which is more likely to be well-supported and maintained, Piwik or Google Analytics? And with the obvious answer being Google Analytics, we should just use that.
 
== Back to Google Analytics (3/23/2016) ==
 
We made a new Google Analytics account! admin@mcnaircenter.org amount
 
I'm going to go ahead and test the Google Analytics integration extension on the [[Test Web Server Documentation#Installing Google Analytics (3/23/2016)|test web server]].
 
== Cargo vs Semantic Mediawiki? (3/25/2016) ==
 
I recently learned about Cargo, which claims to be a more straightforward version of SMW. see the [https://www.semantic-mediawiki.org/w/images/9/9a/Cargo_and_the_future_of_SMW.pdf slides] of a presentation given at the spring 2015 SMWCon, and the Cargo extension page's [https://www.mediawiki.org/wiki/Extension:Cargo/Cargo_and_Semantic_MediaWiki comparison] page. The lead author of the extension, Yaron, is a member of the SMW community, and so Cargo is likely pretty legit. Now I'm not sure which is better...
 
After some more deliberation, I think Cargo wins. Cargo's querying syntax is more like SQL (which is actually useful and pretty easy to learn), and Cargo also doesn't deal with all of the property declarations that Semantic Mediawiki requires. Also, Cargo has native support for JSON exporting, while SMW doesn't (and any extensions that provide such support are pretty stale).
 
== CSS Design (4/22/2016) ==
 
Couple of notes on where "obvious" (hint: not so obvious) things are. (Note, all paths that follow are relative to the Mediawiki root directory, which should be in /var/lib/mediawiki).
 
First, the logo for the page is defined in LocalSettings.php. Look for the $wgLogo variable. I used a FTP client to upload new logos, but you could use a terminal and wget the file if you have it online somewhere.
 
For changing CSS rules, I just used the Chrome inspector (F12 or right-click and choose "Inspect" from the option menu) to understand which CSS selector rules were being applied and which were being overridden. You can also make small CSS changes in the inspector that are lost upon refreshing the page, but can be useful for experimenting with different colors, positions, etc.
 
You can use $ grep -r "[words_to_search_for]" on the command line to search for something (a CSS hex color code, a CSS selector, etc.) in all files and directories in the current directory. I usually used this while in the skins/Vector directory to make finding CSS properties easier.
 
The CSS is actually written in LESS, which is an extension of CSS syntax that allows you to do nested properties, variables, etc. The skins/Vector/variables.less file has all the variables, which are prefixed with an at sign (@) in LESS. WARNING: if you try to use a variable name that hasn't been defined (due to a typo, for example), ALL of the CSS/LESS will stop working. The plus side is that its obvious that you messed up. The down side is that it may not be obvious where exactly you messed up, so make small changes and refresh the browser view constantly. Other than that, most of the other LESS rules are in the skins/Vector/components folder. The file names are fairly reasonable: common.less defines rules common to the entire page, navigation.less defines the area on the left sidebar, personalMenu.less defines the set of links in the top right corner for the user account, footer.less defines the footer. There's also another file in skins/Vector that is useful for understanding how everything comes together: VectorTemplate.php, which contains the high level HTML structure.
== To-do list ==
* extra namespaces for IntraACL stuff. see [https://www.mediawiki.org/wiki/Manual:Using_custom_namespaces here]
* restricting inconsistent styling: links aren't orange on special pages, fonts and links are the default in the "mobile" view == In progress == * Mediawiki CSS styling - '''custom fonts fixed, need new designs/layouts'''* analytics - '''getting GA installed for WordPress blogs, need port 21 opened''' == Potential pitfalls == * It looks like the Common.css stylesheet has to be exactly the same as the Wikipedia Common.css stylesheet for the Wikipedia Infobox templates to be styled properly, because I solved the problem of the infoboxes being styled incorrectly by deleting all of the custom CSS that we had written for the mediawiki. ==Installing and configuring the Backup Drive==  =New Notes= ==Mounting the RDP==  apt-get install cifs-utils  mount -t cifs //128.42.44.182/mcnair /mnt/rdp -o user=researcher,domain=ad.mcnaircenter.org ==Mobile Interface== ===Folders===* The folders with the source code can be found at  /var/lib/mediawiki/extensions/MobileFrontend/minerva.less ===Tips===* Using a [http://www.mobilephoneemulator.com/ mobile emulator] helps understand what the mobile interface is going to look like before deploying onto Production. ==User Access 6/15/2016 =='''Objective''' Accounts are to be vetted before they are created. We would like to have a queue of account creation? requests, that must be approved before they can be created, given that we allow users to edit public wiki pages.*Helpful Material:** [https://www.mediawiki.org/wiki/ManualExtension:Preventing_access#Restrict_account_creation like so?ConfirmAccount Mediawiki Documentation ]* open source blogging platform (separate from the Mediawiki)* bulk mcnair@rice.edu -account that will approve account creation. there Steps Followed:'''s an [Package Installation Steps:'''* cd extensions/* wget https://extdist.wmflabs.org/dist/extensions/ConfirmAccount-REL1_26-d6e2f46.tar.gz* tar -xzf ConfirmAccount-REL1_26-d6e2f46.tar.gz * sudo pear install mail* sudo pear install net_smtpThe above steps ensure that email notification system is set up, and that the Confirm Account package is set up.  '''Configuring Confirm Accounts php files '''The following files need to be updated as follows:*ConfirmAccount.php: Set the confirmation queues to point to folders that www-data has access to:// For changing path in accountreqs$wgConfirmAccountPathAR = $IP . "/images/accountreqs"; // For changing path in accountcreds$wgConfirmAccountPathAC = $IP . "/images/accountcreds"; *ConfirmAccount.config.php Change the directories to those defined in ConfirmAccount.php $wgFileStore['accountreqs']['directory'] : $wgConfirmAccountPathAR, $wgFileStore['accountcreds']['directory'] : $wgConfirmAccountPathAC, * LocalSettings.php:  $wgEnableEmail = true; $wgEmergencyContact = "mcnair@rice.edu"; $wgPasswordSender = "mcnair@rice.edu"; # User Account Confirmation require_once "$IP/extensions/ConfirmAccount/ConfirmAccount.php"; $wgSMTP = array( 'host' => 'ssl://smtp.mail.rice.edu', 'IDHost' => '128.42.44.22', 'port' => 465, 'username' => 'mcnair@rice.edu', 'password' => '*********', 'auth' => true); $wgConfirmAccountContact = 'mcnair@rice.edu'; ''' Updating the Wiki'''* cd /var/lib/mediawiki/maintenance* php update.php [[admin_classification::IT Build| ]] == Mediawiki extensions == == Semantic Mediawiki Extensions ==The SMW extension installation process requires a composer.phar to be installed. All further installations to SMW are done through the composer.phar. ==== Installing Mediawiki Composer.phar ====Here is the mediawikilink: [https://getcomposer.org/wikidoc/00-intro.md#installation-nix] ==== Installing Extension:ImportUsers extension] for thatSemantic Results Formats ====* Here is the link to the installation process : * Here is the command to be run in the Mediawiki root folder (var/lib/mediawiki) php composer. can create them onephar require --update-no-dev mediawiki/semantic-byresult-one without such an extension, but that may be annoyingformats "2.*" ==Using Google Analytics== Got to: https://analytics.google.com/ Log in with admin@mcnaircenter.org To do:*Check base analytics configuration*Check integration with Google Search*Install appropriate APIs

Navigation menu