added uninstall and remove commands

Esse commit está contido em:
Felipe N. Moura
2012-04-06 14:23:21 -03:00
commit 99bdfaca39
87 arquivos alterados com 127 adições e 20 exclusões
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 260 B

Depois

Largura:  |  Altura:  |  Tamanho: 260 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 260 B

Depois

Largura:  |  Altura:  |  Tamanho: 260 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 251 B

Depois

Largura:  |  Altura:  |  Tamanho: 251 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 251 B

Depois

Largura:  |  Altura:  |  Tamanho: 251 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 209 B

Depois

Largura:  |  Altura:  |  Tamanho: 209 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 209 B

Depois

Largura:  |  Altura:  |  Tamanho: 209 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 104 B

Depois

Largura:  |  Altura:  |  Tamanho: 104 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 104 B

Depois

Largura:  |  Altura:  |  Tamanho: 104 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 125 B

Depois

Largura:  |  Altura:  |  Tamanho: 125 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 125 B

Depois

Largura:  |  Altura:  |  Tamanho: 125 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 105 B

Depois

Largura:  |  Altura:  |  Tamanho: 105 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 105 B

Depois

Largura:  |  Altura:  |  Tamanho: 105 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 90 B

Depois

Largura:  |  Altura:  |  Tamanho: 90 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 90 B

Depois

Largura:  |  Altura:  |  Tamanho: 90 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 129 B

Depois

Largura:  |  Altura:  |  Tamanho: 129 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 129 B

Depois

Largura:  |  Altura:  |  Tamanho: 129 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

externo Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
externo Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 260 B

Depois

Largura:  |  Altura:  |  Tamanho: 260 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 260 B

Depois

Largura:  |  Altura:  |  Tamanho: 260 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 251 B

Depois

Largura:  |  Altura:  |  Tamanho: 251 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 251 B

Depois

Largura:  |  Altura:  |  Tamanho: 251 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 209 B

Depois

Largura:  |  Altura:  |  Tamanho: 209 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 209 B

Depois

Largura:  |  Altura:  |  Tamanho: 209 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 104 B

Depois

Largura:  |  Altura:  |  Tamanho: 104 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 104 B

Depois

Largura:  |  Altura:  |  Tamanho: 104 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 125 B

Depois

Largura:  |  Altura:  |  Tamanho: 125 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 125 B

Depois

Largura:  |  Altura:  |  Tamanho: 125 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 105 B

Depois

Largura:  |  Altura:  |  Tamanho: 105 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 105 B

Depois

Largura:  |  Altura:  |  Tamanho: 105 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 3.7 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 90 B

Depois

Largura:  |  Altura:  |  Tamanho: 90 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 90 B

Depois

Largura:  |  Altura:  |  Tamanho: 90 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 129 B

Depois

Largura:  |  Altura:  |  Tamanho: 129 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 129 B

Depois

Largura:  |  Altura:  |  Tamanho: 129 B

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 5.2 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Ver Arquivo

Antes

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 4.3 KiB

externo Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
externo Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
+27 -1
Ver Arquivo
@@ -19,9 +19,11 @@
// 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
if($_SERVER['argv'][1] == 'install')
switch($_SERVER['argv'][1])
{
case 'install':{
// first, for linux and mac computers
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
{
@@ -34,6 +36,30 @@
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;
}
}
}
// if not installing, it should be redirected to mind3rd/API/shell.php
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
Arquivo normal → Arquivo executável
Ver Arquivo
+2
Ver Arquivo
@@ -31,6 +31,8 @@
// addresses
define('PROJECTS_DIR', '/mind3rd/projects/');
define('KNOWLEDGE_BASE', 'mind3rd/SQLite/mind');
define('KNOWLEDGE_DDL', 'mind3rd/SQLite/ddl.sql');
define('MODELS_DIR', '/mind3rd/API/models/');
define('ABOUT_INI', '/mind3rd/env/about.ini');
define('DEFAULTS_INI', '/mind3rd/env/defaults.ini');
Arquivo normal → Arquivo executável
Ver Arquivo
+33 -4
Ver Arquivo
@@ -68,7 +68,7 @@ abstract class Setup {
public static function databaseAlreadyExists()
{
return file_exists('mind3rd/SQLite/mind');
return file_exists(\KNOWLEDGE_BASE);
}
/**
@@ -135,8 +135,37 @@ abstract class Setup {
return self::$installationOk= $phpVsOk && $sqliteOk && $projectsDir && $sqliteDir && $apiDir;
}
/**
* Return true if mind was already installed in this server.
*
* @return boolean
*/
public static function isInstalled(){
return file_exists('mind3rd/SQLite/mind');
return file_exists(\KNOWLEDGE_BASE);
}
/**
* Tries to remove completely the database.
*
* This method has NO ROLLBACK and should be called with parsimony.
*
* @return boolean
*/
public static function removeDataBase(){
return unlink(\KNOWLEDGE_BASE);
}
/**
* Tries to remove all the created projects.
*
* This method has NO ROLLBACK and should be called with parsimony.
*
* @return boolean
*/
public static function clearProjects(){
if($ret = shell_exec("sudo rm -rf ".'.'.\PROJECTS_DIR) == '')
return mkdir('.'.\PROJECTS_DIR);
return false;
}
/**
@@ -151,8 +180,8 @@ abstract class Setup {
GLOBAL $_MIND;
echo " creating database...\n";
$sqlite= class_exists('SQLite3')? 'SQLite3': 'SQLiteDatabase';
$sqliteDDLFile= 'mind3rd/SQLite/ddl.sql';
$sqliteBaseFile= 'mind3rd/SQLite/mind';
$sqliteDDLFile= \KNOWLEDGE_DDL;
$sqliteBaseFile= \KNOWLEDGE_BASE;
if(file_exists($sqliteBaseFile))
{
+51 -1
Ver Arquivo
@@ -50,10 +50,60 @@ class UnixSetup extends Setup{
echo shell_exec("sudo echo '".self::$content."' >>".
"/bin/mind;");
echo " setting permissions...\n";
echo shell_exec("sudo chmod 777 /bin/mind");
echo shell_exec("sudo chmod +x /bin/mind");
return true;
}
/**
* Remove the executable file in Unix Bases OSs.
*
* This method will *NOT* drop database or remove project's files.
* The user must use it with sudo privilegies.
*/
public static function uninstall($rem){
if(self::isInstalled()){
if($ret = shell_exec("sudo rm /bin/mind") == ''){
if(!$rem){
echo "Mind was successfully uninstalled.\n";
echo "Please note that the database of project's folders weren't removed!\nIf you want to remove them, execute\n sudo ./mind remove\n";
}
}else{
echo $ret;
return false;
}
}else{
echo "No previous installed version detected!\n";
}
return true;
}
public static function remove(){
$fp = fopen('php://stdin', 'r');
echo "Are you sure you want to uninstall mind and ALSO REMOVE ITS DATA?\n";
echo " *** By duing so, you will loose all projects, users and history ***\n [yes/no]: ";
$answer = trim(fgets($fp, 1024));
if($answer != 'yes'){
echo "Not removed\n";
return false;
}
if(self::isInstalled()){
if(self::uninstall(true)){
self::removeDataBase();
self::clearProjects();
}else{
echo "Failed trying to uninstall!";;
return false;
}
}else{
echo "No previous installed version detected!\n";
}
return true;
}
/**
* Installs the program to be used in command line
* or http.
externo Arquivo normal → Arquivo executável
Ver Arquivo
Ver Arquivo