private function defineInstallationTokens() { logMessage(L_INFO, "Defining installation tokens for config"); // directories $this->app_config['APP_DIR'] = $this->app_config['BASE_DIR'] . '/app'; $this->app_config['WEB_DIR'] = $this->app_config['BASE_DIR'] . '/web'; $this->app_config['LOG_DIR'] = $this->app_config['BASE_DIR'] . '/log'; $this->app_config['BIN_DIR'] = $this->app_config['BASE_DIR'] . '/bin'; $this->app_config['TMP_DIR'] = $this->app_config['BASE_DIR'] . '/tmp/'; $this->app_config['DWH_DIR'] = $this->app_config['BASE_DIR'] . '/dwh'; $this->app_config['ETL_HOME_DIR'] = $this->app_config['BASE_DIR'] . '/dwh'; // For backward compatibility $this->app_config['SPHINX_BIN_DIR'] = $this->app_config['BIN_DIR'] . '/sphinx'; $this->app_config['IMAGE_MAGICK_BIN_DIR'] = "/usr/bin"; $this->app_config['CURL_BIN_DIR'] = "/usr/bin"; // site settings if (strpos($this->app_config['KALTURA_FULL_VIRTUAL_HOST_NAME'], ":") !== false) { $this->app_config['KALTURA_VIRTUAL_HOST_PORT'] = parse_url($this->app_config['KALTURA_FULL_VIRTUAL_HOST_NAME'], PHP_URL_PORT); } else { $this->app_config['KALTURA_VIRTUAL_HOST_PORT'] = 80; } $this->app_config['KALTURA_VIRTUAL_HOST_NAME'] = $this->removeHttp($this->app_config['KALTURA_FULL_VIRTUAL_HOST_NAME']); $this->app_config['CORP_REDIRECT'] = ''; $this->app_config['CDN_HOST'] = $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['IIS_HOST'] = $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['RTMP_URL'] = self::stripProtocol($this->app_config['KALTURA_VIRTUAL_HOST_NAME']); $this->app_config['MEMCACHE_HOST'] = self::stripProtocol($this->app_config['KALTURA_VIRTUAL_HOST_NAME']); $this->app_config['GLOBAL_MEMCACHE_HOST'] = self::stripProtocol($this->app_config['KALTURA_VIRTUAL_HOST_NAME']); $this->app_config['WWW_HOST'] = $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['BASE_HOST_NO_PORT'] = self::stripProtocol($this->app_config['KALTURA_VIRTUAL_HOST_NAME']); $this->app_config['SERVICE_URL'] = $this->app_config['WORK_MODE'] . '://' . $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['ENVIRONMENT_NAME'] = $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; // databases (copy information collected during prerequisites if ($this->app_config['DB1_HOST'] == 'localhost') { $this->app_config['DB1_HOST'] = '127.0.0.1'; } $this->collectDatabaseCopier('DB1', 'DB2'); $this->collectDatabaseCopier('DB1', 'DB3'); //sphinx $this->app_config['SPHINX_SERVER'] = $this->app_config['DB1_HOST']; $this->app_config['SPHINX_DB_NAME'] = 'kaltura_sphinx_log'; $this->app_config['SPHINX_DB_PORT'] = $this->app_config['DB1_PORT']; $this->app_config['SPHINX_DB_USER'] = $this->app_config['DB1_USER']; $this->app_config['SPHINX_DB_PASS'] = $this->app_config['DB1_PASS']; // admin console defaults $this->app_config['SYSTEM_USER_ADMIN_EMAIL'] = $this->app_config['ADMIN_CONSOLE_ADMIN_MAIL']; $this->app_config['ADMIN_CONSOLE_PARTNER_ALIAS'] = md5('-2kaltura partner'); $this->app_config['ADMIN_CONSOLE_KUSER_MAIL'] = 'admin_console@' . $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->generateSha1Salt($this->app_config['ADMIN_CONSOLE_PASSWORD'], $salt, $sha1); $this->app_config['SYSTEM_USER_ADMIN_SALT'] = $salt; $this->app_config['ADMIN_CONSOLE_KUSER_SHA1'] = $salt; $this->app_config['SYSTEM_USER_ADMIN_SHA1'] = $sha1; $this->app_config['ADMIN_CONSOLE_KUSER_SALT'] = $sha1; $this->app_config['UICONF_TAB_ACCESS'] = 'SYSTEM_ADMIN_BATCH_CONTROL'; // stats DB $this->collectDatabaseCopier('DB1', 'DB_STATS'); $this->app_config['DB_STATS_NAME'] = 'kaltura_stats'; // data warehouse $this->app_config['DWH_HOST'] = $this->app_config['DB1_HOST']; $this->app_config['DWH_PORT'] = $this->app_config['DB1_PORT']; $this->app_config['DWH_DATABASE_NAME'] = 'kalturadw'; $this->app_config['DWH_USER'] = '******'; $this->app_config['DWH_PASS'] = '******'; $this->app_config['DWH_SEND_REPORT_MAIL'] = $this->app_config['ADMIN_CONSOLE_ADMIN_MAIL']; $this->app_config['EVENTS_LOGS_DIR'] = $this->app_config['LOG_DIR']; $this->app_config['EVENTS_WILDCARD'] = '.*kaltura.*_apache_access.log-.*'; $this->app_config['EVENTS_FETCH_METHOD'] = 'local'; // default partners and kusers $this->app_config['TEMPLATE_PARTNER_MAIL'] = 'template@' . $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['TEMPLATE_KUSER_MAIL'] = $this->app_config['TEMPLATE_PARTNER_MAIL']; $this->app_config['TEMPLATE_ADMIN_KUSER_SALT'] = $this->app_config['SYSTEM_USER_ADMIN_SALT']; $this->app_config['TEMPLATE_ADMIN_KUSER_SHA1'] = $this->app_config['SYSTEM_USER_ADMIN_SHA1']; $this->app_config['PARTNER_ZERO_PARTNER_ALIAS'] = md5('-1kaltura partner zero'); // batch $this->app_config['BATCH_ADMIN_MAIL'] = $this->app_config['ADMIN_CONSOLE_ADMIN_MAIL']; $this->app_config['BATCH_KUSER_MAIL'] = 'batch@' . $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; $this->app_config['BATCH_HOST_NAME'] = OsUtils::getComputerName(); $this->app_config['BATCH_PARTNER_PARTNER_ALIAS'] = md5('-1kaltura partner'); // other configurations $this->app_config['APACHE_RESTART_COMMAND'] = $this->app_config['HTTPD_BIN'] . ' -k restart'; date_default_timezone_set($this->app_config['TIME_ZONE']); $this->app_config['GOOGLE_ANALYTICS_ACCOUNT'] = 'UA-7714780-1'; $this->app_config['INSTALLATION_TYPE'] = ''; $this->app_config['PARTNERS_USAGE_REPORT_SEND_FROM'] = ''; $this->app_config['PARTNERS_USAGE_REPORT_SEND_TO'] = ''; $this->app_config['SYSTEM_PAGES_LOGIN_USER'] = ''; $this->app_config['SYSTEM_PAGES_LOGIN_PASS'] = ''; $this->app_config['KMC_BACKDOR_SHA1_PASS'] = ''; $this->app_config['DC0_SECRET'] = ''; $this->app_config['APACHE_CONF'] = ''; // storage profile related $this->app_config['DC_NAME'] = 'local'; $this->app_config['DC_DESCRIPTION'] = 'local'; $this->app_config['STORAGE_BASE_DIR'] = $this->app_config['WEB_DIR']; $this->app_config['DELIVERY_HTTP_BASE_URL'] = $this->app_config['SERVICE_URL']; $this->app_config['DELIVERY_RTMP_BASE_URL'] = $this->app_config['RTMP_URL']; $this->app_config['DELIVERY_ISS_BASE_URL'] = $this->app_config['SERVICE_URL']; $this->app_config['ENVIRONMENT_NAME'] = $this->app_config['KALTURA_VIRTUAL_HOST_NAME']; // set the usage tracking for Kaltura TM if (strcasecmp($this->app_config['KALTURA_VERSION_TYPE'], K_TM_TYPE) === 0) { $this->app_config['PARTNERS_USAGE_REPORT_SEND_FROM'] = $this->app_config['ADMIN_CONSOLE_ADMIN_MAIL']; $this->app_config['PARTNERS_USAGE_REPORT_SEND_TO'] = "*****@*****.**"; } // mails configurations $this->app_config['FORUMS_URLS'] = ''; $this->app_config['CONTACT_URL'] = 'https://github.com/Akvelon2014/Media-Management-based-on-Kaltura/issues'; $this->app_config['CONTACT_PHONE_NUMBER'] = ''; $this->app_config['BEGINNERS_TUTORIAL_URL'] = ''; $this->app_config['QUICK_START_GUIDE_URL'] = $this->app_config['WORK_MODE'] . '://' . $this->app_config['KALTURA_VIRTUAL_HOST_NAME'] . '/content/docs/wams/kmc.html'; $this->app_config['UNSUBSCRIBE_EMAIL_URL'] = ''; //Set parameters default value if they are not included in a previous user_input.ini if (!isset($this->app_config['DB1_CREATE_NEW_DB'])) { $this->app_config['DB1_CREATE_NEW_DB'] = true; } else { $this->app_config['DB1_CREATE_NEW_DB'] = strcasecmp('y', $this->app_config['DB1_CREATE_NEW_DB']) === 0 || strcasecmp('yes', $this->app_config['DB1_CREATE_NEW_DB']) === 0; } if (!isset($this->app_config['RED5_INSTALL'])) { $this->app_config['RED5_INSTALL'] = false; } else { $this->app_config['RED5_INSTALL'] = strcasecmp('y', $this->app_config['RED5_INSTALL']) === 0 || strcasecmp('yes', $this->app_config['RED5_INSTALL']) === 0; } if ($this->app_config['DB1_CREATE_NEW_DB']) { $this->app_config['PARTNER_ZERO_SECRET'] = $this->generateSecret(); $this->app_config['PARTNER_ZERO_ADMIN_SECRET'] = $this->generateSecret(); $this->app_config['BATCH_PARTNER_SECRET'] = $this->generateSecret(); $this->app_config['BATCH_PARTNER_ADMIN_SECRET'] = $this->generateSecret(); $this->app_config['ADMIN_CONSOLE_PARTNER_SECRET'] = $this->generateSecret(); $this->app_config['ADMIN_CONSOLE_PARTNER_ADMIN_SECRET'] = $this->generateSecret(); } else { if (!empty($this->app_config['DB1_PASS'])) { $mysql_str = 'mysql -h' . $this->app_config['DB1_HOST'] . ' -P' . $this->app_config['DB1_PORT'] . ' -u' . $this->app_config['DB1_USER'] . ' -p' . $this->app_config['DB1_PASS'] . ' ' . $this->app_config['DB1_NAME'] . ' --skip-column-names'; } else { $mysql_str = 'mysql -h' . $this->app_config['DB1_HOST'] . ' -P' . $this->app_config['DB1_PORT'] . ' -u' . $this->app_config['DB1_USER'] . ' ' . $this->app_config['DB1_NAME'] . ' --skip-column-names'; } $output = OsUtils::executeReturnOutput('echo "select secret from partner where id=0" | ' . $mysql_str); $this->app_config['PARTNER_ZERO_SECRET'] = $output[0]; $output = OsUtils::executeReturnOutput('echo "select admin_secret from partner where id=0" | ' . $mysql_str); $this->app_config['PARTNER_ZERO_ADMIN_SECRET'] = $output[0]; $output = OsUtils::executeReturnOutput('echo "select secret from partner where id=-1" | ' . $mysql_str); $this->app_config['BATCH_PARTNER_SECRET'] = $output[0]; $output = OsUtils::executeReturnOutput('echo "select admin_secret from partner where id=-1" | ' . $mysql_str); $this->app_config['BATCH_PARTNER_ADMIN_SECRET'] = $output[0]; $output = OsUtils::executeReturnOutput('echo "select secret from partner where id=-2" | ' . $mysql_str); $this->app_config['ADMIN_CONSOLE_PARTNER_SECRET'] = $output[0]; $output = OsUtils::executeReturnOutput('echo "select admin_secret from partner where id=-2" | ' . $mysql_str); $this->app_config['ADMIN_CONSOLE_PARTNER_ADMIN_SECRET'] = $output[0]; } }
public static function findBinary($file_name) { if (!is_array($file_name)) { $file_name = array($file_name); } foreach ($file_name as $file) { $which_path = OsUtils::executeReturnOutput("which {$file}"); if (isset($which_path[0]) && trim($which_path[0]) != '' && substr($which_path[0], 0, 1) == "/") { return $which_path[0]; } } return null; }
logMessage(L_USER, 'restart cron'); if (!OsUtils::execute("/etc/init.d/crond restart")) { echo "Failed restart cron"; return "\nFailed cron\n"; } logMessage(L_USER, 'chmod'); if (!OsUtils::execute("chmod 700 /etc/cron.d")) { echo "Failed chmod"; return "\nFailed chmod\n"; } //logMessage(L_USER, 'chmod'); //if (!OsUtils::execute("chmod 700 /etc/rc.d/init.d")) { // echo "Failed chmod"; // return "\nFailed chmod\n"; //} $kalturaProcesses = implode(OsUtils::executeReturnOutput("ps -ef | grep kaltura")); logMessage(L_USER, 'ps -ef | grep kaltura: ' . $kalturaProcesses); $processFound = strstr($kalturaProcesses, 'searchd --config'); if (!$processFound) { echo 'ERROR: searchd is not running'; } $processFound = strstr($kalturaProcesses, 'KGenericBatchMgr.class.php'); if (!$processFound) { echo 'ERROR: batch is not running'; } $processFound = strstr($kalturaProcesses, 'watch.daemon.sh'); if (!$processFound) { echo 'ERROR: watch daemon is not running'; } $processFound = strstr($kalturaProcesses, 'populateFromLog.php'); if (!$processFound) {