/** * Initializes a new console app */ public function __construct() { // current script path $argv = UserInput::getSanitizedUserInput(); if (!empty($argv) && is_array($argv) && isset($argv[0])) { $this->script_path = realpath($argv[0]); } else { $this->script_path = basename($_SERVER['SCRIPT_FILENAME']); } // default required info $this->setStream(new Stream())->setArgumentRequired(true)->setName(get_class($this))->setShortname(get_class($this))->setVersion('?')->setDescription('?')->setSynopsis($this->script_path . ' [options] <arguments>'); }
// start the log startLog("install_log_" . date("d.m.Y_H.i.s")); logMessage(L_INFO, "Installation started"); // variables $silentRun = false; if ($argc > 1 && $argv[1] == '-s') { $silentRun = true; } $cleanupIfFail = true; if ($argc > 1 && $argv[1] == '-c') { $cleanupIfFail = false; $silentRun = true; } $app = new AppConfig(); $installer = new Installer(); $user = new UserInput(); $db_params = array(); // set the installation ids $app->set('INSTALLATION_UID', uniqid("IID")); // unique id per installation // load or create installation sequence id if (is_file(FILE_INSTALL_SEQ_ID)) { $install_seq = @file_get_contents(FILE_INSTALL_SEQ_ID); $app->set('INSTALLATION_SEQUENCE_UID', $install_seq); } else { $install_seq = uniqid("ISEQID"); // unique id per a set of installations $app->set('INSTALLATION_SEQUENCE_UID', $install_seq); file_put_contents(FILE_INSTALL_SEQ_ID, $install_seq); } // read package version
public function __construct($type) { parent::__construct(); $this->_type = $type; }
// start the log startLog("update_config_files_log_" . date("d.m.Y_H.i.s")); logMessage(L_INFO, "Update started"); // variables $silentRun = false; if ($argc > 1 && $argv[1] == '-s') { $silentRun = true; } $cleanupIfFail = true; if ($argc > 1 && $argv[1] == '-c') { $cleanupIfFail = false; $silentRun = true; } $app = new AppConfig(); $installer = new Installer(); $user = new UserInput(); $db_params = array(); // set the installation ids $app->set('INSTALLATION_UID', uniqid("IID")); // unique id per installation // load or create installation sequence id if (is_file(FILE_INSTALL_SEQ_ID)) { $install_seq = @file_get_contents(FILE_INSTALL_SEQ_ID); $app->set('INSTALLATION_SEQUENCE_UID', $install_seq); } else { $install_seq = uniqid("ISEQID"); // unique id per a set of installations $app->set('INSTALLATION_SEQUENCE_UID', $install_seq); file_put_contents(FILE_INSTALL_SEQ_ID, $install_seq); } // read package version