changes to plugin classes and a few more bugs fixed
Esse commit está contido em:
@@ -144,8 +144,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads data from the passed project
|
||||
* Alias for MindProject::openProject
|
||||
* Loads data from the passed project.
|
||||
* Alias for MindProject::openProject.
|
||||
*
|
||||
* @param AssocArray $p
|
||||
* @return boolean
|
||||
|
||||
@@ -358,9 +358,10 @@ class MindCommand extends Symfony\Component\Console\Command\Command
|
||||
* each program::runAction command blocks
|
||||
*/
|
||||
public function runAction(){
|
||||
|
||||
$this->runPlugins('before');
|
||||
|
||||
// yea, I know it looks crazy!
|
||||
// yea, I know it looks a bit crazy!
|
||||
if(is_string($this->commandAction))
|
||||
$this->{$this->commandAction}();
|
||||
else
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @author felipe
|
||||
*/
|
||||
class MindPlugin
|
||||
abstract class MindPlugin
|
||||
{
|
||||
public $trigger= null;
|
||||
public $event= 'after';
|
||||
@@ -32,12 +32,16 @@
|
||||
*/
|
||||
static function addPlugin(&$plugin)
|
||||
{
|
||||
if(in_array($plugin->trigger, Mind::$triggers))
|
||||
{
|
||||
//echo $plugin->name." - ".$plugin->trigger."\n\n";
|
||||
|
||||
//print_r(Mind::$triggers);
|
||||
//if(in_array($plugin->trigger, Mind::$triggers))
|
||||
//{
|
||||
if(!isset(Mind::$pluginList[$plugin->trigger]))
|
||||
Mind::$pluginList[$plugin->trigger]= Array( 'before'=>Array(),
|
||||
'after'=>Array());
|
||||
Mind::$pluginList[$plugin->trigger][$plugin->event][]= $plugin;
|
||||
}
|
||||
//}
|
||||
//print_r(Mind::$pluginList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
class PluginOne extends MindPlugin implements plugin
|
||||
{
|
||||
/**
|
||||
* These are the properties you will have to set
|
||||
*/
|
||||
public $name= "Plugin One";
|
||||
public $version= "0.1";
|
||||
public $description = "This is a demo plugin, disabled by default";
|
||||
@@ -18,7 +21,7 @@
|
||||
// change this flag to true and execute the test program
|
||||
// to see this plugin running
|
||||
public $active= true;
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
echo "EXECUTING THE PLUGIN ONE!!!\n";
|
||||
@@ -26,7 +29,7 @@
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setTrigger('test');
|
||||
$this->setEvent('before');
|
||||
$this->setTrigger('info');
|
||||
$this->setEvent('after');
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
// change this flag to true and execute the test program
|
||||
// to see this plugin running
|
||||
public $active= true;
|
||||
public $active= false;
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
||||
@@ -42,6 +42,15 @@ EOT
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function projectExists($projectName)
|
||||
{
|
||||
$db= new MindDB();
|
||||
$data= $db->query("SELECT count(1) as count
|
||||
from project
|
||||
where name='".$projectName."'");
|
||||
return $data[0]['count'];
|
||||
}
|
||||
|
||||
public function action()
|
||||
{
|
||||
GLOBAL $_MIND;
|
||||
@@ -53,7 +62,7 @@ EOT
|
||||
$this->projectFileName= urlencode($this->argName);
|
||||
$this->projectfile= Mind::$projectsDir.$this->projectFileName;
|
||||
|
||||
if(file_exists($this->projectfile))
|
||||
if($this->projectExists($this->argName))
|
||||
{
|
||||
Mind::write('projectAlreadyExists', true, $this->argName);
|
||||
return false;
|
||||
@@ -124,25 +133,28 @@ EOT
|
||||
$db->execute($qr_vsProj);
|
||||
$db->execute("COMMIT");
|
||||
|
||||
Mind::copyDir(Mind::$modelsDir.'mind/', $this->projectfile);
|
||||
chmod($this->projectfile, 0777);
|
||||
|
||||
Mind::write('projectCreated', true, $this->argName);
|
||||
|
||||
$ini= file_get_contents($iniSource);
|
||||
$ini= str_replace('<idiom>',
|
||||
$cP['default_human_language'],
|
||||
$ini);
|
||||
$ini= str_replace('<technology>',
|
||||
$cP['default_machine_language'],
|
||||
$ini);
|
||||
$ini= str_replace('<dbms>',
|
||||
$cP['default_dbms'],
|
||||
$ini);
|
||||
file_put_contents(Mind::$projectsDir.
|
||||
$this->argName.
|
||||
'/mind.ini',
|
||||
$ini);
|
||||
if(!file_exists($this->projectfile) && !file_exists($iniSource))
|
||||
{
|
||||
Mind::copyDir(Mind::$modelsDir.'mind/', $this->projectfile);
|
||||
chmod($this->projectfile, 0777);
|
||||
|
||||
Mind::write('projectCreated', true, $this->argName);
|
||||
|
||||
$ini= file_get_contents($iniSource);
|
||||
$ini= str_replace('<idiom>',
|
||||
$cP['default_human_language'],
|
||||
$ini);
|
||||
$ini= str_replace('<technology>',
|
||||
$cP['default_machine_language'],
|
||||
$ini);
|
||||
$ini= str_replace('<dbms>',
|
||||
$cP['default_dbms'],
|
||||
$ini);
|
||||
file_put_contents(Mind::$projectsDir.
|
||||
$this->argName.
|
||||
'/mind.ini',
|
||||
$ini);
|
||||
}
|
||||
|
||||
Mind::openProject(Array('pk_project'=>$key,
|
||||
'name'=>$this->argName));
|
||||
|
||||
@@ -49,6 +49,8 @@ EOT
|
||||
ob_flush();
|
||||
echo shell_exec($_MIND->conf['phpunit-src']." "._MINDSRC_."/Tests/");
|
||||
}
|
||||
ob_end_flush();
|
||||
return true;
|
||||
}
|
||||
|
||||
private function runStep1()
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
*/
|
||||
$this->setCommandName('modeloteste')
|
||||
->setDescription("This is a model command, only")
|
||||
//->setFileName('modeloTeste') // use this if your class has NOT the same name as its file
|
||||
->setRestrict(false)
|
||||
->setHelp("A longer text, explaining the command")
|
||||
->setAction(function($class){
|
||||
|
||||
externo
+5
@@ -65,6 +65,11 @@ abstract class Setup {
|
||||
}
|
||||
}
|
||||
|
||||
public static function databaseAlreadyExists()
|
||||
{
|
||||
return file_exists('mind3rd/SQLite/mind');
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies the system requirements.
|
||||
*
|
||||
|
||||
+25
-3
@@ -21,11 +21,13 @@
|
||||
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$phpVsOk)? 'o':'f').".png' /> PHP 5.3+<br/>";
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$sqliteOk)? 'o':'f').".png' /> SQLite3 support<br/>";
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$readLlineOk)? 'o':'w').".png' /> ReadLine";
|
||||
|
||||
/*
|
||||
if(!Setup::$readLlineOk)
|
||||
{
|
||||
if(Setup::getSO() != 'WIN')
|
||||
{
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$readLlineOk)? 'o':'w').".png' /> ReadLine";
|
||||
$tip= "If you will not use the application through command line, but only via HTTP<br/>";
|
||||
$tip.= "this lib is not required. Once the application is installed you can access it using the HTTP protocol";
|
||||
echo "<div style='background-color:yellow;border:solid 1px brown'>$tip</div>";
|
||||
@@ -33,11 +35,18 @@
|
||||
echo "<br/>Sorry. Windows does not support the readline library to be used through command line.";
|
||||
echo "<br/>Although, you can use it via HTTP in your browser.";
|
||||
}
|
||||
}
|
||||
}*/
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$projectsDir)? 'o':'w').".png' /> Write permissions in '".getcwd()."/mind3rd/projects/' to the user '".trim(shell_exec('whoami'))."'<br/>";
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$sqliteDir)? 'o':'f').".png' /> Write permissions in '".getcwd()."/mind3rd/SQLite/' to the user '".trim(shell_exec('whoami'))."'<br/>";
|
||||
echo "<p><img src='docs/ide/images/".((Setup::$apiDir)? 'o':'f').".png' /> Write permissions in '".getcwd()."/mind3rd/API/' to the user '".trim(shell_exec('whoami'))."'<br/>";
|
||||
|
||||
if(Setup::databaseAlreadyExists())
|
||||
{
|
||||
echo "<p><img src='docs/ide/images/w.png' /> Database already exists! It will *NOT* be replaced or even touched.<br/>
|
||||
If you are trying to reinstall the system, consider removing the file <br/><i>mind3rd/SQLite/mind</i>(the database itself...all the old projects will be lost, them) and then
|
||||
try to re-installing the application.<br/><br/>";
|
||||
}
|
||||
|
||||
echo "<input type='button'
|
||||
value='Verify again'
|
||||
onclick='self.location.href=self.location.href' />";
|
||||
@@ -46,4 +55,17 @@
|
||||
echo "<input type='button'
|
||||
value='Install'
|
||||
onclick='self.location.href=self.location.href+\"?setupGo=true\"' />";
|
||||
}
|
||||
}
|
||||
echo "<hr/>";
|
||||
if(Setup::getSO() == 'WIN')
|
||||
{
|
||||
echo "NOTE: In windows, the system works only via HTTP, not accepting commands from
|
||||
command line/console.";
|
||||
}else{
|
||||
echo "NOTE: Installing using this interface, you will be able to access the system
|
||||
only via HTTP or, using command line straight from the directory where
|
||||
the system is and then, running <i>mind</i>.
|
||||
If you want to use the program simply typing <i>mind</i> from any directory in your console,
|
||||
you can perform this installation from your console typing, in the mind3rd's directory:<br/>
|
||||
<i>sudo php mind install</i>";
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário