Пример #1
0
<?php

/**
 * Get information about ETSIS-CLI itself.
 *
 * ## EXAMPLES
 *
 *     # Display cli version number.
 *     $ ./etsis cli version
 * 
 *     # Display CLI environment.
 *     $ ./etsis cli info 
 *
 */
ETSIS_CLI::add_command('cli', 'CLI_Command');
class CLI_Command extends ETSIS_CLI_Command
{
    /**
     * Displays CLI version.
     * 
     * ## EXAMPLES
     *
     *     # Display cli version number.
     *     $ ./etsis cli version 
     */
    function version()
    {
        ETSIS_CLI::line('ETSIS-CLI ' . ETSIS_CLI_VERSION);
    }
    /**
     * Print various data about the CLI environment.
Пример #2
0
<?php

/**
 * Implement help command.
 *
 * ## EXAMPLES
 *
 *     # Show help screen.
 *     $ ./etsis help
 * 
 */
ETSIS_CLI::add_command('help', 'Help_Command');
class Help_Command extends ETSIS_CLI_Command
{
    public function __construct($args)
    {
        if (empty($args)) {
            $this->general_help();
            return;
        }
        $this->show_available_subcommands($args[0]);
    }
    private function show_available_subcommands($command)
    {
        $class = ETSIS_CLI::load_command($command);
        ETSIS_CLI_Command::describe_command($class, $command);
    }
    private function general_help()
    {
        ETSIS_CLI::line(<<<EOB
Пример #3
0
 *     $ ./etsis core migrate
 *
 *     # Rollback to previous migration.
 *     $ ./etsis core rollback
 *
 *     # Prints list of all migrations with current status.
 *     $ ./etsis core status
 * 
 *     # Checks if an update is available.
 *     $ ./etsis core check_update
 * 
 *     # Updates your system to the latest release.
 *     $ ./etsis core update
 *
 */
ETSIS_CLI::add_command('core', 'Core_Command');
class Core_Command extends ETSIS_CLI_Command
{
    /**
     * Display various info about eduTrac SIS.
     *
     * ## EXAMPLES
     *
     *     # Display release and copyright.
     *     $ ./etsis core info
     */
    public function info()
    {
        ETSIS_CLI::line('eduTrac SIS ' . file_get_contents('RELEASE'));
        ETSIS_CLI::line('Copyright (c) 2013-2016 Joshua Parker <*****@*****.**>');
    }
Пример #4
0
 * Perform database operations.
 *
 * ## EXAMPLES
 *
 *     # Create a mysqldump of eduTrac SIS.
 *     $ ./etsis db backup
 *     Success: Database export is complete.
 * 
 *     $ ./etsis db optimize
 *     Success: Database optimization complete. 
 *
 *     $ ./etsis db tables
 *     Success: Database table list complete. 
 * 
 */
ETSIS_CLI::add_command('db', 'Db_Command');
class Db_Command extends ETSIS_CLI_Command
{
    private $pdo;
    private $db;
    /**
     * Creates a connection to the system's database and performs a mysqldump.
     * 
     * ## EXAMPLES
     *  
     *     $ ./etsis db backup
     *     Success: Database export is complete.
     * 
     * ## OPTIONS
     * 
     * [--dir=<path>]