歡迎光臨, 訪客. 請先 登入註冊一個帳號.
五月 04, 2024, 12:56:46 上午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
  列出文章
頁: 1 2 3 [4]
46  開發 / 核心補強 / 聯結不到資料庫時如何轉向其他備份頁面 於: 六月 03, 2005, 11:11:21 上午
引用
markwu 寫到:
引用
lss 寫到:
引用
WhiteCloud 寫到:
在 pLog 總站的文件中發現了一篇 MVC 的文件,就開始K 吧....

http://wiki.lifetype.net/index.php/Model-View-Controller_in_pLog

哇!這個很精采哦!

加油!



對 MVC 有興趣可以看一下 ROR (Ruby on Rails) 跟 Prado (PHP5) 這兩個 Framework, 資料目前也比較多喔。正在K書中.... 微笑

Mark


引用
忘了說,如果熟 Java ,可以看 Struts ... 他的資源大概是目前最多的。

Mark


非常感謝 Mark 提供這些資訊和 lss 的鼓勵 微笑

Java 我經驗不多,Ruby 更是沒用過,看來我要努力的還多著呢 吐舌頭

Mark 所說的正好都有網站,列出給所有有興趣的朋友參考:

http://www.rubyonrails.org/
http://www.xisc.com/
http://struts.apache.org/
47  開發 / 核心補強 / 聯結不到資料庫時如何轉向其他備份頁面 於: 六月 02, 2005, 12:55:44 下午
在 pLog 總站的文件中發現了一篇 MVC 的文件,就開始K 吧....

http://wiki.lifetype.net/index.php/Model-View-Controller_in_pLog
48  開發 / 核心補強 / 聯結不到資料庫時如何轉向其他備份頁面 於: 六月 02, 2005, 12:04:09 下午
如果要完整的備份方案, Mark 的匯出匯入 RSS
http://forum.lifetype.org.tw/index.php?topic=713.0
才是更好的方法。:-)

這是不得已的方法,因為 PHP 似乎都 OK,但是 MySQL 在某個時段會有問題(不知道是不是固定的維護時間)。

哈,這支簡單程式竟然忘了用變數指定 Database,趕快改正。 :P

請問這種錯誤處理該從哪下手較好,我對 pLog 的整個架構還不清楚.... 有沒有對於架構的相關描述文件呢?
49  開發 / 核心補強 / 聯結不到資料庫時如何轉向其他備份頁面 於: 六月 01, 2005, 04:43:29 下午
這應該不是外掛的功能(當然,我有可能猜錯了 :P)

由於我用的虛擬主機,偶爾會連不上 MySQL,我就自己寫了個簡單程式輸出靜態頁面 HTML 作為備份。

請問我應該從那裡下手去改錯誤處理呢?

從錯誤訊息來看,可能是連結 MySQL 太多 threads 或是 memory 不足的錯誤,這是 pLog 的處理範圍嗎?

環境:
-----------------------------------------
Linux(不知道是哪個版本)
Apache Release    10333100
Apache API Version    19990320
PHP Version 4.3.11
MySQL Client API version    4.0.24
-----------------------------------------

我的超簡單輸出程式如下,提供給需要的人。
(由於這支程式輸出全部文章到同一個檔案,文章很多的人可能要考慮清楚這樣做是否合適,或者依情況自行修改)
----------------

<?php
// 參數設定

// 資料庫所在
$strMySQL = "xxx";
// 資料庫名稱
$strDatabase = "xxx";
// 資料庫使用者名稱
$strUserName = "xxx";
// 資料庫密碼
$strPassword = "xxx";
// plog 的資料表字首
$strPlogPrefix = "xxx";
// 輸出路徑,最後面要加斜線(目錄要設定為可讀寫,例如777)
$strArticleIndexPath = "xxx";
// 輸出備份檔名
$strOutput = "xxx";


// 聯結資料庫
$link = mysql_connect($strMySQL, $strUserName, $strPassword) or
die("mysql_connect() failed.");

mysql_select_db($strDatabase, $link) or
die("mysql_select_db() failed.");

// 放文章的變數
$strFileContent = <<<EOT
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh_TW"  lang="zh_TW" dir="ltr">
 <head>
  <title>White Cloud's Blog</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>

