MongoDB Tutorial 2: Alternative control: Difference between revisions
Jump to navigation
Jump to search
MongoDB Tutorial 2: Alternative control (view source)
Revision as of 08:17, 24 November 2010
, 24 November 2010Reverted edits by Upazixorys (Talk); changed back to last version by Ric
Upazixorys (talk | contribs) No edit summary |
m (Reverted edits by Upazixorys (Talk); changed back to last version by Ric) |
||
Line 1: | Line 1: | ||
{{Nav MongoDB Tutorial 2}} | {{Nav MongoDB Tutorial 2}} | ||
'''''MongoDB''''' | '''''MongoDB''''' | ||
Line 22: | Line 21: | ||
In folder z_mongo\UniServer\unicon\'''tray_menu_2'''. | In folder z_mongo\UniServer\unicon\'''tray_menu_2'''. | ||
create a new file named '''''mongo_db_inc.php''''' from file z_mongo\temp\'''''z_temp\mongo_db_inc.php''''' copy the following lines. | create a new file named '''''mongo_db_inc.php''''' from file z_mongo\temp\'''''z_temp\mongo_db_inc.php''''' copy the following lines. | ||
<pre> | |||
$path_array = explode( | $path_array = explode("\\usr",getcwd()); // Split at folder usr | ||
$mongo_base = $path_array[0]; // find drive letter and any sub-folders | $mongo_base = $path_array[0]; // find drive letter and any sub-folders | ||
$mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | $mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | ||
//=== FOLDERS === | //=== FOLDERS === | ||
define( | define("MONGO_BIN", "$mongo_base_f/usr/local/mongo_tutorial/bin"); // Binaries for MongoDB | ||
//=== FILES === | //=== FILES === | ||
define( | define("CONFIG_NO_AUTH_F", "$mongo_base_f/usr/local/mongo_tutorial/bin/config_no_auth.ini"); | ||
define( | define("CONFIG_AUTH_F", "$mongo_base_f/usr/local/mongo_tutorial/bin/config_auth.ini"); | ||
define( | define("NAME_PWD_F", "$mongo_base_f/usr/local/mongo_tutorial/bin/mongo_name_password"); | ||
define( | define("UNISERV_EXE", "$mongo_base_f/usr/local/mongo_tutorial/bin/uniserv.exe"); // Utility | ||
define( | define("UNISERV_EXE_B", $mongo_base.'\usr\local\mongo_tutorial\bin\uniserv.exe'); // Utility | ||
define( | define("MON_PSKILL_EXE", "$mongo_base_f/usr/local/mongo_tutorial/bin/pskill.exe"); // Utility | ||
define( | define("CMD_DUMMY_TXT", "$mongo_base_f/usr/local/mongo_tutorial/bin/cmd_dummy.txt"); // Temp command fie | ||
</pre> | |||
It should be obvious all paths are incorrect and need updating added to this are items relating to authentication these need deleting. | It should be obvious all paths are incorrect and need updating added to this are items relating to authentication these need deleting. | ||
First delete authentication related to give: | First delete authentication related to give: | ||
<pre> | |||
$path_array = explode( | $path_array = explode("\\usr",getcwd()); // Split at folder usr | ||
$mongo_base = $path_array[0]; // find drive letter and any sub-folders | $mongo_base = $path_array[0]; // find drive letter and any sub-folders | ||
$mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | $mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | ||
//=== FOLDERS === | //=== FOLDERS === | ||
define( | define("MONGO_BIN", "$mongo_base_f/usr/local/mongo_tutorial/bin"); // Binaries for MongoDB | ||
//=== FILES === | //=== FILES === | ||
define( | define("CONFIG_NO_AUTH_F", "$mongo_base_f/usr/local/mongo_tutorial/bin/config_no_auth.ini"); | ||
define( | define("UNISERV_EXE", "$mongo_base_f/usr/local/mongo_tutorial/bin/uniserv.exe"); // Utility | ||
define( | define("UNISERV_EXE_B", $mongo_base.'\usr\local\mongo_tutorial\bin\uniserv.exe'); // Utility | ||
define( | define("MON_PSKILL_EXE", "$mongo_base_f/usr/local/mongo_tutorial/bin/pskill.exe"); // Utility | ||
</pre> | |||
First line splits current working directory at folder '''''usr''''' this requires changing. Choose a folder that is common to folders '''usr''' and '''unicon''', in this case use folder '''''UniServer''''' | First line splits current working directory at folder '''''usr''''' this requires changing. Choose a folder that is common to folders '''usr''' and '''unicon''', in this case use folder '''''UniServer''''' | ||
Line 63: | Line 62: | ||
=== Paths === | === Paths === | ||
After making the changes section looks like this: | After making the changes section looks like this: | ||
<pre> | |||
$path_array = explode( | $path_array = explode("\\UniServer",getcwd()); // Split at folder usr | ||
$mongo_base = $path_array[0]; // find drive letter and any sub-folders | $mongo_base = $path_array[0]; // find drive letter and any sub-folders | ||
$mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | $mongo_base_f = preg_replace('/\\\/','/', $mongo_base); // Replace \ with / | ||
//=== FOLDERS === | //=== FOLDERS === | ||
define( | define("MONGO_BIN", "$mongo_base_f/UniServer/usr/local/mongo/bin"); // Binaries for MongoDB | ||
//=== FILES === | //=== FILES === | ||
define( | define("CONFIG_NO_AUTH_F", MONGO_BIN."/config_no_auth.ini"); | ||
define( | define("UNISERV_EXE", MONGO_BIN."/uniserv.exe"); // Utility | ||
define( | define("UNISERV_EXE_B", $mongo_base.'\UniServer\usr\local\mongo\bin\uniserv.exe'); // Utility | ||
define( | define("MON_PSKILL_EXE", MONGO_BIN."/pskill.exe"); // Utility | ||
</pre> | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' | ||
Line 91: | Line 90: | ||
|- | |- | ||
| | | | ||
<pre> | |||
TITLE UNIFORM SERVER - Run Command Prompt | TITLE UNIFORM SERVER - Run Command Prompt | ||
COLOR B0 | COLOR B0 | ||
Line 102: | Line 101: | ||
pause | pause | ||
EXIT | EXIT | ||
</pre> | |||
| | | | ||
'''''Comments'':''' | '''''Comments'':''' | ||
Line 121: | Line 120: | ||
|- | |- | ||
| | | | ||
<pre> | |||
<?php | |||
chdir(dirname(__FILE__)); // Change wd to this files location | chdir(dirname(__FILE__)); // Change wd to this files location | ||
include_once | include_once "../../../../unicon/tray_menu_2/mongo_db_inc.php"; | ||
open_cmd_window(); // Run command prompt function | open_cmd_window(); // Run command prompt function | ||
? | ?> | ||
</pre> | |||
| | | | ||
* Change folder to alt_control | * Change folder to alt_control | ||
Line 166: | Line 165: | ||
Create the following scripts with content as shown | Create the following scripts with content as shown | ||
=== Run_start_mongo.bat === | === Run_start_mongo.bat === | ||
<pre> | |||
TITLE UNIFORM SERVER - Run Start MongoDB | TITLE UNIFORM SERVER - Run Start MongoDB | ||
Line 178: | Line 177: | ||
pause | pause | ||
EXIT | EXIT | ||
</pre> | |||
=== run_start_mongo.php === | === run_start_mongo.php === | ||
<pre> | |||
<?php | |||
chdir(dirname(__FILE__)); // Change wd to this files location | chdir(dirname(__FILE__)); // Change wd to this files location | ||
include_once | include_once "../../../../unicon/tray_menu_2/mongo_db_inc.php"; | ||
start_mongo_no_auth(); // Run start mongo function | start_mongo_no_auth(); // Run start mongo function | ||
? | ?> | ||
</pre> | |||
=== Run_stop_mongo.bat === | === Run_stop_mongo.bat === | ||
<pre> | |||
TITLE UNIFORM SERVER - Run Stop MongoDB | TITLE UNIFORM SERVER - Run Stop MongoDB | ||
Line 202: | Line 201: | ||
pause | pause | ||
EXIT | EXIT | ||
</pre> | |||
=== run_stop_mongo.php === | === run_stop_mongo.php === | ||
<pre> | |||
<?php | |||
chdir(dirname(__FILE__)); // Change wd to this files location | chdir(dirname(__FILE__)); // Change wd to this files location | ||
include_once | include_once "../../../../unicon/tray_menu_2/mongo_db_inc.php"; | ||
stop_mongo_no_auth() ; // Run command prompt function | stop_mongo_no_auth() ; // Run command prompt function | ||
? | ?> | ||
</pre> | |||
=== Run_client.bat === | === Run_client.bat === | ||
<pre> | |||
TITLE UNIFORM SERVER - Run Mongo Client | TITLE UNIFORM SERVER - Run Mongo Client | ||
COLOR B0 | COLOR B0 | ||
Line 225: | Line 224: | ||
pause | pause | ||
EXIT | EXIT | ||
</pre> | |||
=== run_client.php === | === run_client.php === | ||
<pre> | |||
<?php | |||
chdir(dirname(__FILE__)); // Change wd to this files location | chdir(dirname(__FILE__)); // Change wd to this files location | ||
include_once | include_once "../../../../unicon/tray_menu_2/mongo_db_inc.php"; | ||
client_no_auth() ; // Run command prompt function | client_no_auth() ; // Run command prompt function | ||
? | ?> | ||
</pre> | |||
'''''[[#top | Top]]''''' | '''''[[#top | Top]]''''' |