Protoball:Setup: Difference between revisions

From Protoball
Jump to navigation Jump to search
 
(71 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Dev Notes]]
== MediaWiki ==
== MediaWiki ==


Line 25: Line 26:
}
}
</pre>
</pre>
=== Refreshing the Beta Site ===
<pre>
scripts/refresh_beta # copies the files from protoball.org to beta.protoball.org, backsup and copies protoballdb and protoballdatadb
</pre>
Edit and save (no changes needed, a touch in mediawiki parlance)
* http://beta.protoball.org/MediaWiki:Common.css
* http://beta.protoball.org/MediaWiki:Mainpage
* http://beta.protoball.org/MediaWiki:Sidebar


== Short Urls ==
== Short Urls ==
Line 40: Line 52:
RewriteEngine on
RewriteEngine on
RewriteBase /
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(skins|stylesheets|images|config|extensions)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index|load).php
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|robots\.txt)
RewriteCond %{REQUEST_URI} !^/[^:]*\.(png|html|js)
RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
</pre>
</pre>


== Javascript ==
== Sanitizer Adjustments ==
includes/Sanitizer.php
=== Allow anchor tags, etc ===
add 'a', 'span', etc to $htmlpairsStatic array


[[MediaWiki:Common.js]]
=== Allow tbody tags ===
add 'tbody' to $tabletags array and $htmlnest


=== TinyMCE on free text ===
== Crontab ==


http://www.tinymce.com/download/download.php JQuery
Note: All crontab commands need to special the absolute path to the command. Use "which command" to see where it is located.
unzip in root directory


<pre>
<pre>
function textareaTinyMceOnForms() {
...
if(wgPageName.indexOf("Special:FormEdit") > -1) {
* 2 * * * /bin/bash /home/protoball/dumpdb
</pre>
 
== Anonymous Editing of Talk Pages ==


        $.getScript("/tinymce/jscripts/tiny_mce/jquery.tinymce.js", function() { $('textarea.tinymce').tinymce({
;Note: This didn't work and is currently disabled.
                // Location of TinyMCE script
                script_url : '/tinymce/jscripts/tiny_mce/tiny_mce.js',


                // General options
LocalSettings.php
                theme : "advanced",
<pre>
                plugins : "pagebreak,style,layer,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
$wgNamespaceProtection[NS_MAIN] =
$wgNamespaceProtection[NS_USER] =
$wgNamespaceProtection[NS_PROJECT] =
$wgNamespaceProtection[NS_FILE] =
$wgNamespaceProtection[NS_IMAGE] =
$wgNamespaceProtection[NS_TEMPLATE] =
$wgNamespaceProtection[NS_HELP] =
$wgNamespaceProtection[NS_CATEGORY] = array('editarticles');
$wgGroupPermissions['user']['editarticles'] = true;
</pre>


                // Theme options
== Super Editor Permission Group ==
                theme_advanced_buttons1 : "justifyleft,justifycenter,justifyright,justifyfull,|,hr,nonbreaking,removeformat,visualaid,|,sub,sup,|,charmap,iespell,advhr,|,fullscreen",
 
                theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,insertdate,inserttime,preview",
<pre>
                theme_advanced_buttons3 : "bold,italic,underline,strikethrough,|,link,unlink,anchor,cleanup,help,code" ,
$wgGroupPermissions['supereditor'] = $wgGroupPermissions['editor'];
                theme_advanced_toolbar_location : "top",
$delete_privs = array('delete', 'bigdelete', 'suppressredirect', 'rollback', 'browsearchive', 'undelete', 'unwatchedpages', 'deletedhistory', 'deletedtext');
                theme_advanced_toolbar_align : "left",
foreach($delete_privs as $priv) {
                theme_advanced_statusbar_location : "bottom",
$wgGroupPermissions['supereditor'][$priv] = true;
                theme_advanced_resizing : true,
        })});
}
}
}
</pre>
Then add a label for supereditor like this:


addOnloadHook(textareaTinyMceOnForms);
http://protoball.org/MediaWiki:Group-supereditor
<pre>
Super Editor
</pre>
</pre>
== LocalSetting Variable Tweaks ==
=== Allow Rename of Title ===
$wgRestrictDisplayTitle = false;
=== This avoids thumbnail creation errors ===
$wgMaxShellMemory = 1131072;
=== Increase Parse Call Limit ===
$wgExpensiveParserFunctionLimit = 200;
=== Enable brackets in text ===
$smwgLinksInValues = true;
=== Increase max limit in inline queries ===
$smwgQMaxInlineLimit = 10000;
== Javascript ==
at all javascript to [[MediaWiki:Common.js]]
== JQuery UI ==
* download custom from http://jqueryui.com/download/
* we currently use just the slider
* unzipped into /jquery-ui/ directory
* import css in [[MediaWiki:Common.css]]
* dynamically load js in [[MediaWiki:Common.js]] (look for "slider")
== TinyMCE Editor ==
download jquery version at http://www.tinymce.com/download/download.php
unzip in root directory
see [[MediaWiki:Common.js]] for tinymce activation
=== Increasing the Default Text ===
http://www.tinymce.com/wiki.php/Configuration:content_css
=== Headings Plugin ===
download http://sourceforge.net/tracker/download.php?group_id=103281&atid=738747&file_id=312386&aid=1467705
cd ~/protoball.org/tinymce/jscripts/tiny_mce/plugins
mv ~/heading-1.3.zip .
unzip heading.zip
http://www.tinymce.com/forum/viewtopic.php?id=25260
vim editor_plugin.js # replace with corrected script
plugins: header
theme_advanced_buttons1: "h2,|,h3" //... etc


== Extensions ==
== Extensions ==
Line 119: Line 193:
Parse error: syntax error, unexpected T_FUNCTION in /home/protoball/protoballproject.org/extensions/SemanticImageInput/SemanticImageInput.php on line 58
Parse error: syntax error, unexpected T_FUNCTION in /home/protoball/protoballproject.org/extensions/SemanticImageInput/SemanticImageInput.php on line 58


temp fix, do not enable Semantic Image Input
<pre>
function registerInstantImageInput() {
        global $sfgFormPrinter;
        $sfgFormPrinter->registerInputType( 'InstantImageInput' );
};
$wgExtensionFunctions[] = "registerInstantImageInput";
</pre>
 
==== Updating Ask Queries with cron touch LocalSettings.php ====
 
Semantic Wiki, by default, caches ask query information. The only way to update the cache for the one page is to edit and save that page. By setting up a cron job to touch LocalSettings.php, the cache is cleared for all ask queries the next page visit.
 
<pre>
crontab -e
MAILTO=""
*/15 * * * * touch /home/protoball/protoball.org/LocalSettings.php
*/15 * * * * touch /home/protoball/beta.protoball.org/LocalSettings.php
 
</pre>


=== Cite ===
=== Cite ===
Line 128: Line 220:


https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ParserFunctions.git
https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ParserFunctions.git
=== WikiEditor ===
While tinymce works for html input. For essays using ref tags and for editable sections, we want wiki text
http://www.mediawiki.org/wiki/Extension:WikiEditor
cd ~/protoball.org/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/WikiEditor.git
cd ..
vim LocalSettings.php
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );
=== FancyCaptcha ===
* http://www.mediawiki.org/wiki/Extension:ConfirmEdit
<pre>
cd extensions
wget http://upload.wikimedia.org/ext-dist/ConfirmEdit-MW1.19-110791.tar.gz
tar -xzf ConfirmEdit-MW1.19-110791.tar.gz
cd ..
vim LocalSettings.php
require_once( "$IP/extensions/EnhancedSearch/EnhancedSearch.php" );
require_once("$IP/extensions/ConfirmEdit/FancyCaptcha.php");
$wgCaptchaClass = 'FancyCaptcha';
$wgCaptchaDirectory = "$IP/captcha";                     
$wgCaptchaSecret = $wgDBpassword;
$wgCaptchaDirectoryLevels = 0;
#ftp up a font... Overlock-Bold.ttf is from google fonts
mkdir captcha
~/python/bin/python /home/protoball/protoball.org/extensions/ConfirmEdit/captcha.py --font=/home/protoball/Overlock-Bold.ttf --wordlist=/usr/share/dict/words --key=_secret_ --output=/home/protoball.org/captcha --count=200
</pre>
=== SecurePages ===
* Need to have SSL enabled through the webhost
* git clone http://git.fsinf.at/mediawiki/SecurePages.git SecurePages
<pre>
cd ~
git clone http://git.fsinf.at/mediawiki/SecurePages.git SecurePages
mv SecurePages protoball.org/extensions/SecurePages
cd protoball.org
vim LocalSettings.php
#edit $wgServer as follows
$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$wgServer          = $wgProto.'://' . "protoball.org";
# then in then regular extension section add
require_once( "$IP/extensions/SecurePages/SecurePages.php" );
$wgSecurePages = array( -1 => array( 'UserLogin', 'Preferences', 'ChangePassword'), );
</pre>
=== Google Analytics ===
Extension:Google Analytics Integration
* http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration
* git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/googleAnalytics.git
<pre>
vim LocalSettings.php
require_once( "$IP/extensions/googleAnalytics/googleAnalytics.php" );
$wgGoogleAnalyticsAccount = "UA-xxxxxxx-x";
</pre>
=== Widgets ===
Extension:Widgets
* http://www.mediawiki.org/wiki/Extension:Widget
* git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Widgets.git
<pre>
vim LocalSettings.php
require_once("$IP/extensions/Widgets/Widgets.php");
$wgGroupPermissions['sysop']['editwidgets'] = true;
</pre>
== Running Jobs ==
Jobs are small pieces of work that mediawiki sets aside to do. They are executed $wgJobRunRate times per Page Access, whose default is 1.
CVS imports are included in this job queue; so, a back-log of jobs will result in unprocessed import jobs.
To run all jobs, go
php maintenance/runJobs.php
This is added in a chron job
<pre>
crontab -e
...
10 * * * * /usr/local/bin/php /home/protoball/protoball.org/maintenance/runJobs.php
40 * * * * /usr/local/bin/php /home/protoball/beta.protoball.org/maintenance/runJobs.php
</pre>


== Enable Image Uploads ==
== Enable Image Uploads ==
Line 141: Line 327:
;[[MediaWiki:Mainpage]]:edit what the main page of the wiki site is
;[[MediaWiki:Mainpage]]:edit what the main page of the wiki site is
;[[MediaWiki:Sidebar]]:edit the sidebar links
;[[MediaWiki:Sidebar]]:edit the sidebar links
;[[Special:AllMessages]]:System Messages, filter by changed option to see customizations
== Backup ==
* db and files are uploaded to dropbox using https://github.com/andreafabrizi/Dropbox-Uploader
== Python ==
Python language is used to run some maintenance scripts
=== Python Setup ===
<pre>
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.2.tar.gz
tar xzf virtualenv-1.7.2.tar.gz
python virtualenv-1.7.2/virtualenv.py $HOME/python
export PATH=/home/protoball/python/bin:$PATH
</pre>
==== Packages ====
<pre>
python/bin/easy_install mwclient
python/bin/easy_install python-fusiontables
python/bin/easy_install geopy
python/bin/easy_install --upgrade google-api-python-client
# other packages usually existing in dev environments but included for completeness
# figure out how to install mysql on your computer first then
# sudo apt-get install python-mysqldb
python/bin/easy_install mysql-python
python/bin/easy_install simplejson
</pre>
==== Site Packages ====
/home/protoball/python/lib/python2.6/site-packages

Latest revision as of 17:17, 16 October 2015

MediaWiki

Wikimedia is moving from SVN to Git. Current stable version is 1.19.0; Dreamhost uses 1.16. Many extensions are still svn only.

git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git
cd core
git checkout 1.19.6
cd ..
mv core _web_directory_

Beta Site

A copy of the files and database of protoball.org

LocalSettimgs.php, per variable

if(basename(dirname(__FILE__)) == "beta.protoball.org") {
  $wgServer = "beta.protoball.org";
  $wgDBname = _beta_db_;
  $wgDBname = _beta_logo_;
}

Refreshing the Beta Site

scripts/refresh_beta # copies the files from protoball.org to beta.protoball.org, backsup and copies protoballdb and protoballdatadb

Edit and save (no changes needed, a touch in mediawiki parlance)

Short Urls

LocalSettings.php

