Extension talk:Mccp

=Complete Installation Walkthrough= note: there are many aspects of this install that you will no doubt want to change and customize... but since the extension is an integration of all these things...I wanted to provide you with a super-simple installation walkthrough that is complete... so, here it goes.....

1. First we install and test the WAMP

 * 1) Started with nothing but a machine running windows XP
 * 2) Downloaded WedDev 2.0 from: http://sourceforge.net/project/showfiles.php?group_id=187164
 * Note: saved it to C:\ (this is where it must be run from)
 * 1) Ran "c:\wdsetup-v2.00.exe" and selected "Full Installation" install type.
 * Note: had to reboot when it was done.
 * 1) Tested my apache server by visiting: "http://localhost/phpinfo.php"
 * Note:got the expected PHP Info page
 * 1) Tested MySQL by visiting: "http://localhost/phpmyadmin/"
 * Note: used the default WebDev MySQL admin username and password of: root:rootwdp
 * Noted the correct "phpmyadmin" response page. so far so good!

2. Next we install and test mediawiki

 * 1) Triggered my mediawiki install by visiting the page: "http://localhost/mediawiki/"
 * Notes:
 * Named it "mytestwiki"
 * provided WikiSysOp password
 * Changed the option for email authentication to "disabled"
 * Used the "Superuser Account" for the database section using root:rootwdp from "phpmyadmin" test above
 * left everything else as default
 * NOTE: If you choose to create the mediawiki MySQL database with any name other than "mediawiki" and/or if you choose to add a table prefix to your mediwiki MySQL database, please make a note of it -- you will need that information again in Step 9b
 * 1) Mediawiki Installation Successful!
 * 2) Moved mediawiki's "LocalSettings.php" file
 * from: "C:\www\webapps\mediawiki\config\"
 * to: "C:\www\webapps\mediawiki\"
 * 1) Then visited: "http://localhost/mediawiki/index.php/Main_Page" and saw the default main page.

3. Next we install PHP's PEAR so as to get the MSExcel Spreadsheet creation tools:
http://wwwproxy.acme.com:80
 * 1) Open a command prompt and go to the "C:\www\php5\" directory
 * 2) Trigger the installation of PEAR by typing, "go-pear.bat"
 * press "enter" to accept the system installation
 * press "enter" again to accept all default file layout choices
 * type "Y" to let PEAR alter php.ini
 * press "enter" to continue.
 * press "enter" to finish the PEAR install (note the advice to modify the environment settings, but do nothing yet)
 * 1) You may have to set PEAR to use your proxy URL at the command prompt:
 * C:\www.php5\>pear config-set http_proxy
 * (You should get the reply:)
 * config-set succeeded
 * 1) (Now we need to install a pre-requisite of "Express Spreadsheet" called OLE')
 * type "pear install OLE-1.0.0RC1" to install PHP OLE
 * next type "pear install Spreadsheet_Excel_Writer-0.9.1" to install Excell writer
 * (keep the command prompt open)

4. Next we need to install WGET

 * 1) with a web browser, visit: "http://users.ugent.be/~bpuype/wget/#download" and download the exe file "wget.exe"
 * Created a folder called "wget" in "c:\www\" to make the path: "c:\www\wget"
 * 1) Copied "wget.exe" to "c:\www\wget\"
 * 2) Test "WGET" in the command prompt by...
 * go to the "c:\www\wget\" folder and type "wget -O trash.txt http://localhost/phpinfo.php"
 * Note a successful response with no failures and note the output file called "trash.txt" in the folder with "wget.exe"

5. Next we need to make sure the SSL is working

 * 1) Re-test "wget" with SSL by typing "wget -O trash-ssl.txt --no-check-certificate https://localhost/phpinfo.php"
 * Note a successful response with no failures and note the output file called "trash-ssl.txt" in the folder with "wget.exe"

