# User:Daveg

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

# Dave Golby's Test Page

This is my home page, mainly used for testing ideas and resolving installationand configuration problems.

## Testing the Security Features

I've set up a special area for testing the LockDown facility. You can find it here.

## Installation and Configuration of Latex

Some equation tests.

First of all, good old Einstein's famous mass-energy equivalence:

${\displaystyle E=mc^{2}}$

Remember the good old days of Newtonian absolute space and time? (sigh...)

${\displaystyle F_{12}={\frac {Gm_{1}m_{2}}{R_{12}^{2}}}}$

a totally made up equation to test partial differential symbols:

${\displaystyle {\frac {\partial ^{2}y(x,t)}{\partial t^{2}}}=f(t)g(x)}$

and another (Ludwig Boltzmann, rest in peace...)

${\displaystyle S=k\log(W)}$

#### Notes

• After much struggle, the above equations should be rendered properly if texvc is working and the MediaWiki is configured correctly.
• Had to install MinGW32 for the basic compilation tools (make in this case). MinGW32 provides an application manager to download and install the components. These are stored in e:\mingw
• The source files for texvc are written in Caml. So another package is required called Objective Caml to compile these up. This is also installed on the E: drive.
• MediaWiki has a Math folder in which various source programs for texvc are kept. The make file in this folder must be executed in order for the texvc.bc code to be generated.
• NOTE Both Objective Caml bin and Mingw bin folders must be in the path
• When compiling from the DOS shell, use CAMLLIB=e:\objective caml\lib to enable CAML to pick up the various auxiliary files
• The render.ml file needs to be modified. Consult the page at [1]
• The Math.php file also needs to be modified. Read the instructions for replacing certain code sections at the above link
• I also had to open up all sorts of permissions to different users on the images folder. Not good form but this was required to get it to work.
• A good source of info for LaText within MediaWiki can be found at here.

## Installation and Configuration of PHP on Windows

• I would recommend using the zip installation, NOT the Windows installer
• Install PHP to C:\PHP or similar directory with no whitespaces in its pathname
• Use mmc to change the IIS setings:
• In the ISAPI Filters tab set up a PHP ISAPI Filter using c:\php\php5isapi.dll
• Make sure the Web Service extension for PHP is enabled with C:\php\php5isapi.dll
• In the Home Directory mmc tab, click on "Configuration..." and add a new extension .php to the list of supported extensions. Set the executable to c:\php\php5isapi.dll
• Use the PHPRC system-wide environment variable to set the PHP installation directory
• It may be required to change the permissions of the directory so that the IUSR_<machine name> has access to the folder (eg, for write,read,execute...)
• Set up the c:\php\php.ini file

; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:\\php\\ext"

...

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.

extension=php_bz2.dll
;extension=php_curl.dll
extension=php_dba.dll
extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
;extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
;extension=php_ming.dll
extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
extension=php_openssl.dll


• Use the following test script to verify the installation:
<html>
<?php

phpinfo();

?>

</html>



## Internal Variables

These are some internal variables that should be rendered correctly at run-time.

Here are some examples of these variables:

• QNET The name of the site (SITENAME)
• //kbwiki.ercoftac.org The name of the server (SERVER)
• User:Daveg The full name of the current page (FULLPAGENAME)
• User:Daveg The name of the article (ARTICLEPAGENAME)
• The current user is 18.207.106.142

## Templates

Test Templates:

Note that these Templates should be substituted into the page.

Here are some test pages that use templates I've developed

## Simple Forms

Click one this link to create a form. It uses the MediaWiki extension described here. The following form is provided as a test by the Form extension.

The sample form definition can be found here. The template used can be found here.

My own test form uses the AC Abstract template. Unfortunately it doesn't work properly at the moment.

Some sample pages created using the Abstract page form:

## HTMLets

This is a test area for HTMLets.

## Towards a Content Management Extension

These are links to pages concerned with scoping out work for a content management system. This is a proposed extension that would provide Ercoftac Editorial team members with tools for creating, moving and deleting Ercoftac articles. Ercoftac articles are a collection of MediaWiki pages.

