added the cache control for analyzed projects
@@ -25,4 +25,6 @@ mind3rd/API/temp/*
|
|||||||
*.*~
|
*.*~
|
||||||
.project
|
.project
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
./nbproject
|
||||||
nbproject
|
nbproject
|
||||||
|
nbproject/*
|
||||||
|
|||||||
|
Antes Largura: | Altura: | Tamanho: 144 KiB Depois Largura: | Altura: | Tamanho: 144 KiB |
|
Antes Largura: | Altura: | Tamanho: 34 KiB Depois Largura: | Altura: | Tamanho: 34 KiB |
|
Antes Largura: | Altura: | Tamanho: 22 KiB Depois Largura: | Altura: | Tamanho: 22 KiB |
|
Antes Largura: | Altura: | Tamanho: 133 KiB Depois Largura: | Altura: | Tamanho: 133 KiB |
|
Antes Largura: | Altura: | Tamanho: 159 KiB Depois Largura: | Altura: | Tamanho: 159 KiB |
|
Antes Largura: | Altura: | Tamanho: 106 KiB Depois Largura: | Altura: | Tamanho: 106 KiB |
|
Antes Largura: | Altura: | Tamanho: 36 KiB Depois Largura: | Altura: | Tamanho: 36 KiB |
|
Antes Largura: | Altura: | Tamanho: 40 KiB Depois Largura: | Altura: | Tamanho: 40 KiB |
|
Antes Largura: | Altura: | Tamanho: 204 KiB Depois Largura: | Altura: | Tamanho: 204 KiB |
@@ -33,6 +33,7 @@ class En {
|
|||||||
$this->messages['no_such_file'] = Mind::message("\nMain: No such command '%s'", "[Fail]", false);
|
$this->messages['no_such_file'] = Mind::message("\nMain: No such command '%s'", "[Fail]", false);
|
||||||
$this->messages['auth_fail'] = Mind::message("\nAuth: Wrong user or password", "[Fail]", false);
|
$this->messages['auth_fail'] = Mind::message("\nAuth: Wrong user or password", "[Fail]", false);
|
||||||
$this->messages['bye'] = "Logging out...\n";
|
$this->messages['bye'] = "Logging out...\n";
|
||||||
|
$this->messages['thinking'] = "Please wait while I'm thinking...\n";
|
||||||
$this->messages['invalidCreateParams'] = Mind::message("Main: Invalid parameters", "[Fail]", false);
|
$this->messages['invalidCreateParams'] = Mind::message("Main: Invalid parameters", "[Fail]", false);
|
||||||
$this->messages['invalidOption'] = Mind::message("Invalid option '%s'", '[Fail]', false);
|
$this->messages['invalidOption'] = Mind::message("Invalid option '%s'", '[Fail]', false);
|
||||||
$this->messages['projectAlreadyExists'] = Mind::message("There is, already, another project with the same name", '[Fail]', false);
|
$this->messages['projectAlreadyExists'] = Mind::message("There is, already, another project with the same name", '[Fail]', false);
|
||||||
@@ -43,6 +44,8 @@ class En {
|
|||||||
$this->messages['currentProjectRequired'] = Mind::message("You must open a project first", '[Fail]', false);
|
$this->messages['currentProjectRequired'] = Mind::message("You must open a project first", '[Fail]', false);
|
||||||
$this->messages['sourceFileNotFound'] = Mind::message("The source '%s' was not found for the current project.", '[Fail]', false);
|
$this->messages['sourceFileNotFound'] = Mind::message("The source '%s' was not found for the current project.", '[Fail]', false);
|
||||||
$this->messages['currentProjectRequiredTip']= "You can use the command\n use project <projectName>\n";
|
$this->messages['currentProjectRequiredTip']= "You can use the command\n use project <projectName>\n";
|
||||||
|
$this->messages['analyseFirst'] = "You will need to analyze the project. It has not been analyzed yet.Execute the 'analyze' command.\n";
|
||||||
|
$this->messages['permissionDenied'] = Mind::message("Permission denied to change/create/delete files.\nPlease, allow the system to change files in mind's root directory", '[Fail]', false);;
|
||||||
|
|
||||||
$this->messages['http_invalid_requisition'] = <<<MESSAGE
|
$this->messages['http_invalid_requisition'] = <<<MESSAGE
|
||||||
Invalid HTTP requisition.
|
Invalid HTTP requisition.
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class pt {
|
|||||||
$this->messages['no_such_file'] = Mind::message("\nMain: Não conheço tal comando: '%s'", "[Fail]", false);
|
$this->messages['no_such_file'] = Mind::message("\nMain: Não conheço tal comando: '%s'", "[Fail]", false);
|
||||||
$this->messages['auth_fail'] = Mind::message("\nAuth: Usuário ou senha inválidos", "[Fail]", false);
|
$this->messages['auth_fail'] = Mind::message("\nAuth: Usuário ou senha inválidos", "[Fail]", false);
|
||||||
$this->messages['bye'] = "Saindo, até logo...\n";
|
$this->messages['bye'] = "Saindo, até logo...\n";
|
||||||
|
$this->messages['thinking'] = "Por favor aguarde, enquanto eu penso...\n";
|
||||||
$this->messages['invalidCreateParams'] = Mind::message("Main: Parâmetros inválidos", "[Fail]", false);
|
$this->messages['invalidCreateParams'] = Mind::message("Main: Parâmetros inválidos", "[Fail]", false);
|
||||||
$this->messages['invalidOption'] = Mind::message("Opção inválida '%s'", '[Fail]', false);
|
$this->messages['invalidOption'] = Mind::message("Opção inválida '%s'", '[Fail]', false);
|
||||||
$this->messages['projectAlreadyExists'] = Mind::message("Lamento mas já existe um projeto de mesmo nome.", '[Fail]', false);
|
$this->messages['projectAlreadyExists'] = Mind::message("Lamento mas já existe um projeto de mesmo nome.", '[Fail]', false);
|
||||||
@@ -49,7 +50,9 @@ class pt {
|
|||||||
$this->messages['projectOpened'] = Mind::message("Acessando projeto '%s'", '[Ok]', false);
|
$this->messages['projectOpened'] = Mind::message("Acessando projeto '%s'", '[Ok]', false);
|
||||||
$this->messages['currentProjectRequired'] = Mind::message("Primeiro você precisará abrir um projeto.", '[Fail]', false);
|
$this->messages['currentProjectRequired'] = Mind::message("Primeiro você precisará abrir um projeto.", '[Fail]', false);
|
||||||
$this->messages['currentProjectRequiredTip']= "Tente com o comando\n use project <projectName>\n";
|
$this->messages['currentProjectRequiredTip']= "Tente com o comando\n use project <projectName>\n";
|
||||||
|
$this->messages['analyseFirst'] = "Você precisará analisar o projeto, primeiro. O projeto ainda não foi analizado. Execute o comando 'analyze'.\n";
|
||||||
$this->messages['sourceFileNotFound'] = Mind::message("O arquivo fonte '%s' não foi encontrado para o projeto atual.", '[Fail]', false);
|
$this->messages['sourceFileNotFound'] = Mind::message("O arquivo fonte '%s' não foi encontrado para o projeto atual.", '[Fail]', false);
|
||||||
|
$this->messages['permissionDenied'] = Mind::message("Permissão negada pra acessar, criar, alterar ou excluir um arquivo.\nPor favor, libere acesso ao sistema para o diretório raíz do Mind.\n", '[Fail]', false);
|
||||||
|
|
||||||
$this->messages['http_invalid_requisition'] = <<<MESSAGE
|
$this->messages['http_invalid_requisition'] = <<<MESSAGE
|
||||||
Requisição HTTP inválida.
|
Requisição HTTP inválida.
|
||||||
|
|||||||
@@ -75,7 +75,26 @@ class MindProject extends VersionManager{
|
|||||||
Mind::$currentProject= $p;
|
Mind::$currentProject= $p;
|
||||||
Mind::$curLang= Mind::$currentProject['idiom'];
|
Mind::$curLang= Mind::$currentProject['idiom'];
|
||||||
Mind::$content= '';
|
Mind::$content= '';
|
||||||
//Mind::$
|
|
||||||
|
// loading entities and relations from cache
|
||||||
|
$path= Mind::$currentProject['path']."/temp/";
|
||||||
|
$entities= $path."entities~";
|
||||||
|
$relations= $path."relations~";
|
||||||
|
if(file_exists($entities) && $f= fopen($entities, 'r'))
|
||||||
|
{
|
||||||
|
while (($buffer = fgets($f, 51200)) !== false)
|
||||||
|
{
|
||||||
|
if($tmpObj= @unserialize($buffer))
|
||||||
|
Analyst::$entities[$tmpObj->name]= $tmpObj;
|
||||||
|
}
|
||||||
|
$f= fopen($relations, 'r');
|
||||||
|
while (($buffer = fgets($f, 51200)) !== false)
|
||||||
|
{
|
||||||
|
if($tmpObj= @unserialize($buffer))
|
||||||
|
Analyst::$relations[$tmpObj->name]= $tmpObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mind::write('projectOpened', true, $p['name']);
|
Mind::write('projectOpened', true, $p['name']);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -113,6 +132,7 @@ class MindProject extends VersionManager{
|
|||||||
|
|
||||||
public static function setUp()
|
public static function setUp()
|
||||||
{
|
{
|
||||||
|
parent::setUp();
|
||||||
self::$sourceContent= false;
|
self::$sourceContent= false;
|
||||||
self::$currentSource= null;
|
self::$currentSource= null;
|
||||||
self::$sourceContent= Array();
|
self::$sourceContent= Array();
|
||||||
@@ -160,6 +180,8 @@ class MindProject extends VersionManager{
|
|||||||
"s\n";
|
"s\n";
|
||||||
$memory= ((memory_get_usage() / 1024)/1024);
|
$memory= ((memory_get_usage() / 1024)/1024);
|
||||||
$memory= number_format($memory, 2);
|
$memory= number_format($memory, 2);
|
||||||
echo $memory."MBs\n";
|
echo "Memory: ".$memory."MBs\n";
|
||||||
|
|
||||||
|
self::cleanUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,4 +11,40 @@
|
|||||||
// situation of the current project
|
// situation of the current project
|
||||||
echo "COMMITING";
|
echo "COMMITING";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function cleanUp()
|
||||||
|
{
|
||||||
|
$path= Mind::$currentProject['path']."/temp/";
|
||||||
|
$entities= $path."entities~";
|
||||||
|
$relations= $path."relations~";
|
||||||
|
|
||||||
|
$fEnt= fopen($entities, "w+");
|
||||||
|
$fRel= fopen($relations, "w+");
|
||||||
|
if(!$fEnt)
|
||||||
|
{
|
||||||
|
Mind::write('permissionDenied');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ftruncate($fEnt, 0);
|
||||||
|
ftruncate($fRel, 0);
|
||||||
|
@chmod($entities, 0777);
|
||||||
|
@chmod($relations, 0777);
|
||||||
|
|
||||||
|
|
||||||
|
foreach(Analyst::$entities as &$entity)
|
||||||
|
{
|
||||||
|
file_put_contents($entities, serialize($entity)."\n", FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(Analyst::$relations as &$relation)
|
||||||
|
{
|
||||||
|
file_put_contents($relations, serialize($relation)."\n", FILE_APPEND);
|
||||||
|
}
|
||||||
|
fclose($fEnt);
|
||||||
|
fclose($fRel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,8 @@ class Analyst extends Analysis {
|
|||||||
public static function getUniverse()
|
public static function getUniverse()
|
||||||
{
|
{
|
||||||
return Array(
|
return Array(
|
||||||
'entities'=>self::$entities,
|
'entities'=>&self::$entities,
|
||||||
'relations'=>self::$relations
|
'relations'=>&self::$relations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,64 +84,81 @@ class Analyst extends Analysis {
|
|||||||
* Prints out the analyzed content
|
* Prints out the analyzed content
|
||||||
* @param boolean $detailed Pass true if it should show detailed
|
* @param boolean $detailed Pass true if it should show detailed
|
||||||
* information about the entities and properties.
|
* information about the entities and properties.
|
||||||
|
* @param boolean $showEntities=true
|
||||||
|
* @param boolean $showRelations=true
|
||||||
*/
|
*/
|
||||||
public static function printWhatYouGet($detailed=true)
|
public static function printWhatYouGet($detailed=true,
|
||||||
|
$showEntities=true,
|
||||||
|
$showRelations=true)
|
||||||
{
|
{
|
||||||
$props= 0;
|
$props= 0;
|
||||||
echo "ENTITIES: ".sizeof(self::$entities)."\n";
|
if($showEntities)
|
||||||
foreach(self::$entities as $k=>$entity)
|
|
||||||
{
|
{
|
||||||
if($detailed)
|
echo "ENTITIES: ".sizeof(self::$entities)."\n";
|
||||||
|
foreach(self::$entities as $k=>$entity)
|
||||||
{
|
{
|
||||||
echo " ".$entity->name.
|
if(!$detailed)
|
||||||
"\n";
|
|
||||||
//echo "[".$k."]\n";
|
|
||||||
}
|
|
||||||
foreach($entity->properties as $prop)
|
|
||||||
{
|
|
||||||
$details= false;
|
|
||||||
$details= Array();
|
|
||||||
if($prop->size)
|
|
||||||
$details[]= $prop->size;
|
|
||||||
if($prop->uinque)
|
|
||||||
$details[]= "unique";
|
|
||||||
if($prop->key)
|
|
||||||
$details[]= "key";
|
|
||||||
if($prop->required)
|
|
||||||
$details[]= "not null";
|
|
||||||
if(!is_null($prop->default) && trim($prop->default) != '')
|
|
||||||
$details[]= ($prop->default!= AUTOINCREMENT_DEFVAL)?
|
|
||||||
'"'.$prop->default.'"':
|
|
||||||
"AUTO_INCREMENT";
|
|
||||||
if(sizeof($prop->options) > 0)
|
|
||||||
{
|
{
|
||||||
$details[]= "{".implode("|", array_keys($prop->default))."}";
|
echo " ".$entity->name.
|
||||||
}
|
"\n";
|
||||||
|
}else{
|
||||||
$props++;
|
echo " ".$entity->name.
|
||||||
echo " ".$prop->name.
|
"\n";
|
||||||
":".$prop->type.
|
foreach($entity->properties as $prop)
|
||||||
"(".
|
{
|
||||||
implode(", ", $details).
|
$details= false;
|
||||||
")".
|
$details= Array();
|
||||||
($prop->refTo? " => ".$prop->refTo->name: "").
|
if($prop->size)
|
||||||
"\n";
|
$details[]= $prop->size;
|
||||||
|
if($prop->uinque)
|
||||||
|
$details[]= "unique";
|
||||||
|
if($prop->key)
|
||||||
|
$details[]= "key";
|
||||||
|
if($prop->required)
|
||||||
|
$details[]= "not null";
|
||||||
|
if(!is_null($prop->default) && trim($prop->default) != '')
|
||||||
|
$details[]= ($prop->default!= AUTOINCREMENT_DEFVAL)?
|
||||||
|
'"'.$prop->default.'"':
|
||||||
|
"AUTO_INCREMENT";
|
||||||
|
if(sizeof($prop->options) > 0)
|
||||||
|
{
|
||||||
|
$opts= "{".implode("|", array_keys($prop->default))."}";
|
||||||
|
$details[]= $opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
$props++;
|
||||||
|
echo " ".$prop->name.
|
||||||
|
":".$prop->type.
|
||||||
|
"(".
|
||||||
|
implode(", ", $details).
|
||||||
|
")".
|
||||||
|
($prop->refTo? " => ".$prop->refTo->name: "").
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if($detailed)
|
||||||
|
echo "PROPERTIES: ".$props."\n";
|
||||||
}
|
}
|
||||||
echo "RELATIONS:".sizeof(self::$relations)."\n";
|
if($showRelations)
|
||||||
foreach(self::$relations as $k=>$rel)
|
|
||||||
{
|
{
|
||||||
if(!$rel)
|
echo "RELATIONS:".sizeof(self::$relations)."\n";
|
||||||
continue;
|
foreach(self::$relations as $k=>$rel)
|
||||||
echo " ".
|
{
|
||||||
$k.': '.
|
if(!$rel)
|
||||||
$rel->rel->name.' -> '.
|
continue;
|
||||||
$rel->focus->name.
|
echo " ".$rel->name;
|
||||||
($rel->uniqueRef? "[pk]": "").
|
if($detailed)
|
||||||
"\n";
|
{
|
||||||
|
echo ': '.
|
||||||
|
$rel->rel->name.' -> '.
|
||||||
|
$rel->focus->name.
|
||||||
|
($rel->uniqueRef? "[pk]": "").
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "Relations: ".sizeof(self::$relations)."\n";
|
||||||
}
|
}
|
||||||
echo "Properties: ".$props."\n";
|
|
||||||
echo "Relations: ".sizeof(self::$relations)."\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ EOT
|
|||||||
return false;
|
return false;
|
||||||
$this->nameSpace= $input->getArgument('namespace');
|
$this->nameSpace= $input->getArgument('namespace');
|
||||||
$this->autoCommit= $input->getOption('commit');
|
$this->autoCommit= $input->getOption('commit');
|
||||||
|
Mind::write('thinking');
|
||||||
$this->runAction();
|
$this->runAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ EOT
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mind::copyDir(Mind::$modelsDir.'mind/', $this->projectfile);
|
Mind::copyDir(Mind::$modelsDir.'mind/', $this->projectfile);
|
||||||
|
chmod($this->projectfile, 0777);
|
||||||
|
|
||||||
$db= new MindDB();
|
$db= new MindDB();
|
||||||
$qr_newProj= "INSERT into project
|
$qr_newProj= "INSERT into project
|
||||||
|
|||||||
@@ -78,6 +78,30 @@ EOT
|
|||||||
$this->printMatrix($userList);
|
$this->printMatrix($userList);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'entities':
|
||||||
|
$entities= Analyst::getUniverse();
|
||||||
|
$entities= $entities['entities'];
|
||||||
|
if(sizeof($entities) >0)
|
||||||
|
if($this->detailed)
|
||||||
|
Analyst::printWhatYouGet(true, true, false);
|
||||||
|
else
|
||||||
|
echo " ".implode("\n ", array_keys($entities));
|
||||||
|
else
|
||||||
|
echo " No entities to show";
|
||||||
|
echo "\n";
|
||||||
|
break;
|
||||||
|
case 'relations':
|
||||||
|
$relations= Analyst::getUniverse();
|
||||||
|
$relations= $relations['relations'];
|
||||||
|
if(sizeof($relations) >0)
|
||||||
|
if($this->detailed)
|
||||||
|
Analyst::printWhatYouGet(true, false, true);
|
||||||
|
else
|
||||||
|
echo " ".implode("\n ", array_keys($relations));
|
||||||
|
else
|
||||||
|
echo " No relations to show";
|
||||||
|
echo "\n";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Mind::write('invalidOption', true, $this->whatToShow);
|
Mind::write('invalidOption', true, $this->whatToShow);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||