Ejemplo n.º 1
0
defined('DS') or die('No direct script access.');
use Laravel\Bundle;
use Laravel\Config;
use Laravel\Request;
/**
 * Fire up the default bundle. This will ensure any dependencies that
 * need to be registered in the IoC container are registered and that
 * the auto-loader mappings are registered.
 */
Bundle::start(DEFAULT_BUNDLE);
/**
 * The default database connection may be set by specifying a value
 * for the "database" CLI option. This allows migrations to be run
 * conveniently for a test or staging database.
 */
if (!is_null($database = get_cli_option('db'))) {
    Config::set('database.default', $database);
}
/**
 * We will register all of the Laravel provided tasks inside the IoC
 * container so they can be resolved by the task class. This allows
 * us to seamlessly add tasks to the CLI so that the Task class
 * doesn't have to worry about how to resolve core tasks.
 */
require path('sys') . 'cli/dependencies' . EXT;
/**
 * We will wrap the command execution in a try / catch block and
 * simply write out any exception messages we receive to the CLI
 * for the developer. Note that this only writes out messages
 * for the CLI exceptions. All others will be not be caught
 * and will be totally dumped out to the CLI.
Ejemplo n.º 2
0
 /**
  * Returns the option with the given name.	You can also give the option
  * number.
  *
  * Named options must be in the following formats:
  * php index.php user -v --v -name=John --name=John
  *
  * @param  mixed    $name   the name of the option (int if unnamed)
  * @return string
  */
 public static function option($name, $default = null)
 {
     return get_cli_option($name, $default);
 }
Ejemplo n.º 3
0
RequestFoundation::enableHttpMethodParameterOverride();
Request::$foundation = RequestFoundation::createFromGlobals();
/*
|--------------------------------------------------------------------------
| Determine The Application Environment
|--------------------------------------------------------------------------
|
| Next, we're ready to determine the application environment. This may be
| set either via the command line options or via the mapping of URIs to
| environments that lives in the "paths.php" file for the application
| and is parsed. When determining the CLI environment, the "--env"
| CLI option overrides the mapping in "paths.php".
|
*/
if (Request::cli()) {
    $environment = get_cli_option('env', getenv('LARAVEL_ENV'));
    if (empty($environment)) {
        $environment = Request::detect_env($environments, gethostname());
    }
} else {
    $root = Request::foundation()->getRootUrl();
    $environment = Request::detect_env($environments, $root);
}
/*
|--------------------------------------------------------------------------
| Set The Application Environment
|--------------------------------------------------------------------------
|
| Once we have determined the application environment, we will set it on
| the global server array of the HttpFoundation request. This makes it
| available throughout the application, though it is mainly only
Ejemplo n.º 4
0
*/
use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation;
Request::$foundation = RequestFoundation::createFromGlobals();
/*
|--------------------------------------------------------------------------
| Determine The Application Environment
|--------------------------------------------------------------------------
|
| Next we're ready to determine the application environment. This may be
| set either via the command line options, or, if the request is from
| the web, via the mapping of URIs to environments that lives in
| the "paths.php" file for the application and is parsed.
|
*/
if (Request::cli()) {
    $environment = get_cli_option('env');
} else {
    $root = Request::foundation()->getRootUrl();
    $environment = Request::detect_env($environments, $root);
}
/*
|--------------------------------------------------------------------------
| Set The Application Environment
|--------------------------------------------------------------------------
|
| Once we have determined the application environment, we will set it on
| the global server array of the HttpFoundation request. This makes it
| available throughout the application, thought it is mainly only
| used to determine which configuration files to merge in.
|
*/
Ejemplo n.º 5
0
require dirname(__FILE__) . '/urls.php';
require dirname(__FILE__) . '/functions.php';
$start = 0;
$end = null;
$list = null;
$basedir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "download";
$supported_downloaders = ["wget", "idm"];
$downloader = "wget";
$cookiefolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . "cookies";
if (!file_exists($cookiefolder)) {
    mkdir($cookiefolder);
}
$shortopts = "i:u:s:e:l:f:d:h";
$longopts = array("id:", "url:", "start:", "end:", "list:", "folder:", "downloader:", "help");
$options = getopt($shortopts, $longopts);
get_cli_option($options, "help", "h") === false ? print_help() : "";
if (!isset($options["id"]) && !isset($options["i"]) && (!isset($options["url"]) && !isset($options["u"]))) {
    echo "ERROR: Please set either course ID or URL.\n";
    print_help();
} else {
    if ((isset($options["id"]) || isset($options["i"])) && (isset($options["url"]) || isset($options["u"]))) {
        echo "Course ID set. URL will be ignored.\n";
    }
}
if (isset($options["id"]) || isset($options["i"])) {
    $courseId = isset($options["id"]) ? $options["id"] : $options["i"];
} else {
    if (isset($options["url"]) || isset($options["u"])) {
        $courseURL = isset($options["url"]) ? $options["url"] : $options["u"];
    }
}