## Email Confirmation and Access Control

Currently looking at limiting edit privileges to users who have a registered AND confirmed email address. This would help to prevent any bots from registering themselves.

Today I registered a new user Test Account user with a valid email address. The registered email was received at the expected address.

It turns out that a reply to this email was not required to complete the registration of the new user. That is, in principle a user without a confirmed email address can continue to use the Wiki. However, if the access controls on a page demand it, he/she may not be able to edit the page.

A user who elects to confirm his email address should be added to an 'emailconfirmed' user group, and it is by using this group that edit-controls can be placed on particular groups. To date it has not been possible to add users to this group: a check of the User List page shows that there are no members of this group as yet.

A forum post recommends the following PHP code. To restrict editing rights to registered users, the following should be added to LocalSettings.php:

$wgGroupPermissions['*' ]['edit'] = false; # Disallows editing by users.$wgGroupPermissions['emailconfirmed']['edit'] = true; # Allows editing by those with confirmed e-mails.



It's possible that this won't work as there are individual edit settings for particular groups that might override this setting. What is required is a means of adding users to two groups and ensuring that the permissions are AND-ed, ie, a user needs to be both in the Submitter group AND in the 'emailconfirmed' group before he is allowed to edit a page.

## Installing Semantic Media Wiki and its extensions

I decided to revisit the Semantic Media Wiki extension to see if it is possible to install it on the latest edition of the qnet site. To avoid any difficulties, I'm working with the QNET wiki running on my own laptop system (a Fujitsu-Siemens Windows XP Pro).

Here are some notes:

• To install SMW I followed the instructions at [2]
• Distribution was downloaded from SourceForge and replaced the previous version that was already installed in the extensions directory.
• Some of the PHP configuration code that is required was already included in the LocalSettings.php file but was commented out. This was re-instated with no modifications.
• Using version SMW 1.4.2
• The database already has the SMW tables installed from the previous attempt. All of the SMW tables are installed into the main wiki database and have prefixes mw_smw_
• The user has to be logged in with Systop privileges
• After installing the extension files, the user has to go to the page SMW Admin Page to complete the installation. This involves installing the database tables required by SMW and updating the tables using information from other pages (eg, last update time and similar properties?). To update the SMW tables it is quicker to use the utility runJobs.php that can be found in the maintenance directory in the root Wiki folder. This seems to work only if the request to update has already been submitted by the user through the SMW Admin page.
• Attempting to install the SPARQL end-point: Link to SPARQL option for Semantic MediaWiki
• This requires the following steps:
• RAP - RDF API for PHP - recommended that a seperate database be used
• RAP web site : [3]
• Downloaded and unpacked the distribution, re-instated RAP configuration code in LocalSettings.php
• Ensure the RAP installation directory is accessible by the IIS service
• Some difficulties with SMWRAPStore objects. Get the following error when attempting to configure the databases after installing RAP:
• Fatal error: Class 'SMWRAPStore' not found in C:\opt\qnet3\extensions\SemanticMediaWiki\includes\SMW_GlobalFunctions.php on line 595
• Modified the code in LocalSettings.php: \$smwgDefaultStore = "SMWRAPStore2". This ensures the class defined in SMW_RAPStore2 is used instead. So the problem seems to be with how SMW uses RAP rather than a problem with RAP itself.
• This improves things a bit but leads to a new problem. A run-time exception is thrown:
Notice:  Constant RDFAPI_INCLUDE_DIR already defined in C:\opt\qnet3\extensions\SemanticMediaWiki\includes\storage\SMW_RAPStore2.php on line 24

Opening connection to DB for RAP ...
Check if DB schema is already set up for RAP ...
Creating DB schema for RAP ...
Unexpected non-MediaWiki exception encountered, of type "Exception"

exception 'Exception' with message 'The used table type doesn't support FULLTEXT indexes' in C:\opt\rdfapi-php\api\model\DbStore.php:449

Stack trace:

