PHP versions 4 and 5 Copyright 2008 - 2011, Catchup, Inc. 1-19-4 ikinomatsubara, fukuoka-shi fukuoka, Japan 819-0055
예제 #1
0
 /**
  * モデル名からスキーマファイルを生成する
  *
  * @return void
  * @access public
  */
 public function admin_write_schema()
 {
     $path = TMP . 'schemas' . DS;
     if (!$this->request->data) {
         $this->request->data['Tool']['connection'] = 'baser';
     } else {
         if (empty($this->request->data['Tool'])) {
             $this->setMessage('テーブルを選択してください。', true);
         } else {
             if (!$this->_resetTmpSchemaFolder()) {
                 $this->setMessage('フォルダ:' . $path . ' が存在するか確認し、存在する場合は、削除するか書込権限を与えてください。', true);
                 $this->redirect(array('action' => 'write_schema'));
             }
             if ($this->Tool->writeSchema($this->request->data, $path)) {
                 $Simplezip = new Simplezip();
                 $Simplezip->addFolder($path);
                 $Simplezip->download('schemas');
                 exit;
             } else {
                 $this->setMessage('スキーマファイルの生成に失敗しました。', true);
             }
         }
     }
     /* 表示設定 */
     $this->pageTitle = 'スキーマファイル生成';
     $this->help = 'tools_write_schema';
 }
예제 #2
0
 /**
  * モデル名からスキーマファイルを生成する
  *
  * @return void
  * @access public
  */
 function admin_write_schema()
 {
     $path = TMP . 'schemas' . DS;
     if (!$this->data) {
         $this->data['Tool']['connection'] = 'baser';
     } else {
         if (empty($this->data['Tool'])) {
             $this->Session->setFlash('テーブルを選択してください。');
         } else {
             if (!$this->_resetTmpSchemaFolder()) {
                 $this->Session->setFlash('フォルダ:' . $path . ' が存在するか確認し、存在する場合は、削除するか書込権限を与えてください。');
                 $this->redirect(array('action' => 'admin_write_schema'));
             }
             if ($this->Tool->writeSchema($this->data, $path)) {
                 App::import('Vendor', 'Simplezip');
                 $Simplezip = new Simplezip();
                 $Simplezip->addFolder($path);
                 $Simplezip->download('schemas');
                 exit;
             } else {
                 $this->Session->setFlash('スキーマファイルの生成に失敗しました。');
             }
         }
     }
     /* 表示設定 */
     $this->pageTitle = 'スキーマファイル生成';
 }
예제 #3
0
 /**
  * 初期データセットをダウンロードする 
  */
 public function admin_download_default_data_pattern()
 {
     /* コアのCSVを生成 */
     $tmpDir = TMP . 'csv' . DS;
     $Folder = new Folder();
     $Folder->create($tmpDir);
     emptyFolder($tmpDir);
     clearAllCache();
     $excludes = array('plugins', 'dblogs', 'users', 'favorites');
     $this->_writeCsv('baser', 'core', $tmpDir, $excludes);
     /* プラグインのCSVを生成 */
     $plugins = CakePlugin::loaded();
     foreach ($plugins as $plugin) {
         $Folder->create($tmpDir . $plugin);
         emptyFolder($tmpDir . $plugin);
         $this->_writeCsv('plugin', $plugin, $tmpDir . $plugin . DS);
     }
     /* site_configsの編集 (email / google_analytics_id / version) */
     $targets = array('email', 'google_analytics_id', 'version');
     $path = $tmpDir . 'site_configs.csv';
     $fp = fopen($path, 'a+');
     $records = array();
     while (($record = fgetcsvReg($fp, 10240)) !== false) {
         if (in_array($record[1], $targets)) {
             $record[2] = '';
         }
         $records[] = '"' . implode('","', $record) . '"';
     }
     ftruncate($fp, 0);
     fwrite($fp, implode("\n", $records));
     /* ZIPに固めてダウンロード */
     $fileName = 'default';
     $Simplezip = new Simplezip();
     $Simplezip->addFolder($tmpDir);
     $Simplezip->download($fileName);
     emptyFolder($tmpDir);
     exit;
 }
예제 #4
0
 /**
  * ログフォルダを圧縮ダウンロードする
  *
  * @return bool
  */
 protected function _downloadErrorLog()
 {
     $tmpDir = TMP . 'logs' . DS;
     $Folder = new Folder($tmpDir);
     $files = $Folder->read(true, true, false);
     if (count($files[0]) === 0 && count($files[1]) === 0) {
         return false;
     }
     // ZIP圧縮して出力
     $fileName = 'basercms_logs_' . date('Ymd_His');
     $Simplezip = new Simplezip();
     $Simplezip->addFolder($tmpDir);
     $Simplezip->download($fileName);
     return true;
 }