2009-12-10 37 views
0
$wgAuth = new HttpAuthPlugin(); //After this line, control is not reachin the next line, not printin the next log. 

error_log("JITEN TEST :WGAUTH object created, Value of wgAuth is :" . $wgAuth . "\n", 3, $logfile); 

$wgHooks['UserLoadFromSession'][] = array($wgAuth,'autoAuthenticate'); 
error_log("JITEN TEST :Value of wgAuth is :" . $wgAuth . "\n", 3, $logfile); 

在上述情況下,$wgAuth = new HttpAuthPlugin();之後的代碼沒有得到執行。媒體維基php代碼中的錯誤

+0

http://www.mediawiki.org/wiki/Extension:HttpAuth – Janmejay 2009-12-10 09:41:34

回答

1

根據編寫自己的AuthPlugin的文章,該類被稱爲AuthPlugin而不是HttpAuthPlugin

因此,看來你應該使用的代碼:

$wgAuth = new AuthPlugin(); 

這是類從第三方來嗎?

+0

是的,它是一個第三方插件mediawiki.org/wiki/Extension:HttpAuth HttpAuthPlugin.php是擴展名,Mediawiki.The提到碼在LocalSettings.php和HttpAuthPlugin.php中實現了更改 – Janmejay 2009-12-10 09:40:28

+0

如果將HttpAuthPlugin init置於條件中會發生什麼?例如:if(!($ wgAuth = new HttpAuthPlugin())){echo「Error:Object not created」;}' – Anthony 2009-12-10 10:13:00

+0

我已經使用瞭如下條件:if(!($ wgAuth = new HttpAuthPlugin())) {error_log(「Error:Object Not created」。「」\ n「,3,$ logfile); } else {error_log(「Object created」。「\ n」,3,$ logfile); }但是,它沒有給出任何輸出,好像它被卡在類HttpAuthPlugin中,同時創建一個對象 – Janmejay 2009-12-10 11:32:46

-1

我已經使用的條件如下: IF(($ wgAuth =新HttpAuthPlugin())!){ error_log中( 「錯誤:對象不創建」 「\ n」,3,$日誌文件); (「Object created」。「\ n」,3,$ logfile);其他{ }其他{ error_log } 但是,它沒有給出任何輸出,好像它被卡在類HttpAuthPlugin裏面,同時創建一個對象。

+0

請發表回答 – Janmejay 2009-12-10 11:33:35