Arquivos
Felipe N. Moura 3887f5746c changes to the help commands and how to install or uninstall the application.
Changes made on external(symfony) classes! To change the help format as needed
Fixed some typing mistakes
2012-04-07 01:19:37 -03:00

89 linhas
3.6 KiB
PHP
Arquivo Executável

#!/usr/bin/env php
<?php
/**
* This file is part of TheWebMind 3rd generation.
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
* @license licenses/mind3rd.license
*
* this file will be only accessed trhough the console
* if you pass the parameter install to it, it will
* create the SQLite database, start it, and try to
* create shortcuts, allowing the use of the comand
* mind, in your console
*/
$_MIND= Array();
$_MIND['env']= 'shell';
// checks if it has received any argument
if(sizeOf($_SERVER['argv'])>0 && isset($_SERVER['argv'][1]))
{
require('mind3rd/API/utils/constants.php');
// installation should create the required SQLite database and a shortcut command
switch($_SERVER['argv'][1])
{
case 'install':{
// first, for linux and mac computers
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
{
require('mind3rd/env/setup/UnixSetup.php');
$_MIND['sys']= 'unix';
UnixSetup::install();
}else{
require('mind3rd/env/setup/WinSetup.php');
$_MIND['sys']= 'win';
WinSetup::install();
}
exit;
break;
}
case 'uninstall':{
// only for linux and mac computers
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN'){
require('mind3rd/env/setup/UnixSetup.php');
$_MIND['sys']= 'unix';
UnixSetup::uninstall();
exit;
}else{
echo "Available only in Unix Based Systems\n";
}
break;
}
case 'remove':{
// only for linux and mac computers
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN'){
require('mind3rd/env/setup/UnixSetup.php');
$_MIND['sys']= 'unix';
UnixSetup::remove();
exit;
}
break;
}
case '--help':
case '-h':
case '?':
case 'help':{
echo "theWebMind(or just mind):\n website: http://thewebmind.org\n Twitter: @thewebmind\n Docs: http://docs.thewebmind.org\n\n";
"The list of startup commands:\n".
" install : installs the application itself\n".
" uninstall: uninstalls the application, but do NOT remove projects,\n".
" users or history\n".
" remove : installs the application AND REMOVE every data it may\n".
" have created, including ALL projects, history and users.\n".
" --help :\n";
" -h :\n";
" help :\n";
" ? :\n";
" Shows this help content.\n\n";
echo "After installing, you can open the application by calling the 'mind' command anywhere.\n".
"You will also be able to send POST requisition to mind's server address sending the command you want to execute and its parameters.\n";
exit;
}
}
}
// if not installing, it should be redirected to mind3rd/API/shell.php
$_REQ= Array();
$_REQ["env"]= "shell";
define("_MINDSRC_", dirname($_SERVER['PHP_SELF']));
include(_MINDSRC_.'/mind3rd/API/utils/utils.php');