Difference between revisions of "MediaWiki"
From Blue-IT.org Wiki
(→/srv/www/PathToMediaWiki/Localsettings.php) |
(→Convert phpbb code) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | = Tools = | ||
+ | == Convert phpbb code == | ||
+ | Simple and perfect quick and dirty bash script (this is not a real parser): | ||
+ | * does not preserver numbered lists! | ||
+ | * and some other limitations ;) | ||
+ | #!/bin/bash | ||
+ | myScript="${1}" | ||
+ | myBasename="$(basename "${myScript}")" | ||
+ | |||
+ | cat "${myScript}" | \ | ||
+ | sed -e "s/\[B\]/\'\'\'/g" | \ | ||
+ | sed -e "s/\[\/B\]/\'\'\'/g" | \ | ||
+ | sed -e "s/\[I\]/\'\'/g" | \ | ||
+ | sed -e "s/\[\/I\]/\'\'/g" | \ | ||
+ | sed -e "s/\[U\]//g" | \ | ||
+ | sed -e "s/\[\/U\]//g" | \ | ||
+ | sed -e "s/\[LIST\]//g" | \ | ||
+ | sed -e "s/\[\/LIST\]//g" | \ | ||
+ | sed -e "s/\[LIST\=1\]//g" | \ | ||
+ | sed -e "s/\[\/LIST\=1\]//g" | \ | ||
+ | sed -e "s/\[CODE\]/\<code\>/g" | \ | ||
+ | sed -e "s/\[\/CODE\]/\<\/code\>/g" | \ | ||
+ | sed -e "s/\[\*\]/\*\ /g" | \ | ||
+ | sed -e "s/\[\/I\]/\*\ /g" | | ||
+ | sed -e "s/^\ \*\ \ /\*\ /g" | \ | ||
+ | sed -e "s/^\ \*\ /\*\ /g" | \ | ||
+ | sed -e "s/\*\ \ /\*\ /g" | \ | ||
+ | sed -e "s/\*\ \ \ /\*\ /g" | \ | ||
+ | sed -e "s/\[URL\=\"/\[/g" | \ | ||
+ | sed -e "s/\"\]/\ /g" | \ | ||
+ | sed -e "s/\[\/URL\]/\]/g" | \ | ||
+ | sed -e "s/^\ //g" | \ | ||
+ | sed -e "s/^\ //g" | \ | ||
+ | sed -e "s/^\ //g" | \ | ||
+ | sed -e "s/^\ //g" | \ | ||
+ | awk '{system("echo -n \"\""); print $0}' > "$(pwd)/${myBasename}.wiki" | ||
+ | echo ---------------------------------------------- | ||
+ | echo "---- Copy & Past into the wiki ---------------" | ||
+ | echo vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
+ | cat "$(pwd)/${myBasename}.wiki" | ||
+ | echo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
+ | echo "--- END --------------------------------------" | ||
+ | echo ---------------------------------------------- | ||
+ | rm "$(pwd)/${myBasename}.wiki" | ||
+ | |||
+ | == Add a whitepace in front of a given textfile == | ||
+ | Mediawikisyntax forces you to add a whitespace in front of each line to get teh "source code view". | ||
+ | |||
+ | Pass a text file to the following script and copy and paste the terminal output: | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | myScript="${1}" | ||
+ | myBasename="$(basename "${myScript}")" | ||
+ | |||
+ | cat "${myScript}" | awk '{system("echo -n \" \""); print $0}' > "$(pwd)/${myBasename}.wiki" | ||
+ | echo ---------------------------------------------- | ||
+ | echo "---- Copy & Past into the wiki ---------------" | ||
+ | echo vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | ||
+ | cat "$(pwd)/${myBasename}.wiki" | ||
+ | echo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
+ | echo "--- END --------------------------------------" | ||
+ | echo ---------------------------------------------- | ||
+ | rm "$(pwd)/${myBasename}.wiki" | ||
+ | |||
+ | = vserver installation - SuSE 9.0 = | ||
==Initial installation== | ==Initial installation== | ||
===Concerns=== | ===Concerns=== | ||
Line 14: | Line 79: | ||
You will get an error during installation. | You will get an error during installation. | ||
− | Because of a bug in php you | + | Because of a bug in php you should do 3 things: |
− | + | ====1. php.ini==== | |
First edit ''/etc/php.ini'' an change the memory limit from 8 to 50MB: | First edit ''/etc/php.ini'' an change the memory limit from 8 to 50MB: | ||
memory_limit = 50M ; Maximum amount of memory a script may consume (8MB) | memory_limit = 50M ; Maximum amount of memory a script may consume (8MB) | ||
− | Second due to a bug in older mysql | + | ====2. tables.sql==== |
+ | Second due to a bug in older mysql versions you have to change two installation files of the media wiki. | ||
At the end of the file | At the end of the file | ||
− | maintenance/mysql5/tables.sql | + | /srv/www/PathToMediaWiki/maintenance/mysql5/tables.sql |
Change | Change | ||
Line 33: | Line 99: | ||
) TYPE=InnoDB, DEFAULT CHARSET=utf8; | ) TYPE=InnoDB, DEFAULT CHARSET=utf8; | ||
− | (!) '''The same''' (!) you have to do in file | + | ====3. patch-job.sql==== |
− | + | (!) '''The same''' (!) like for ''tables.sql'' you have to do in file | |
+ | ''maintenance/archives/patch-job.sql'' | ||
==Database related== | ==Database related== | ||
− | ===Alter user groups in the database=== | + | ===Alter ''user groups'' in the database=== |
− | + | Also see the MediaWiki Manual pages: [http://meta.wikimedia.org/wiki/Help:User_rights User_rights] | |
− | Edit your mysql database | + | Edit your mysql database: |
mysql -u root -p | mysql -u root -p | ||
mysql> use YourMediawikiDBName | mysql> use YourMediawikiDBName | ||
− | Show the actual user settings | + | Show the actual user settings: |
mysql> select user_id,user_name from user; | mysql> select user_id,user_name from user; | ||
+---------+-----------+ | +---------+-----------+ | ||
Line 54: | Line 121: | ||
2 rows in set (0.00 sec) | 2 rows in set (0.00 sec) | ||
− | Show the actual usergoups assigned to what users | + | Show the actual usergoups assigned to what users: |
mysql> select * from user_groups; | mysql> select * from user_groups; | ||
+---------+------------+ | +---------+------------+ | ||
Line 65: | Line 132: | ||
3 rows in set (0.00 sec) | 3 rows in set (0.00 sec) | ||
− | Delete a row | + | Delete a row: |
mysql> DELETE from user_groups where ug_group='aGroup' and ug_user='####'; | mysql> DELETE from user_groups where ug_group='aGroup' and ug_user='####'; | ||
− | + | Assign a user to a group: | |
mysql> INSERT INTO user_groups (ug_user, ug_group) VALUES ('####', 'aGroup'); | mysql> INSERT INTO user_groups (ug_user, ug_group) VALUES ('####', 'aGroup'); | ||
Line 74: | Line 141: | ||
===Localsettings.php=== | ===Localsettings.php=== | ||
− | in /srv/www/PathToMediaWiki/. . | + | You find the file in /srv/www/PathToMediaWiki/. . Also see the MediaWiki Manual pages: [http://meta.wikimedia.org/wiki/Help:User_rights User_rights]. |
## PERMISSIONS | ## PERMISSIONS | ||
Line 95: | Line 162: | ||
# (Sysops can still create user accounts) | # (Sysops can still create user accounts) | ||
#$wgGroupPermissions['*']['createaccount'] = false; | #$wgGroupPermissions['*']['createaccount'] = false; | ||
+ | |||
+ | [[Category:Web Development]] |
Latest revision as of 20:54, 10 January 2012
Contents
Tools
Convert phpbb code
Simple and perfect quick and dirty bash script (this is not a real parser):
- does not preserver numbered lists!
- and some other limitations ;)
#!/bin/bash myScript="${1}" myBasename="$(basename "${myScript}")" cat "${myScript}" | \ sed -e "s/\[B\]/\'\'\'/g" | \ sed -e "s/\[\/B\]/\'\'\'/g" | \ sed -e "s/\[I\]/\'\'/g" | \ sed -e "s/\[\/I\]/\'\'/g" | \ sed -e "s/\[U\]//g" | \ sed -e "s/\[\/U\]//g" | \ sed -e "s/\[LIST\]//g" | \ sed -e "s/\[\/LIST\]//g" | \ sed -e "s/\[LIST\=1\]//g" | \ sed -e "s/\[\/LIST\=1\]//g" | \ sed -e "s/\[CODE\]/\<code\>/g" | \ sed -e "s/\[\/CODE\]/\<\/code\>/g" | \ sed -e "s/\[\*\]/\*\ /g" | \ sed -e "s/\[\/I\]/\*\ /g" | sed -e "s/^\ \*\ \ /\*\ /g" | \ sed -e "s/^\ \*\ /\*\ /g" | \ sed -e "s/\*\ \ /\*\ /g" | \ sed -e "s/\*\ \ \ /\*\ /g" | \ sed -e "s/\[URL\=\"/\[/g" | \ sed -e "s/\"\]/\ /g" | \ sed -e "s/\[\/URL\]/\]/g" | \ sed -e "s/^\ //g" | \ sed -e "s/^\ //g" | \ sed -e "s/^\ //g" | \ sed -e "s/^\ //g" | \ awk '{system("echo -n \"\""); print $0}' > "$(pwd)/${myBasename}.wiki" echo ---------------------------------------------- echo "---- Copy & Past into the wiki ---------------" echo vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cat "$(pwd)/${myBasename}.wiki" echo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ echo "--- END --------------------------------------" echo ---------------------------------------------- rm "$(pwd)/${myBasename}.wiki"
Add a whitepace in front of a given textfile
Mediawikisyntax forces you to add a whitespace in front of each line to get teh "source code view".
Pass a text file to the following script and copy and paste the terminal output:
#!/bin/sh # myScript="${1}" myBasename="$(basename "${myScript}")" cat "${myScript}" | awk '{system("echo -n \" \""); print $0}' > "$(pwd)/${myBasename}.wiki" echo ---------------------------------------------- echo "---- Copy & Past into the wiki ---------------" echo vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv cat "$(pwd)/${myBasename}.wiki" echo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ echo "--- END --------------------------------------" echo ---------------------------------------------- rm "$(pwd)/${myBasename}.wiki"
vserver installation - SuSE 9.0
Initial installation
Concerns
- Media Wiki 1.6.6
- Mysql 4.0.15
- SuSE 9.0 on vserver
Patches
There are some major problems concerning the installation of media wiki on SuSE 9.0 on a vserver:
- Mysql is only version 4.0.15
- PHP is per default limited in memory
You will get an error during installation.
Because of a bug in php you should do 3 things:
1. php.ini
First edit /etc/php.ini an change the memory limit from 8 to 50MB:
memory_limit = 50M ; Maximum amount of memory a script may consume (8MB)
2. tables.sql
Second due to a bug in older mysql versions you have to change two installation files of the media wiki.
At the end of the file
/srv/www/PathToMediaWiki/maintenance/mysql5/tables.sql
Change
KEY (job_cmd, job_namespace, job_title) ) TYPE=InnoDB, DEFAULT CHARSET=utf8;
to
KEY (job_cmd(255), job_namespace, job_title(255)) ) TYPE=InnoDB, DEFAULT CHARSET=utf8;
3. patch-job.sql
(!) The same (!) like for tables.sql you have to do in file maintenance/archives/patch-job.sql
Alter user groups in the database
Also see the MediaWiki Manual pages: User_rights
Edit your mysql database:
mysql -u root -p mysql> use YourMediawikiDBName
Show the actual user settings:
mysql> select user_id,user_name from user; +---------+-----------+ | user_id | user_name | +---------+-----------+ | 1 | aUsername | | 2 | WikiSysOp | +---------+-----------+ 2 rows in set (0.00 sec)
Show the actual usergoups assigned to what users:
mysql> select * from user_groups; +---------+------------+ | ug_user | ug_group | +---------+------------+ | 1 | bureaucrat | | 1 | sysop | | 2 | sysop | +---------+------------+ 3 rows in set (0.00 sec)
Delete a row:
mysql> DELETE from user_groups where ug_group='aGroup' and ug_user='####';
Assign a user to a group:
mysql> INSERT INTO user_groups (ug_user, ug_group) VALUES ('####', 'aGroup');
... where '####' is the user_id of the appropriate user.
Localsettings.php
You find the file in /srv/www/PathToMediaWiki/. . Also see the MediaWiki Manual pages: User_rights.
## PERMISSIONS # This snippet prevents new registrations from anonymous users # (Sysops can still create user accounts) #$wgGroupPermissions['*']['createaccount'] = false;
## USERS ## see: http://meta.wikimedia.org/wiki/Help:User_rights # This snippet prevents editing from anonymous users $wgGroupPermissions['*']['edit'] = false;
# This will still allow logged in users to edit $wgGroupPermissions['user']['edit'] = true;
# No Pin header for non-logged in users $wgShowIPinHeader = false;
# This snippet prevents new registrations from anonymous users # (Sysops can still create user accounts) #$wgGroupPermissions['*']['createaccount'] = false;