Exemplo n.º 1
0
 public function getApplicationInput()
 {
     $httpd_bin_found = OsUtils::findBinary(array('apachectl', 'apache2ctl'));
     if (!empty($httpd_bin_found)) {
         $httpd_bin_message = "The following apachectl script has been detected: {$httpd_bin_found}. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative apachectl script on your server.";
         $httpd_error_message = "Invalid pathname for apachectl script, leave empty to use {$httpd_bin_found} or enter an alternative apachectl path";
     } else {
         $httpd_bin_message = "Installation could not automatically detect any apachectl script. Please provide a pathname to the apachectl script on your server.";
         $httpd_error_message = "Invalid pathname for apachectl script, please enter the apachectl pathname again";
     }
     $php_bin_found = OsUtils::findBinary('php');
     if (!empty($php_bin_found)) {
         $php_bin_message = "The following PHP binary has been detected: {$php_bin_found}. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative PHP binary on your server.";
         $php_error_message = "Invalid pathname for PHP binary, leave empty to use {$php_bin_found} or enter an alternative PHP path";
     } else {
         $php_bin_message = "Installation could not automatically detect any PHP binary. Please provide a pathname to the PHP binary on your server.";
         $php_error_message = "Invalid pathname for PHP binary, please enter the PHP pathname again";
     }
     logMessage(L_USER, "Please provide the following information:");
     echo PHP_EOL;
     $this->getInput('HTTPD_BIN', $httpd_bin_message, $httpd_error_message, InputValidator::createFileValidator(), $httpd_bin_found);
     $this->getInput('PHP_BIN', $php_bin_message, $php_error_message, InputValidator::createFileValidator(), $php_bin_found);
     $this->getInput('BASE_DIR', "Full target directory path for Kaltura application (leave empty for /opt/kaltura)", "Target directory must be a valid directory path, please enter again", InputValidator::createDirectoryValidator(), '/opt/kaltura');
     $this->getInput('KALTURA_FULL_VIRTUAL_HOST_NAME', "Please enter the domain name/virtual hostname that will be used for the Kaltura server (without http://)", 'Must be a valid hostname or ip, please enter again', InputValidator::createHostValidator(), null);
     $this->getInput('ADMIN_CONSOLE_ADMIN_MAIL', "Your primary system administrator email address", "Email must be in a valid email format, please enter again", InputValidator::createEmailValidator(false), null);
     $this->getInput('ADMIN_CONSOLE_PASSWORD', "The password you want to set for your primary administrator", "Password should not be empty and should not contain whitespaces, please enter again", InputValidator::createNoWhitespaceValidator(), null);
     $this->getInput('DB1_HOST', "Database host (leave empty for 'localhost')", "Must be a valid hostname or ip, please enter again (leave empty for 'localhost')", InputValidator::createHostValidator(), 'localhost');
     $this->getInput('DB1_PORT', "Database port (leave empty for '3306')", "Must be a valid port (1-65535), please enter again (leave empty for '3306')", InputValidator::createRangeValidator(1, 65535), '3306');
     $this->set('DB1_NAME', 'kaltura');
     // currently we do not support getting the DB name from the user because of the DWH implementation
     $this->getInput('DB1_USER', "Database username (with create & write privileges)", "Database username cannot be empty, please enter again", InputValidator::createNonEmptyValidator(), null);
     $this->getInput('DB1_PASS', "Database password (leave empty for no password)", null, null, null);
     $this->getInput('XYMON_URL', "The URL to your xymon/hobbit monitoring location. Xymon is an optional installation. Leave empty to set manually later\nExamples:\nhttp://www.xymondomain.com/xymon/\nhttp://www.xymondomain.com/hobbit/", null, null, null);
     $this->saveInput();
 }
 public function getApplicationInput()
 {
     $httpd_bin_found = OsUtils::findBinary(array('apachectl', 'apache2ctl'));
     if (!empty($httpd_bin_found)) {
         $httpd_bin_message = "The following apachectl script has been detected: {$httpd_bin_found}. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative apachectl script on your server.";
         $httpd_error_message = "Invalid pathname for apachectl script, leave empty to use {$httpd_bin_found} or enter an alternative apachectl path";
     } else {
         $httpd_bin_message = "Installation could not automatically detect any apachectl script. Please provide a pathname to the apachectl script on your server.";
         $httpd_error_message = "Invalid pathname for apachectl script, please enter the apachectl pathname again";
     }
     $php_bin_found = OsUtils::findBinary('php');
     if (!empty($php_bin_found)) {
         $php_bin_message = "The following PHP binary has been detected: {$php_bin_found}. Do you want to use this script to run your Kaltura application? Leave empty to use or provide a pathname to an alternative PHP binary on your server.";
         $php_error_message = "Invalid pathname for PHP binary, leave empty to use {$php_bin_found} or enter an alternative PHP path";
     } else {
         $php_bin_message = "Installation could not automatically detect any PHP binary. Please provide a pathname to the PHP binary on your server.";
         $php_error_message = "Invalid pathname for PHP binary, please enter the PHP pathname again";
     }
     logMessage(L_USER, "Please provide the following information:");
     echo PHP_EOL;
     $this->set('HTTPD_BIN', $httpd_bin_found);
     $this->set('PHP_BIN', $php_bin_found);
     $this->getInput('TIME_ZONE', "Default time zone for Kaltura application (leave empty to use system timezone: " . date_default_timezone_get() . " )", "Timezone must be a valid timezone, please enter again", InputValidator::createTimezoneValidator(), date_default_timezone_get());
     $this->getInput('BASE_DIR', "Full target directory path for Kaltura application (leave empty for /opt/kaltura)", "Target directory must be a valid directory path, please enter again", InputValidator::createDirectoryValidator(), '/opt/kaltura');
     $this->getInput('KALTURA_FULL_VIRTUAL_HOST_NAME', "Please enter the domain name/virtual hostname that will be used for the Kaltura server (without http://)", 'Must be a valid hostname or ip, please enter again', InputValidator::createHostValidator(), null);
     $this->getInput('DB1_HOST', "Database host (leave empty for 'localhost')", "Must be a valid hostname or ip, please enter again (leave empty for 'localhost')", InputValidator::createHostValidator(), 'localhost');
     $this->getInput('DB1_PORT', "Database port (leave empty for '3306')", "Must be a valid port (1-65535), please enter again (leave empty for '3306')", InputValidator::createRangeValidator(1, 65535), '3306');
     $this->set('DB1_NAME', 'kaltura');
     // currently we do not support getting the DB name from the user because of the DWH implementation
     $this->getInput('DB1_USER', "Database username (with create & write privileges)", "Database username cannot be empty, please enter again", InputValidator::createNonEmptyValidator(), null);
     $this->getInput('DB1_PASS', "Database password (leave empty for no password)", null, null, null);
     if ((strcasecmp($this->get('DB1_HOST'), 'localhost') === 0 || strcasecmp($this->get('DB1_HOST'), '127.0.0.1') === 0) && empty($this->user_input['DB1_PASS'])) {
         $this->getInput('DB1_SET_PASSWORD', "Empty password is not secure. Would you like to set password now? (Y/n)", "Input is not valid", InputValidator::createYesNoValidator(), "yes");
         if (strcasecmp($this->get('DB1_SET_PASSWORD'), 'y') === 0 || strcasecmp($this->get('DB1_SET_PASSWORD'), 'yes') === 0) {
             $user = $this->get('DB1_USER');
             $newPassword = '';
             $continue = true;
             while ($continue) {
                 $this->getInput('DB1_NEW_PASSWORD', "Enter new password", "Password cannot be empty, please enter again", InputValidator::createNonEmptyValidator(), null);
                 $this->getInput('DB1_NEW_PASSWORD_CONFIRM', "Confirm new password", "Password cannot be empty, please enter again", InputValidator::createNonEmptyValidator(), null);
                 if ($this->get('DB1_NEW_PASSWORD') === $this->get('DB1_NEW_PASSWORD_CONFIRM')) {
                     $newPassword = $this->get('DB1_NEW_PASSWORD');
                     $continue = false;
                 } else {
                     echo "The passwords that you entered do not match.";
                     echo PHP_EOL;
                 }
                 $this->unsetInput('DB1_NEW_PASSWORD');
                 $this->unsetInput('DB1_NEW_PASSWORD_CONFIRM');
             }
             shell_exec("sudo mysqladmin -u {$user} password '{$newPassword}'");
             $this->set('DB1_PASS', $newPassword);
         }
         $this->unsetInput('DB1_SET_PASSWORD');
     }
     $this->getInput('DB1_CREATE_NEW_DB', "Would you like to create a new kaltura database or use an existing one? (Y/n)", "Input is not valid", InputValidator::createYesNoValidator(), "yes");
     $this->set('XYMON_URL', null);
     $this->getInput('RED5_INSTALL', "Would you like to install Red5 on this machine? Server needs it for web camera recording support. (Y/n)", "Please input yes/no.", InputValidator::createYesNoValidator(), "yes");
     $this->getInput('SPHINX_DB_HOST', "Sphinx host (leave empty if Sphinx is running on this machine).", null, InputValidator::createHostValidator(), '127.0.0.1');
     $this->getInput('WORK_MODE', "Work mode - enter http/https (http)", "Input is not valid", InputValidator::createWorkModeValidator(), 'http');
     $this->getInput('ADMIN_CONSOLE_ADMIN_MAIL', "Your primary system administrator email address", "Email must be in a valid email format, please enter again", InputValidator::createEmailValidator(false), null);
     $this->getInput('ADMIN_CONSOLE_PASSWORD', "The password you want to set for your primary administrator", "Password should not be empty and should not contain whitespaces, please enter again", InputValidator::createNoWhitespaceValidator(), null);
     $this->saveInput();
 }