Procházet zdrojové kódy

Ajusting core modules

ahwelp před 3 roky
rodič
revize
a98e31ba9f

+ 5 - 7
app/core/generator/GeneratorController.php

@@ -15,8 +15,7 @@ class GeneratorController {
             <?php
 
             use Schema\Wrapper as Wrapper;
-            use \App\Core\Sanity\MigratorController as Migrator;
-            
+
             function {{PLUGIN_NAME}}_upgrade(\$pluginversion) {
                 if (\$pluginversion < "0.0.1") {
                     \$table = Wrapper::get_table("{{PLUGIN_NAME}}");
@@ -27,20 +26,20 @@ class GeneratorController {
                     \$table->addSoftDelete();
                     \$table->create();
         
-                    Migrator::getInstance()->update_plugin_version("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}", "1.0.0");
+                    Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.0");
                     return;
                 }
             
                 //if (\$pluginversion < "0.0.2") {
                     //\$table = Wrapper::get_table("{{PLUGIN_NAME}}");
-                    //Migrator::getInstance()->update_plugin_version("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}", "1.0.1");
+                    //Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.1");
                     //return;
                 //}
             }
             
             function {{PLUGIN_NAME}}_rollback(\$pluginversion) {
                 if(\$pluginversion > "0.0.1"){
-                    \$table = Wrapper::get_table("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}");
+                    \$table = Wrapper::get_table("{{PLUGIN_NAME}}");
                     \$table->drop();
                     return;
                 }
@@ -285,8 +284,7 @@ class GeneratorController {
         file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/en.php",           $this->langBase);
         file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/".APP_LANG.".php", $this->langBase);
         
-        $this->migrationBase = str_replace("{{PLUGIN_NAME}}",     $plugin_name,   $this->migrationBase);
-        $this->migrationBase = str_replace("{{SUB_PLUGIN_NAME}}", $subname,       $this->migrationBase);
+        $this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name,   $this->migrationBase);
         file_put_contents(DIR_APP.$subname . "/" . $name . "/db/Migrate.php", $this->migrationBase);
         
         $this->routeBase = str_replace("{{NAMESPACE}}",   $namespace,     $this->routeBase);

+ 0 - 5
app/core/lang/en.php

@@ -1,5 +0,0 @@
-<?php
-
-$lang['generator']['module_name'] = 'generator';
-
-$lang['generator']['main_title'] = 'Module Generator';

+ 0 - 7
app/core/lang/pt_br.php

@@ -1,7 +0,0 @@
-<?php
-
-$lang['generator']['module_name'] = 'wellcome';
-
-$lang['generator']['main_title'] = 'Gerador de modulos!';
-
-

+ 7 - 19
app/core/sanity/MigratorController.php

@@ -99,7 +99,7 @@ class MigratorController {
         $rdi = new \RecursiveDirectoryIterator(DIR_APP);
 
         foreach (new \RecursiveIteratorIterator($rdi) as $file) {
-            if (strpos($file, 'version.php')) {
+            if (strpos($file, 'version.php') && ! strpos($file, '.versi') ) {
                 $module_configs[] = str_replace('version.php', '', $file);
             }
         }
@@ -150,21 +150,12 @@ class MigratorController {
 
     public function execute_plan() {
         $status = false;
+
         while (!$status) {
             $this->sort_plugins();
             $status = true;
 
             foreach ($this->install as $key => $item) {
-                /*
-                 * 
-                 *                 
-                 * 
-                 */
-                
-                $funname = explode('_', $item->name);
-                if(sizeof($funname) > 1){ unset($funname[0]); }
-                $funname = implode('_', $funname);
-                
                 if (isset($item->require)) {
                     if (!self::is_satisfy_array($item->require)) {
                         $status = false;
@@ -172,22 +163,19 @@ class MigratorController {
                     }
                 }
                 if (!self::is_satisfy($item->name, $item->version)) {
-                    if (!function_exists($funname . '_upgrade')) {
-                        echo 'adsdsadasdsadassad';
+                    if (!function_exists($item->name . '_upgrade')) {
                         $this->update_plugin_version($item->name, $item->version);
                         $this->upgrade[] = $item;
-                        $this->instaled[$item->name] = $item;
                         unset($this->install[$key]);
                         continue;
                     }
-                    $this->instaled[$item->name] = $item;
-                    call_user_func($funname . '_upgrade', '0');
+                    call_user_func($item->name . '_upgrade', "0.0.0");
                     $this->upgrade[] = $this->instaled[$item->name];
                     unset($this->install[$key]);
                     $status = false;
                 }
             }
-            
+
             foreach ($this->upgrade as $item) {
                 if (isset($item->require)) {
                     if (!self::is_satisfy_array($item->require)) {
@@ -195,12 +183,12 @@ class MigratorController {
                         continue;
                     }
                 }
-                if (!self::is_satisfy($funname, $item->version)) {
+                if (!self::is_satisfy($item->name, $item->version)) {
                     if (!function_exists($item->name . '_upgrade')) {
                         $this->update_plugin_version($item->name, $item->version);
                         continue;
                     }
-                    call_user_func($funname . '_upgrade', $this->instaled[$item->name]->version);
+                    call_user_func($item->name . '_upgrade', $this->instaled[$item->name]->version);
                     $status = false;
                 }
             }