/** * Step 5: 設定ファイルの生成 * データベース設定ファイル[database.php] * インストールファイル[install.php] * * @return void * @access public */ public function step5() { $this->pageTitle = 'baserCMSのインストール完了!'; Cache::config('default', array('engine' => 'File')); if (!BC_INSTALLED) { $installationData = $this->Session->read('Installation'); $installationData['lastStep'] = true; checkTmpFolders(); Configure::write('Cache.disable', false); // インストールファイルでセッションの保存方法を切り替える為、インストール情報をキャッシュに保存 Cache::write('Installation', $installationData, 'default'); // データベース設定を書き込む $this->BcManager->createDatabaseConfig($this->_readDbSetting()); // インストールファイルを生成する $secritySalt = $this->Session->read('Installation.salt'); $secrityCipherSeed = $this->Session->read('Installation.cipherSeed'); $this->BcManager->createInstallFile($secritySalt, $secrityCipherSeed); //================================================================== // BcManagerComponent::createPageTemplates() を実行する際、 // 固定ページでプラグインを利用している場合あり、プラグインがロードされていないとエラーになる為、 // リダイレクト前にコアプラグインの有効化とテーマ保有のプラグインのインストールを完了させておく // ================================================================= // データベースのデータを初期設定に更新 $this->BcManager->executeDefaultUpdates($this->_readDbSetting(Cache::read('Installation', 'default'))); // テーマを配置する $this->BcManager->deployTheme(); $dbDataPattern = $this->Session->read('Installation.dbDataPattern'); list($theme, $pattern) = explode('.', $dbDataPattern); loadSiteConfig(); App::build(array('Plugin' => array_merge(array(BASER_THEMES . Configure::read('BcSite.theme') . DS . 'Plugin' . DS), App::path('Plugin')))); $themesPlugins = BcUtil::getCurrentThemesPlugins(); if ($themesPlugins) { foreach ($themesPlugins as $plugin) { $this->BcManager->installPlugin($plugin); CakePlugin::load($plugin); $this->BcManager->resetTables('plugin', $dbConfig = null, $plugin); $this->BcManager->loadDefaultDataPattern('plugin', null, $pattern, $theme, $plugin); } } clearAllCache(); if (function_exists('opcache_reset')) { opcache_reset(); } $this->redirect('step5'); } else { $installationData = Cache::read('Installation', 'default'); if (empty($installationData['lastStep'])) { return; } } // ログイン $this->_login(); // テーマに管理画面のアセットへのシンボリックリンクを作成する $this->BcManager->deployAdminAssets(); // アップロード用初期フォルダを作成する $this->BcManager->createDefaultFiles(); // エディタテンプレート用の画像を配置 $this->BcManager->deployEditorTemplateImage(); // Pagesファイルを生成する $this->BcManager->createPageTemplates(); $this->Session->delete('InstallLastStep'); }
if (BC_INSTALLED) { require APP . 'Config' . DS . 'session.php'; } /** * パラメーター取得 */ $url = getUrlFromEnv(); // 環境変数からパラメータを取得 $parameter = getUrlParamFromEnv(); Configure::write('BcRequest.pureUrl', $parameter); // ※ requestActionに対応する為、routes.php で上書きされる if (BC_INSTALLED) { /** * tmpフォルダ確認 */ checkTmpFolders(); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('debug', array('engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); CakeLog::config('error', array('engine' => 'FileLog', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error')); CakeLog::config('update', array('engine' => 'FileLog', 'types' => array('update'), 'file' => 'update')); /** * キャッシュ設定 */ $cacheEngine = Configure::read('BcCache.engine'); $cachePrefix = Configure::read('BcCache.prefix'); $cacheDuration = Configure::read('BcCache.duration'); // モデルスキーマ Cache::config('_cake_model_', array('engine' => $cacheEngine, 'prefix' => $cachePrefix . 'cake_model_', 'path' => CACHE . 'models' . DS, 'serialize' => $cacheEngine === 'File', 'duration' => $cacheDuration));
/** * 必要な一時フォルダが存在するかチェックし、なければ生成する */ public function testCheckTmpFolders() { checkTmpFolders(); $paths = array(TMP . 'logs', TMP . 'sessions', TMP . 'schemas', TMP . 'schemas' . DS . 'core', TMP . 'schemas' . DS . 'plugin', CACHE, CACHE . 'models', CACHE . 'persistent', CACHE . 'views', CACHE . 'datas', CACHE . 'environment'); // フォルダが生成されているかチェック $result = true; foreach ($paths as $key => $value) { if (!is_dir($value)) { $result = false; } } $this->assertTrue($result, '一時フォルダが正しく生成されていません'); }
/** * Step 5: 設定ファイルの生成 * データベース設定ファイル[database.php] * インストールファイル[install.php] * * @return void * @access public */ function step5() { $message = ''; // インストールファイルを生成する if (!$this->_createInstallFile()) { if ($message) { $message .= '<br />'; } $message .= '/app/config/install.php インストール設定ファイルの設定ができませんでした。パーミションの確認をしてください。'; } // tmp フォルダを作成する checkTmpFolders(); // ブログの投稿日を更新 $this->_updateEntryDate(); // プラグインのステータスを更新 $this->_updatePluginStatus(); // ログイン $this->_login(); // テーマを配置する $this->BaserManager->deployTheme(); $this->BaserManager->deployTheme('skelton'); // pagesファイルを生成する $this->_createPages(); // データベース設定を書き込む $this->_writeDatabaseConfig($this->_readDbSettingFromSession()); // デバッグモードを0に変更 $this->writeDebug(0); if ($message) { $this->setFlash($message); } $this->pageTitle = 'BaserCMSのインストール完了!'; }
/** * baserCMSのインストール * * @param type $dbConfig * @param type $adminUser * @param type $adminPassword * @param type $adminEmail * @return boolean */ public function install($siteUrl, $dbConfig, $adminUser = array(), $baseUrl = '', $dbDataPattern = '') { if (!$dbDataPattern) { $dbDataPattern = Configure::read('BcApp.defaultTheme') . '.default'; } $result = true; // キャッシュ削除 clearAllCache(); // 一時フォルダ作成 checkTmpFolders(); if ($dbConfig['datasource'] == 'sqlite' || $dbConfig['datasource'] == 'csv') { switch ($dbConfig['datasource']) { case 'sqlite': $dbFolderPath = APP . 'db' . DS . 'sqlite'; break; case 'csv': $dbFolderPath = APP . 'db' . DS . 'csv'; break; } $Folder = new Folder(); if (!is_writable($dbFolderPath) && !$Folder->create($dbFolderPath, 0777)) { $this->log('データベースの保存フォルダの作成に失敗しました。db フォルダの書き込み権限を見なおしてください。'); $result = false; } } // SecritySaltの設定 $securitySalt = $this->setSecuritySalt(); $securityCipherSeed = $this->setSecurityCipherSeed(); // インストールファイル作成 if (!$this->createInstallFile($securitySalt, $securityCipherSeed, $siteUrl)) { $this->log('インストールファイル生成に失敗しました。設定フォルダの書き込み権限を見なおしてください。'); $result = false; } // データベース設定ファイル生成 if (!$this->createDatabaseConfig($dbConfig)) { $this->log('データベースの設定ファイル生成に失敗しました。設定フォルダの書き込み権限を見なおしてください。'); $result = false; } // データベース初期化 if (!$this->constructionDb($dbConfig, $dbDataPattern)) { $this->log('データベースの初期化に失敗しました。データベースの設定を見なおしてください。'); $result = false; } if ($adminUser) { // サイト基本設定登録 if (!$this->setAdminEmail($adminUser['email'])) { $this->log('サイト基本設定への管理者メールアドレスの設定処理が失敗しました。データベースの設定を見なおしてください。'); } // ユーザー登録 $adminUser['password_1'] = $adminUser['password']; $adminUser['password_2'] = $adminUser['password']; if (!$this->addDefaultUser($adminUser)) { $this->log('初期ユーザーの作成に失敗しました。データベースの設定を見なおしてください。'); $result = false; } } // データベースの初期更新 if (!$this->executeDefaultUpdates($dbConfig)) { $this->log('データベースのデータ更新に失敗しました。データベースの設定を見なおしてください。'); $result = false; } // コアプラグインのインストール if (!$this->installCorePlugin($dbConfig, $dbDataPattern)) { $this->log('コアプラグインのインストールに失敗しました。'); $result = false; } // テーマを配置 if (!$this->deployTheme()) { $this->log('テーマの配置に失敗しました。テーマフォルダの書き込み権限を確認してください。'); $result = false; } // テーマに管理画面のアセットへのシンボリックリンクを作成する if (!$this->deployAdminAssets()) { $this->log('管理システムのアセットファイルの配置に失敗しました。テーマフォルダの書き込み権限を確認してください。'); } // アップロード用初期フォルダを作成する if (!$this->createDefaultFiles()) { $this->log('アップロード用初期フォルダの作成に失敗しました。files フォルダの書き込み権限を確認してください。'); $result = false; } // エディタテンプレート用の画像を配置 if (!$this->deployEditorTemplateImage()) { $this->log('エディタテンプレートイメージの配置に失敗しました。files フォルダの書き込み権限を確認してください。'); $result = false; } //SiteConfigを再設定 loadSiteConfig(); // ページファイルを生成 $this->createPageTemplates(); return $result; }
/** * Step 5: 設定ファイルの生成 * データベース設定ファイル[database.php] * インストールファイル[install.php] * * @return void * @access public */ function step5() { $this->pageTitle = 'baserCMSのインストール完了!'; $db = ConnectionManager::getInstance(); if ($db->config->baser['driver'] == '') { // データベース設定を書き込む $this->_writeDatabaseConfig($this->_readDbSettingFromSession()); // DB設定ファイルを再読み込みする為リダイレクトする $this->redirect('step5'); } elseif (isInstalled()) { return; } $message = ''; // インストールファイルを生成する if (!$this->_createInstallFile()) { if ($message) { $message .= '<br />'; } $message .= '/app/config/install.php インストール設定ファイルの設定ができませんでした。パーミションの確認をしてください。'; } // tmp フォルダを作成する checkTmpFolders(); // ブログの投稿日を更新 $this->_updateEntryDate(); // プラグインのステータスを更新 $this->_updatePluginStatus(); // ログイン $this->_login(); // テーマを配置する $this->BaserManager->deployTheme(); $this->BaserManager->deployTheme('skelton'); // pagesファイルを生成する $this->_createPages(); ClassRegistry::removeObject('View'); // デバッグモードを0に変更 $this->writeDebug(0); if ($message) { $this->setFlash($message); } }
/** * Step 5: 設定ファイルの生成 * データベース設定ファイル[database.php] * インストールファイル[install.php] * * @return void * @access public */ function step5() { $this->pageTitle = 'baserCMSのインストール完了!'; if (!BC_INSTALLED) { $installationData = $this->Session->read('Installation'); $installationData['lastStep'] = true; checkTmpFolders(); Configure::write('Cache.disable', false); Cache::config('default', array('engine' => 'File')); // インストールファイルでセッションの保存方法を切り替える為、インストール情報をキャッシュに保存 Cache::write('Installation', $installationData, 'default'); // データベース設定を書き込む $this->_writeDatabaseConfig($this->_readDbSettingFromSession()); // インストールファイルを生成する $this->_createInstallFile(); $this->redirect('step5'); } elseif (BC_INSTALLED) { $installationData = Cache::read('Installation', 'default'); if (empty($installationData['lastStep'])) { return; } } // ブログの投稿日を更新 $this->_updateEntryDate(); // プラグインのステータスを更新 $this->_updatePluginStatus(); // ログイン $this->_login(); // テーマを配置する $this->BcManager->deployTheme(); $this->BcManager->deployTheme('skelton'); // pagesファイルを生成する $this->_createPages(); ClassRegistry::removeObject('View'); $this->Session->delete('InstallLastStep'); }