#0 C:\opt\rdfapi-php\api\model\DbStore.php(316): DbStore->_createTables_MySQL()

#1 C:\opt\qnet3\extensions\SemanticMediaWiki\includes\storage\SMW_RAPStore2.php(197): DbStore->createTables('MySQL')

#4 C:\opt\qnet3\includes\Wiki.php(224): SpecialPage::executePath(Object(Title))

#5 C:\opt\qnet3\includes\Wiki.php(55): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))

#6 C:\opt\qnet3\index.php(93): MediaWiki->initialize(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest))

#7 {main}


Googling around, the advice I've found is that this is something to do with the particular engine that is used. Look at the blog article here for the explanation and a possible remedy using MyISAM.

I followed this suggestion and altered the tables in smw_rap. This appears to resolve the above problem:



mysql> alter table dataset_model engine=myisam;
Query OK, 0 rows affected (0.17 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table datasets engine=myisam;
Query OK, 0 rows affected (0.08 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table models engine=myisam;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table namespaces engine=myisam;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table statements engine=myisam;
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0



Having made these changes to the database the RAP database initialisation and configuration was re-attempted from the SMW Admin Page.


Notice:  Constant RDFAPI_INCLUDE_DIR already defined in C:\opt\qnet3\extensions\SemanticMediaWiki\includes\storage\SMW_RAPStore2.php on line 24

Opening connection to DB for RAP ...
Check if DB schema is already set up for RAP ...
RAP DB schema is already set up.
Checking RAP model...
Creating RAP model...
Created RAP model http://localhost/model
RAP setup finished. Handing over to SQL store setup.

Setting up standard database configuration for SMW ...

Selected storage engine is "SMWSQLStore2" (or an extension thereof)

Setting up table mw_smw_ids ...
... table exists already, checking structure ...
... column smw_id is fine
... column smw_namespace is fine
... column smw_title is fine
... column smw_iw is fine
... column smw_sortkey is fine
... table mw_smw_ids set up successfully.
Setting up table mw_smw_redi2 ...
... table exists already, checking structure ...
... column s_title is fine
... column s_namespace is fine
... column o_id is fine
... table mw_smw_redi2 set up successfully.
Setting up table mw_smw_rels2 ...
... table exists already, checking structure ...
... column s_id is fine
... column p_id is fine
... column o_id is fine
... table mw_smw_rels2 set up successfully.
Setting up table mw_smw_atts2 ...
... table exists already, checking structure ...
... column s_id is fine
... column p_id is fine
... column value_unit is fine
... column value_xsd is fine
... column value_num is fine
... table mw_smw_atts2 set up successfully.
Setting up table mw_smw_text2 ...
... table exists already, checking structure ...
... column s_id is fine
... column p_id is fine
... column value_blob is fine
... table mw_smw_text2 set up successfully.
Setting up table mw_smw_spec2 ...
... table exists already, checking structure ...
... column s_id is fine
... column p_id is fine
... column value_string is fine
... table mw_smw_spec2 set up successfully.
Setting up table mw_smw_subs2 ...
... table exists already, checking structure ...
... column s_id is fine
... column o_id is fine
... table mw_smw_subs2 set up successfully.
Setting up table mw_smw_inst2 ...
... table exists already, checking structure ...
... column s_id is fine
... column o_id is fine
... table mw_smw_inst2 set up successfully.
Setting up table mw_smw_conc2 ...
... table exists already, checking structure ...
... column s_id is fine
... column concept_txt is fine
... column concept_docu is fine
... column concept_features is fine
... column concept_size is fine
... column concept_depth is fine
... column cache_date is fine
... column cache_count is fine
... table mw_smw_conc2 set up successfully.
Setting up table mw_smw_conccache ...
... table exists already, checking structure ...
... column s_id is fine
... column o_id is fine
... table mw_smw_conccache set up successfully.
Database initialised successfully.

Setting up internal property indices ...
... space for internal properties already allocated.
... writing entries for internal properties.
Internal properties initialised successfully.

The storage engine was set up successfully.