예제 #1
0
파일: Config.php 프로젝트: riaf/pastit
 /**
  *  設定ファイルに書き込む
  *
  *  @access private
  *  @return mixed   0:正常終了 Ethna_Error:エラー
  */
 function _setConfig()
 {
     $file = $this->_getConfigFile();
     $lh = Ethna_Util::lockFile($file, 'w');
     if (Ethna::isError($lh)) {
         return $lh;
     }
     fwrite($lh, "<?php\n");
     fwrite($lh, sprintf("/*\n * %s\n *\n * update: %s\n */\n", basename($file), strftime('%Y/%m/%d %H:%M:%S')));
     fwrite($lh, "\$config = array(\n");
     foreach ($this->config as $key => $value) {
         $this->_setConfigValue($lh, $key, $value, 0);
     }
     fwrite($lh, ");\n");
     Ethna_Util::unlockFile($lh);
     return 0;
 }
예제 #2
0
 /**
  *  設定ファイルに書き込む
  *
  *  @access private
  *  @return mixed   0:正常終了 Ethna_Error:エラー
  */
 function _setConfig()
 {
     $file = $this->_getConfigFile();
     $lh = Ethna_Util::lockFile($file, 'w');
     if (Ethna::isError($lh)) {
         return $lh;
     }
     $fp = fopen($file, 'w');
     if ($fp == null) {
         return Ethna::raiseError("ファイル書き込みエラー[%s]", E_APP_WRITE, $file);
     }
     fwrite($fp, "<?php\n");
     fwrite($fp, sprintf("/*\n * %s\n *\n * update: %s\n */\n", basename($file), strftime('%Y/%m/%d %H:%M:%S')));
     fwrite($fp, "\$config = array(\n");
     foreach ($this->config as $key => $value) {
         $this->_setConfigValue($fp, $key, $value, 0);
     }
     fwrite($fp, ");\n?>\n");
     fclose($fp);
     Ethna_Util::unlockFile($lh);
     return 0;
 }