当前位置: 首页>>代码示例>>PHP>>正文


PHP AppConfig::replaceTokensInString方法代码示例

本文整理汇总了PHP中AppConfig::replaceTokensInString方法的典型用法代码示例。如果您正苦于以下问题:PHP AppConfig::replaceTokensInString方法的具体用法?PHP AppConfig::replaceTokensInString怎么用?PHP AppConfig::replaceTokensInString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppConfig的用法示例。


在下文中一共展示了AppConfig::replaceTokensInString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install(AppConfig $app, $db_params)
 {
     logMessage(L_USER, sprintf("Copying application files to %s", $app->get('BASE_DIR')));
     logMessage(L_USER, sprintf("current working dir is %s", getcwd()));
     if (!OsUtils::rsync('package/app/', $app->get('BASE_DIR'), "--exclude web/content")) {
         return "Failed to copy application files to target directory";
     }
     if ($app->get('DB1_CREATE_NEW_DB')) {
         if (!OsUtils::rsync("package/app/web/content", $app->get('WEB_DIR'))) {
             return "Failed to copy default content into /opt/kaltura/web";
         }
     }
     $os_name = OsUtils::getOsName();
     $architecture = OsUtils::getSystemArchitecture();
     logMessage(L_USER, "Copying binaries for {$os_name} {$architecture}");
     if (!OsUtils::fullCopy("package/bin/{$os_name}/{$architecture}", $app->get('BIN_DIR'))) {
         return "Failed to copy binaries for {$os_name} {$architecture}";
     }
     logMessage(L_USER, "Creating the uninstaller");
     if (!OsUtils::fullCopy('installer/uninstall.php', $app->get('BASE_DIR') . "/uninstaller/")) {
         return "Failed to create the uninstaller";
     }
     //create uninstaller.ini with minimal definitions
     $app->saveUninstallerConfig();
     //OsUtils::logDir definition
     OsUtils::$logDir = $app->get('LOG_DIR');
     // if vmware installation copy configurator folders
     if ($app->get('KALTURA_PREINSTALLED')) {
         mkdir($app->get('BASE_DIR') . '/installer', 0777, true);
         if (!OsUtils::rsync('installer/', $app->get('BASE_DIR') . '/installer')) {
             return "Failed to copy installer files to target directory";
         }
         if (!OsUtils::fullCopy('configurator/', $app->get('BASE_DIR') . '/installer')) {
             return "Failed to copy configurator files to target directory";
         }
         if (!OsUtils::fullCopy('configure.php', $app->get('BASE_DIR') . "/installer/")) {
             return "Failed to copy configure.php file to targer directory";
         }
     }
     logMessage(L_USER, "Replacing configuration tokens in files");
     foreach ($this->install_config['token_files'] as $file) {
         $replace_file = $app->replaceTokensInString($file);
         if (!$app->replaceTokensInFile($replace_file)) {
             return "Failed to replace tokens in {$replace_file}";
         }
     }
     $this->changeDirsAndFilesPermissions($app);
     if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('DB1_NAME')) === true) {
         logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('DB1_NAME')));
     } else {
         $sql_files = parse_ini_file($app->get('BASE_DIR') . APP_SQL_DIR . 'create_kaltura_db.ini', true);
         logMessage(L_USER, sprintf("Creating and initializing '%s' database", $app->get('DB1_NAME')));
         if (!DatabaseUtils::createDb($db_params, $app->get('DB1_NAME'))) {
             return "Failed to create '" . $app->get('DB1_NAME') . "' database";
         }
         foreach ($sql_files['kaltura']['sql'] as $sql) {
             $sql_file = $app->get('BASE_DIR') . APP_SQL_DIR . $sql;
             if (!DatabaseUtils::runScript($sql_file, $db_params, $app->get('DB1_NAME'))) {
                 return "Failed running database script {$sql_file}";
             }
         }
     }
     if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('SPHINX_DB_NAME')) === true) {
         logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('SPHINX_DB_NAME')));
     } else {
         logMessage(L_USER, sprintf("Creating and initializing '%s' database", $app->get('SPHINX_DB_NAME')));
         if (!DatabaseUtils::createDb($db_params, $app->get('SPHINX_DB_NAME'))) {
             return "Failed to create '" . $app->get('SPHINX_DB_NAME') . "' database";
         }
         foreach ($sql_files[$app->get('SPHINX_DB_NAME')]['sql'] as $sql) {
             $sql_file = $app->get('BASE_DIR') . APP_SQL_DIR . $sql;
             if (!DatabaseUtils::runScript($sql_file, $db_params, $app->get('SPHINX_DB_NAME'))) {
                 return "Failed running database script {$sql_file}";
             }
         }
     }
     if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('DWH_DATABASE_NAME')) === true) {
         logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('DWH_DATABASE_NAME')));
     } else {
         logMessage(L_USER, "Creating data warehouse");
         if (!OsUtils::execute(sprintf("%s/setup/dwh_setup.sh -h %s -P %s -u %s -p %s -d %s ", $app->get('DWH_DIR'), $app->get('DB1_HOST'), $app->get('DB1_PORT'), $app->get('DWH_USER'), $app->get('DWH_PASS'), $app->get('DWH_DIR')))) {
             return "Failed running data warehouse initialization script";
         }
     }
     logMessage(L_USER, "Creating Dynamic Enums");
     if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/installPlugins.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
         logMessage(L_INFO, "Dynamic Enums created");
     } else {
         return "Failed to create dynamic enums";
     }
     logMessage(L_USER, "Create query cache triggers");
     if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/createQueryCacheTriggers.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
         logMessage(L_INFO, "sphinx Query Cache Triggers created");
     } else {
         return "Failed to create QueryCacheTriggers";
     }
     logMessage(L_USER, "Populate sphinx tables");
     if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/populateSphinxEntries.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
         logMessage(L_INFO, "sphinx entries log created");
     } else {
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:Installer.class.php


注:本文中的AppConfig::replaceTokensInString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。