$wgScriptPath       = "";
$wgScript           = "$wgScriptPath/index.php";
$wgRedirectScript   = "$wgScriptPath/redirect.php";
$wgArticlePath      = "$wgScriptPath/$1";

.htaccess

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]

Sanitizer Adjustments

includes/Sanitizer.php

Allow anchor tags, etc

add 'a', 'span', etc to $htmlpairsStatic array

Allow tbody tags

add 'tbody' to $tabletags array and $htmlnest

Crontab

Note: All crontab commands need to special the absolute path to the command. Use "which command" to see where it is located.

...
* 2 * * * /bin/bash /home/protoball/dumpdb

Anonymous Editing of Talk Pages

Note
This didn't work and is currently disabled.

LocalSettings.php

$wgNamespaceProtection[NS_MAIN] =
$wgNamespaceProtection[NS_USER] =
$wgNamespaceProtection[NS_PROJECT] =
$wgNamespaceProtection[NS_FILE] =
$wgNamespaceProtection[NS_IMAGE] =
$wgNamespaceProtection[NS_TEMPLATE] =
$wgNamespaceProtection[NS_HELP] =
$wgNamespaceProtection[NS_CATEGORY] = array('editarticles');
$wgGroupPermissions['user']['editarticles'] = true;

Super Editor Permission Group

$wgGroupPermissions['supereditor'] = $wgGroupPermissions['editor'];
$delete_privs = array('delete', 'bigdelete', 'suppressredirect', 'rollback', 'browsearchive', 'undelete', 'unwatchedpages', 'deletedhistory', 'deletedtext');
foreach($delete_privs as $priv) {
 $wgGroupPermissions['supereditor'][$priv] = true;
}

Then add a label for supereditor like this:

http://protoball.org/MediaWiki:Group-supereditor

Super Editor

LocalSetting Variable Tweaks

Allow Rename of Title

$wgRestrictDisplayTitle = false;

This avoids thumbnail creation errors

$wgMaxShellMemory = 1131072;

Increase Parse Call Limit

$wgExpensiveParserFunctionLimit = 200;

Enable brackets in text

$smwgLinksInValues = true;

Increase max limit in inline queries

$smwgQMaxInlineLimit = 10000;

Javascript

at all javascript to MediaWiki:Common.js

JQuery UI

* we currently use just the slider
* unzipped into /jquery-ui/ directory

TinyMCE Editor

download jquery version at http://www.tinymce.com/download/download.php

unzip in root directory

see MediaWiki:Common.js for tinymce activation

Increasing the Default Text

http://www.tinymce.com/wiki.php/Configuration:content_css

Headings Plugin

download http://sourceforge.net/tracker/download.php?group_id=103281&atid=738747&file_id=312386&aid=1467705

cd ~/protoball.org/tinymce/jscripts/tiny_mce/plugins
mv ~/heading-1.3.zip .
unzip heading.zip

http://www.tinymce.com/forum/viewtopic.php?id=25260

vim editor_plugin.js # replace with corrected script
plugins: header
theme_advanced_buttons1: "h2,|,h3" //... etc

Extensions

Semantic Bundle

svn co http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_19/phase3
mv phase3
cd phase3/extensions
svn co http://semantic-mediawiki-bundle.googlecode.com/svn/trunk/ semantic-bundle
make ext
cp SemanticBundleSettings.sample.php SemanticBundleSettings.php
cp * _web_directory_/extensions/ -R

LocalSettings.php

require_once( "$IP/extensions/semantic-bundle/SemanticBundleSettings.php" );
require_once( "$IP/extensions/semantic-bundle/SemanticBundle.php" );

In page Special:SMWAdmin, click Initialize

php maintenance/update.php
vim SemanticBundleSettings.php
:%s/#include_once/include_once/g

Note: Parse error: syntax error, unexpected T_FUNCTION in /home/protoball/protoballproject.org/extensions/SemanticImageInput/SemanticImageInput.php on line 58

function registerInstantImageInput() {
        global $sfgFormPrinter;
        $sfgFormPrinter->registerInputType( 'InstantImageInput' );
};
$wgExtensionFunctions[] = "registerInstantImageInput";

Updating Ask Queries with cron touch LocalSettings.php

Semantic Wiki, by default, caches ask query information. The only way to update the cache for the one page is to edit and save that page. By setting up a cron job to touch LocalSettings.php, the cache is cleared for all ask queries the next page visit.

