/** * Sets vars by grabbing Cli options */ public function __construct() { // load config \Config::load('migrations', true); // get Cli options $modules = \Cli::option('modules'); $packages = \Cli::option('packages'); $default = \Cli::option('default'); $all = \Cli::option('all'); if ($all) { $modules = true; $packages = true; $default = true; } // if modules option set if (!empty($modules)) { // if true - get all modules if ($modules === true) { // loop through module paths foreach (\Config::get('module_paths') as $path) { // get all modules that have files in the migration folder foreach (glob($path . '*/') as $m) { if (count(glob($m . \Config::get('migrations.folder') . '/*.php'))) { static::$modules[] = basename($m); } } } } else { static::$modules = explode(',', $modules); } } // if packages option set if (!empty($packages)) { // if true - get all packages if ($packages === true) { // get all packages that have files in the migration folder foreach (glob(PKGPATH . '*/') as $p) { if (count(glob($p . \Config::get('migrations.folder') . '/*.php'))) { static::$packages[] = basename($p); } } } else { static::$packages = explode(',', $packages); } } if ((!empty($packages) or !empty($modules)) and empty($default)) { static::$default = false; } // set count static::$module_count = count(static::$modules); static::$package_count = count(static::$packages); }
/** * sets the properties by grabbing Cli options */ public function __construct() { // load config \Config::load('migrations', true); // get Cli options $modules = \Cli::option('modules', \Cli::option('m')); $packages = \Cli::option('packages', \Cli::option('p')); $default = \Cli::option('default'); $all = \Cli::option('all'); if ($all) { $modules = true; $packages = true; $default = true; } // if modules option set if (!empty($modules)) { // if true - get all modules if ($modules === true) { // loop through module paths foreach (\Config::get('module_paths') as $path) { // get all modules that have files in the migration folder foreach (new \GlobIterator(realpath($path) . DS . '*') as $m) { if (count(new \GlobIterator($m->getPathname() . rtrim(DS . \Config::get('migrations.folder'), '\\/') . DS . '*.php'))) { static::$modules[] = $m->getBasename(); } } } } else { static::$modules = explode(',', $modules); } } // if packages option set if (!empty($packages)) { // if true - get all packages if ($packages === true) { // get all packages that have files in the migration folder foreach (\Config::get('package_paths', array(PKGPATH)) as $path) { // get all modules that have files in the migration folder foreach (new \GlobIterator(realpath($path) . DS . '*') as $p) { if (count(new \GlobIterator($p->getPathname() . rtrim(DS . \Config::get('migrations.folder'), '\\/') . DS . '*.php'))) { static::$packages[] = $p->getBasename(); } } } } else { static::$packages = explode(',', $packages); } } // if packages or modules are specified, and the app isn't, disable app migrations if ((!empty($packages) or !empty($modules)) and empty($default)) { static::$default = false; } // set the module and package count static::$module_count = count(static::$modules); static::$package_count = count(static::$packages); }
/** * sets the properties by grabbing Cli options */ public function __construct() { // load config \Config::load('migrations', true); // get Cli options $modules = \Cli::option('modules', \Cli::option('m')); $packages = \Cli::option('packages', \Cli::option('p')); $subpackages = \Cli::option('subpackages', \Cli::option('s')); $default = \Cli::option('default'); $all = \Cli::option('all'); if ($all) { $modules = true; $packages = true; $subpackages = true; $default = true; } // if modules option set if ( ! empty($modules)) { // if true - get all modules if ($modules === true) { // loop through module paths foreach (\Config::get('module_paths') as $path) { // get all modules that have files in the migration folder foreach (glob($path . '*/') as $m) { if (count(glob($m.\Config::get('migrations.folder').'/*.php'))) { static::$modules[] = basename($m); } } } } // else do selected modules else { static::$modules = explode(',', $modules); } } // if packages option set if ( ! empty($packages)) { // if true - get all packages if ($packages === true) { // get all packages that have files in the migration folder foreach (glob(PKGPATH . '*/') as $p) { if (count(glob($p.\Config::get('migrations.folder').'/*.php'))) { static::$packages[] = basename($p); } } } // else do selected packages else { static::$packages = explode(',', $packages); } } // if subpackages option set if ( ! empty($subpackages)) { // if true - get all packages if ($subpackages === true) { // get all packages that have files in the migration folder foreach (glob(PKGPATH . '*/') as $p) { foreach (glob($p.'subpackage/*/') as $j) { if (count(glob($j.\Config::get('migrations.folder').'*.php'))) { static::$subpackages[] = basename($p) . "_" .basename($j); } } } } // else do selected packages else { static::$subpackages = explode(',', $subpackages); } } // if packages or modules are specified, and the app isn't, disable app migrations if ( ( ! empty($packages) or ! empty($modules) or ! empty($subpackages)) and empty($default)) { static::$default = false; } // set the module and package count static::$module_count = count(static::$modules); static::$package_count = count(static::$packages); static::$subpackage_count = count(static::$subpackages); }