6. Next we need to set-up the MS-Access ODBC connection

 * 1) Included in the MCCP Extension zip file (in the b2ccdb folder) is the "template" database
 * ("http://www.mavericks2252.net/archive/mediawiki-extensions/mccp/" called "MCCP_Database--blank.mdb")
 * Save it to "c:\" (wherever, really. just decide where you want it and note the location)
 * and re-name it to remove the "--blank" so that the name is "MCCP_Database.mdb"
 * 1) Click "Start->Control Panel", then open "Administrative Tools"
 * from "Administrative Tools" open "Data Sources (ODBC)"
 * from "Data Sources (ODBC)" select the "System DNS" tab
 * click "Add", select "Microsoft Access Driver(*.mdb)", click "Finish"
 * Set the Data source name to: "MCCP_Metrology_Database"
 * Select the database file "c:\MCCP_Database.mdb" as the data source (or wherever you saved the template database file)
 * Select "OK" to finish the ODBC driver set-up tool

7. Next we need to install the "MCCP" Extension :-)

 * 1) Download the latest MCCP extension version from: "http://www.mavericks2252.net/archive/mediawiki-extensions/mccp/"
 * 2) Unzip it onto your desktop and we'll put things where they belong manually.
 * 3) from the unzipped MCCP file on your desktop:
 * go in to the "Desktop\{MCCP Zip File}\mediawikiroot\extensions\" folder ...
 * and copy the folder "mccp" to the "extension" folder of "your" mediawiki folder.
 * (you should now have a copy of that folder at: "C:\www\webapps\mediawiki\extensions\"
 * which is like... "C:\www\webapps\mediawiki\extensions\mccp\")
 * 1) again, from the unzipped MCCP file on your desktop:
 * go in to the "Desktop\{MCCP Zip File}\" base folder...
 * and copy the folder "b2ccdb" to the root web folder of your apache server.
 * (which is: "C:\www\vhosts\localhost")
 * you should now have a copy of this folder at:
 * "C:\www\vhosts\localhost\b2ccdb\"
 * (fyi, the MCCP extension uses iframes to facilitate inline editing... these folders do that...don't mess with them!)
 * you should now have a copy of this folder at:
 * "C:\www\vhosts\localhost\b2ccdb\"
 * (fyi, the MCCP extension uses iframes to facilitate inline editing... these folders do that...don't mess with them!)
 * (fyi, the MCCP extension uses iframes to facilitate inline editing... these folders do that...don't mess with them!)

8. Perform the usual "LocalSettings.php" modification to enable the extensions :-)
$wgExtraNamespaces = array ( 900 => "MCCP_Function Type_ID" ,901 => "MCCP_Function Type_ID_talk" ,902 => "MCCP_Manufacturer_ID" ,903 => "MCCP_Manufacturer_ID_talk" ,904 => "MCCP_Product_ID" ,905 => "MCCP_Product_ID_talk" ,906 => "MCCP_Equipment_ID" ,907 => "MCCP_Equipment_ID_talk" ,908 => "MCCP_Location Site_ID" ,909 => "MCCP_Location Site_ID_talk" ,910 => "MCCP_Location Structure_ID" ,911 => "MCCP_Location Structure_ID_talk" ,912 => "MCCP_Location Room_ID" ,913 => "MCCP_Location Room_ID_talk" ,914 => "MCCP_Location Area_ID" ,915 => "MCCP_Location Area_ID_talk" ,916 => "MCCP_System_ID" ,917 => "MCCP_System_ID_talk" ,918 => "MCCP_Subsystem_ID" ,919 => "MCCP_Subsystem_ID_talk" ,920 => "MCCP_Instrument_ID" ,921 => "MCCP_Instrument_ID_talk" ,922 => "MCCP_Drawing_ID" ,923 => "MCCP_Drawing_ID_talk" ,924 => "MCCP_Task_ID" ,925 => "MCCP_Task_ID_talk" ,926 => "MCCP_Project_ID" ,927 => "MCCP_Project_ID_talk" ,928 => "MCCP_Document_ID" ,929 => "MCCP_Document_ID_talk" ,928 => "MCCP_Log_ID" ,929 => "MCCP_Log_ID_talk" );
 * 1) Open "LocalSettings.php" (found in: "C:\www\webapps\mediawiki", remember? ;-)in a text editor and add the lines:

require_once("$IP/extensions/mccp/database_logs.setup.php"); require_once("$IP/extensions/mccp/statistics.setup.php"); require_once("$IP/extensions/mccp/testing.setup.php"); require_once("$IP/extensions/mccp/product_apps.setup.php"); require_once("$IP/extensions/mccp/product_types.setup.php"); require_once("$IP/extensions/mccp/manufacturers.setup.php"); require_once("$IP/extensions/mccp/products.setup.php"); require_once("$IP/extensions/mccp/location.setup.php"); require_once("$IP/extensions/mccp/systems.setup.php"); require_once("$IP/extensions/mccp/inventory.setup.php"); require_once("$IP/extensions/mccp/newitems.setup.php");
 * 1) --- MCCP EXTENSIONS -
 * 1) --- MCCP EXTENSIONS -