<body><center>
<font size=6 color=green>White Cloud's Blog</font>
<br>目前暫時連結不上資料庫,這是備份頁面<br><br>
EOT;

$strTable = $strPlogPrefix."articles_text";

   $sql = "select article_id,topic,text from $strTable order by article_id desc";

   $r = mysql_query($sql);

   while ($row = mysql_fetch_object($r)) {

    $strArticleID = $row->article_id;

    $strTopic = $row->topic;

    $strText = $row->text;
   
$strFileContent = $strFileContent.'<table width="80%" border="1"><tr><td>';
// $strFileContent = $strFileContent.$strArticleID;
// $strFileContent = $strFileContent."<br>";
 $strFileContent = $strFileContent.'<font size=5><b>';
 $strFileContent = $strFileContent.$strTopic;
 $strFileContent = $strFileContent.'</b></font>';
 $strFileContent = $strFileContent."<br><br>";
 $strFileContent = $strFileContent.$strText;
 $strFileContent = $strFileContent."<br><br>";
$strFileContent = $strFileContent."<td><tr><table><br><br>";

    }

$strFileContent = $strFileContent."All content copyright 咖啡杯 2004 White Cloud's Blog";

$strFileContent = $strFileContent."</center></body></html>";
 
 
// 輸出成為 HTML   
//echo  $strFileContent;   
$fp = fopen($strArticleIndexPath.$strOutput, "w");
      fputs($fp, $strFileContent);
fclose($fp);

echo "OK";   
?>
50  開發 / 核心補強 / Server 位在國外時修正日曆顯示問題 於: 五月 17, 2005, 11:42:53 下午
Hi Mark:


首先感謝 Mark 和其他開發人員的努力,讓大家有這麼棒的軟體可以享用。:-)

其實我也希望開發團隊能夠把這個問題考慮進去,這樣使用者就不需要重新發明輪子(而且這輪子看起來蠻笨拙 :P),因為網際網路跨越國界,所以使用到跨時區的 Server 這種事情應該常有。

不過開發團隊是不是有什麼考量才沒有這樣做吧...
51  開發 / 核心補強 / Server 位在國外時修正日曆顯示問題 於: 五月 17, 2005, 03:55:39 下午
pLog 一直讓我覺得很不錯,除了一點,日曆顯示不正確 :-(

我用 Google 找了半天,沒找到中文資料解決這個問題,只好自己 DIY 了。

看起來日曆是抓預設的系統日期,由於我用的 Server 所在的時區比台灣慢 16 小時,因此找到抓系統日期的地方就好辦了,於是開始追蹤程式,一路追追追....

找到了兩個相關程式:

一個負責前端的日曆顯示 -- /class/data/htmlcalendar.class.php
改三個地方(註解掉的是原來程式):
1.
    function getCurrentMonthView()
    {
// 2005.05.17 update because local time area
//        $d = getdate(time());
        $d = getdate(time()+57600);
        return $this->getMonthView($d["mon"], $d["year"]);
    }
2.
    function getCurrentYearView()
    {
// 2005.05.17 update because local time area
//       $d = getdate(time());
        $d = getdate(time()+57600);
        return $this->getYearView($d["year"]);
    }
3.
        // Make sure we know when today is, so that we can use a different CSS style
// 2005.05.17 update because local time area
//        $today = getdate(time());
        $today = getdate(time()+57600);

一個負責後端貼新文章的預設日期時間 --
/class/data/Date.class.php

    function Date($date = null)
    {
        $this->tz = Date_TimeZone::getDefault();
        if (is_null($date)) {
// 2005.05.17  update because local time area

//            $this->setDate(date("Y-m-d H:i:s"));
            $this->setDate(date("Y-m-d H:i:s",time()+57600));
        } elseif (is_a($date, 'Date')) {
            $this->copy($date);
        } else {
            $this->setDate($date);
        }
    }

傳至 Server 上面後,yahoo :-)

這是簡單的暫時解決方案,應該重新改寫各個類別才是王道吧 :P

對了,『網誌伺服器與您所在地的時間差』這項設定要設定為『0 小時』。
頁: 1 2 3 [4]