crontab -e
MAILTO=""
*/15 * * * * touch /home/protoball/protoball.org/LocalSettings.php
*/15 * * * * touch /home/protoball/beta.protoball.org/LocalSettings.php

Cite

https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Cite.git

ParserFunctions

https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ParserFunctions.git

WikiEditor

While tinymce works for html input. For essays using ref tags and for editable sections, we want wiki text

http://www.mediawiki.org/wiki/Extension:WikiEditor

cd ~/protoball.org/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/WikiEditor.git
cd ..
vim LocalSettings.php
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );

FancyCaptcha

cd extensions
wget http://upload.wikimedia.org/ext-dist/ConfirmEdit-MW1.19-110791.tar.gz
tar -xzf ConfirmEdit-MW1.19-110791.tar.gz
cd ..
vim LocalSettings.php
require_once( "$IP/extensions/EnhancedSearch/EnhancedSearch.php" );
require_once("$IP/extensions/ConfirmEdit/FancyCaptcha.php");
$wgCaptchaClass = 'FancyCaptcha';
$wgCaptchaDirectory = "$IP/captcha";                      
$wgCaptchaSecret = $wgDBpassword;
$wgCaptchaDirectoryLevels = 0;

#ftp up a font... Overlock-Bold.ttf is from google fonts

mkdir captcha
 ~/python/bin/python /home/protoball/protoball.org/extensions/ConfirmEdit/captcha.py --font=/home/protoball/Overlock-Bold.ttf --wordlist=/usr/share/dict/words --key=_secret_ --output=/home/protoball.org/captcha --count=200

SecurePages

cd ~
git clone http://git.fsinf.at/mediawiki/SecurePages.git SecurePages
mv SecurePages protoball.org/extensions/SecurePages
cd protoball.org
vim LocalSettings.php
#edit $wgServer as follows
$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$wgServer           = $wgProto.'://' . "protoball.org";

# then in then regular extension section add
require_once( "$IP/extensions/SecurePages/SecurePages.php" );
$wgSecurePages = array( -1 => array( 'UserLogin', 'Preferences', 'ChangePassword'), );

Google Analytics

Extension:Google Analytics Integration

vim LocalSettings.php
require_once( "$IP/extensions/googleAnalytics/googleAnalytics.php" );
$wgGoogleAnalyticsAccount = "UA-xxxxxxx-x";

Widgets

Extension:Widgets

vim LocalSettings.php
require_once("$IP/extensions/Widgets/Widgets.php");
$wgGroupPermissions['sysop']['editwidgets'] = true;

Running Jobs

Jobs are small pieces of work that mediawiki sets aside to do. They are executed $wgJobRunRate times per Page Access, whose default is 1.

CVS imports are included in this job queue; so, a back-log of jobs will result in unprocessed import jobs.

To run all jobs, go

php maintenance/runJobs.php

This is added in a chron job

crontab -e
...
10 * * * * /usr/local/bin/php /home/protoball/protoball.org/maintenance/runJobs.php
40 * * * * /usr/local/bin/php /home/protoball/beta.protoball.org/maintenance/runJobs.php

Enable Image Uploads

LocalSettings.php (edit)

$wgEnableUploads  = true;
chmod a+w images

Special Pages

MediaWiki:Mainpage
edit what the main page of the wiki site is
MediaWiki:Sidebar
edit the sidebar links
Special:AllMessages
System Messages, filter by changed option to see customizations

Backup

Python

Python language is used to run some maintenance scripts

Python Setup

wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.2.tar.gz
tar xzf virtualenv-1.7.2.tar.gz
python virtualenv-1.7.2/virtualenv.py $HOME/python
export PATH=/home/protoball/python/bin:$PATH

Packages

python/bin/easy_install mwclient
python/bin/easy_install python-fusiontables
python/bin/easy_install geopy
python/bin/easy_install --upgrade google-api-python-client
# other packages usually existing in dev environments but included for completeness
# figure out how to install mysql on your computer first then
# sudo apt-get install python-mysqldb
python/bin/easy_install mysql-python
python/bin/easy_install simplejson

Site Packages

/home/protoball/python/lib/python2.6/site-packages