the end.

9a Minimal Locaization Settings
If you are following this walkthrough exactly, then you have installed the "mccp" extension at: "c:\www\webapps\mediawiki\extensions\mccp\" and you have installed the "b2ccdb" folder at: "C:\www\vhosts\localhost\b2ccdb\" your Mediawiki MySQL database is named: mediawiki and you have not created any wiki table prefix

If this is the case for you, then you only need to rename the two extension localization files in each folder as follows:
 * 1) Notice in the folder ../b2ccdb/ there is a file called "b2x-cfg--default.php"
 * you must RENAME this file so that it is called: called "b2x-cfg.php"
 * 1) Next, notice in the folder ../mccp/ there is a file called "mccp-init--default.php"
 * you must RENAME this file so that it is called: called "mccp-init.php"

9b Advanced Localization Settings
this is the only hard/tricky part

If your wiki is installed anywhere other than: "c:\www\webapps\mediawiki\" you will have to modify the contents of the two installation localization files listed above in step 9a. Here is what you need to do: $mccp_absolute_filesystem_wgetpath   = "c:\\www\wget\\";
 * 1) You must edit this file "b2x-cfg.php" so that it can find the "mccp" extension folder in your mediawiki
 * this file is roughly just one line of code so it should be easy for you to find:
 * require_once('{relative file system path to wiki base}\extensions\mccp\mccp-init.php');
 * This line needs to describe the relative file-system path to tell "b2x-init.php" how to find "mccp-init.php"
 * 1) Next your need to modify the variables within "mccp-init.php"
 * the setting that should work for this walkthrough look something like this:

$mccp_relative_filesystem_path2b2ccdb = "../../vhosts/localhost/b2ccdb/"; $wiki2zb2ccdbpath                    = "../../vhosts/localhost/b2ccdb/";

$wiki2zb2ccdbwwwpath                 = "../../b2ccdb/";

$wikipath                            = "mediawiki/";

$mySQLmediawikiDbName                = "mediawiki" $b2xrequestdataprefix                = "";

$MCCP_DSN_FileName                   = 'MCCP_Metrology_Database'; $MCCP_DSN_UserName                   = ''; $MCCP_DSN_Password                   = '';

$b2xDACTaskConnEnable                = false; $TASK_DSN_FileName                   = 'B2X_DAC_Work_Load'; $TASK_DSN_UserName                   = ''; $TASK_DSN_Password                   = '';

$MCCP_Devs_Username                  = 'WikiSysop'; $MCCP_Devs_IPAddress                 = '127.0.0.1';

$MCCP_NewItemPassword                = "mccp";

$mccp_relative_serverURL2shortlink   = "../../";

Other tweaks
ModSecurity: Output filter: Response body too large (over limit of 524288, total length not known).
 * Avoiding the Apache Response Limit Problem - The problem is that, by default, when you visit the Inventory page with no filters set… you are asking for a dump of the whole database… which could be a pretty big html dump to the browser. Apache is configured by default to limit how big of a response it allows itself to provide and will generate the following error:

To eliminate this... You will want to boost the default setting to accomodate your needs

To do this under the WebDev 2.0 WAMP, open the following file: C:\www\Apache22\conf\extra\mod_security2\rules\modsecurity_crs_10_config.conf And search for the line with: SecResponseBodyLimit 524288 and change the number to something larger. I think I just added two zeros to the number like: SecResponseBodyLimit 52428800

save the file and restart Apache

10. Initialize the system
An old trick used to eliminate redundant database querries is to generate a static text files of the parts of the database content that doesn't change very often and then just read the text file instead of querying the database repetitively. So we need to do that with our new system. As a side-note, you will also need to re-do this anytime you go in to the database manually and ADD a new system, location or part definition.

Its very easy.... just visit your mediawiki and click on the "Special Pages Link" (i.e. http://localhost/mediawiki/index.php/Special:Specialpages). You should then see a list of "Special pages" some of which begin with "MCCP" (these are the special pages added by the extension). Visit each of the MCCP Special pages listed below and verify that they pull-up without any errors:


 * Special:MCCP Database - Locations Listing
 * Special:MCCP Database - Systems Listing
 * Special:MCCP Database - Manufacturer Listing
 * Special:MCCP Database - Product Applications Listing
 * Special:MCCP Database - Product Listing
 * Special:MCCP Database - Product Types Listing
 * Special:MCCP Database - Inventory Listing

11. Install the MCCP Skin in Mediawiki

 * 1) from the unzipped MCCP file on your desktop:
 * go in to the "Desktop\{MCCP Zip File}\your-wiki\skins\" folder ...
 * and copy everything there into the "skins" folder of "your" mediawiki folder.
 * which is like... "C:\www\webapps\mediawiki\skins\")
 * 1) log in to your wiki and you should be able to select this skin as a user preference in mediawiki now
 * 2) (optional, but recommended) open your wiki's localsetting.php file and set the default skin to "MCCP01"
 * do this by changing the line: $wgDefaultSkin = 'monobook';
 * to: $wgDefaultSkin = 'mccp01';
 * to: $wgDefaultSkin = 'mccp01';

Why do you need the skin, you ask?
You may have noticed the extra namespaces we added in the localsettings.php file

In general, we added a custom wiki namespace for each of the major tables of the MCCP database. The MCCP extension allows you to edit the database tables from the wiki, but it uses the wiki skin to do this.

This skin will detect what namespace you are viewing and display editable database content that matches.

for example: the page at "./mediawiki/index.php/MCCP_Instrument_ID:1" will mine the MCCP database for all of the information relating to the instrument identified in the database by the primary key index "1".

I also use the mediawiki MCCP skin as a way to provide users with different skins that contain links unique to their roles. You may want to make copies of the MCCP skin and further customize each skin for each of the various roles and responsibilities of the users... i.e. one user may only care about configuration control for a certain system... another user may only care about metrology across the whole site.. I would make multiple skins from the base and customize the menus to contain direct links to the lists that that person want to see regularly.

12. test it
if everything has gone well, the page you will want to use as the "front-door" to the system is the inventory page.

visit the inventory page at:
 * Special:MCCP_Database_-_Inventory_Listing

=epiloge= well... that's it... the rest of the information will have to be in the form of a user-manual that i have yet to write.

Extension:Mccp

so until I get to that.. you will have to email me or ask here.

be sure to tell me if you use it and if you have any success....

Cheers! - Rich (revansx)

=How to upgrade the extension=
 * 1) Rename the "mccp" folder in your wiki’s extension directory to something like "mccp-old" (feel free to delete this folder after you are satisfied that the installation has been done successfully)
 * 2) Rename the "b2ccdb" folder in the "c:\www\vhosts\localhost\" folder to something like "b2ccdb-old" (feel free to delete this folder after you are satisfied that the installation has been done successfully)
 * 3) Download the latest version of the MCCP Extension from:
 * http://www.mavericks2252.net/archive/mediawiki-extensions/mccp/
 * 1) Unzip it on your desktop
 * 2) Copy the "mccp" into your wiki extensions folder. ("c:\www\webapps\mediawiki\extensions\" if you followed the walk-through exactly.)
 * 3) Copy the "b2ccdb" folder into the \localhost\ folder of your server.("c:\www\vhosts\localhost\" if you followed the walk-through exactly.)
 * 4) Perform "Step 9" of the "Installation Walkthrough" above
 * 5) you're done.

=User Feedback= 2009-07-20 - Q: Is it possible to use MySQL on Linux instead Access on Windows? -- Ununpentium

A: Not currently. It is hard-codded to make ODBC calls. I am eager to generalize the external database using the ADODB database abstraction library. My plan is to do that before the end of 2009.