Exemplo n.º 1
0
 /**
  * Sets a controller and a action
  */
 private function setControllerAction()
 {
     // Parse url. 2 cases:
     // a) Default controller
     // b) Module controller
     // Get all modules
     $mod_path = conf::pathBase() . "/" . $this->modules;
     $mods = file::getDirsGlob($mod_path, array('basename' => true));
     $base = direct::fragment(0);
     if (!in_array($base, $mods)) {
         // Could not find a controller / module
         $this->controller = $this->default;
         $action = direct::fragment(0);
         if ($action) {
             $this->action = $action;
         }
     } else {
         // Found a controller / module
         $this->controller = $base;
         $action = direct::fragment(1);
         if ($action) {
             $this->action = $action;
         }
     }
 }
Exemplo n.º 2
0
function multi_shared_exec_command($options = null)
{
    $path = conf::pathBase() . "/config/multi/*";
    if (!isset($options['command'])) {
        common::abort('Specify a command');
        return 1;
    }
    $command = $options['command'];
    $dirs = file::getDirsGlob($path, array('basename' => 1));
    foreach ($dirs as $domain) {
        $exec_command = "./coscli.sh --domain={$domain} {$command}";
        common::echoMessage("Executing command: {$exec_command}");
        passthru($exec_command, $return_var);
    }
}
Exemplo n.º 3
0
/**
 * executes a shell command on all coscms systems install in parent dir (../) from
 * current dir
 * @param string $command
 * @return int $ret
 */
function multi_exec_shell_command($options = array())
{
    $path = conf::pathBase() . "/../";
    if (!isset($options['command'])) {
        common::abort('Specify a command');
        return 1;
    }
    $command = $options['command'];
    $dirs = file::getDirsGlob($path, array('basename' => 1));
    foreach ($dirs as $domain) {
        if (!file_exists("../{$domain}/config/config.ini")) {
            continue;
        }
        $exec_command = "cd ../{$domain} && {$command}";
        multi_passthru($exec_command);
    }
}
 /**
  * Get array of modules from file system.
  * @return array $base_dirs
  */
 public static function getModulesFromDir()
 {
     return file::getDirsGlob(conf::pathModules(), array('basename' => 1));
 }
Exemplo n.º 5
0
 /**
  * attach all dirs inside a dir to $this->dirs
  * e.g. modules/* will set the following dirs
  * /modules/account
  * /modules/blog
  * @param string $path modules/*
  */
 public function setDirsInsideDir($path)
 {
     $dirs = file::getDirsGlob($path);
     $this->addDirs($dirs);
 }