Installation help

 
 
Me !
Language pack installation
 
I've had this problem for a while, but i'm currently trying to do a new installation of Moodle 1.7 and have hit it again.

The language pack install page always seems to hang when I try to download the language packs, I can see the list of languages, select the ones I want and the click the download button, but it always jams at this point for about 5 minutes and eventually fails with a 'cannot download components' message.

We do use a proxy for http access and I have this configured within moodle, if I remove the proxy setting in Moodle, then the page which displays the list of available languages also hangs, so it would seem that the proxy setting is correct and that it is being ignored for the actual download, or that the download is being performed using some other mechanism that is blocked on our network.

Has anybody else had this problem ? It would be really handy if there was a single download available that contained all of the language packs, installing them seperatly without the benefit of this automatic installer is a real chore.
 
Average of ratings: -
Picture of Magnus Larsson
Re: Language pack installation
 
I have a similar, though not identical, problem. After upgrade from 1.5 to 1.7, installing a new language pack does not work. I can choose it in the Langue pack chooser, and click on Install selected language pack. Screen changes, and the pack disappears from the list to the right, but does NOT show up to the left, and is NOT available in chooser.

I temporarily solved it by copying manually the most important packs from my 1.5-directory to the 1.7 lang dir, and that worked, I can now choose and use it. But what about the language pack selector??

Magnus Larsson
 
Average of ratings: -
Picture of Dirk Wingenter
Re: Language pack installation
 
I have exactly the same problem after doing a clean 1.7 install. Any suggestions how to fix this or at least how to isolate the problem?

Dirk Wingenter
 
Average of ratings: -
Picture of cecilia dal bon
Re: Language pack installation
 
We had the same problem migrating from 1.5 to 1.6 and we solved it setting in config.php :
$CFG->unicodedb = '1'

cecilia

 
Average of ratings: -
Picture of Dirk Wingenter
Re: Language pack installation
 
That was it. It's working perfectly now.
Thanks for the hint towards the unicode settings! Should have read the notifications more carefully!

Dirk.
 
Average of ratings: -
Picture of Avelino Silva
Re: Language pack installation
 

I am just installing moodle version 1.7+ and I have problems when installing the portuguese language option.

Well, I tried to change the configuration line as suggested, from

$CFG->unicodedb=true

to

$CFG->unicodedb='1'

(that it seems to be the same, true = 1 isn't ?)

and got with both options the same time out error

Warning: fopen(http://download.moodle.org/lang16/languages.md5) [function.fopen]: failed to open stream: Connection timed out in /mnt/hdb1/moodle/lib/componentlib.class.php on line 461

I check the proxy option and is working (for example, the theme options work).

I also download the respective zip file pt_utf8.zip and made unzip inside the file .../moodledata/lang and isn't work too (also I click the botton of update language package and nothing happened).

The site seems to work fine in all other aspects.

Any idea?

avelino


 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Language pack installation
 

Same problem here.

Fatal error: Maximum execution time of 60 seconds exceeded in C:\MoodleWindowsInstaller-latest-16\moodle\moodle\lib\componentlib.class.php on line 461

Anyone found a solution?

 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
I found out a cause of the problem.

You are caught in the trouble if your moodle-server connects with Internet via a proxy server.

In moodle/lib/componentlib.class.php, fopen(), fgets() and file_get_contents() are used, however, these functions can not reach to "http://www.moodle.org/" through the proxy-server. On the ohter hand, you can obtain the list of language packs on the web, since proxy_url() function are provided in langimport.php.


To avoid this problem, you must modified moodle/lib/componentlib.class.php.

I solved this problem, but I'm beginner of PHP programing. I only point out several points concerning this problem.

(1) fopen() + fgets()
[Line 462-]
if ($fp = fopen($source, 'r')) {
/// Read from URL, each line will be one component
while(!feof ($fp)) {
$availablecomponents[] = split(',', fgets($fp,1024));
}
fclose($fp);

(2) file_get_contents()
[Line 274]
if ($contents = file_get_contents($source)) {

(3) file_get_contents()
[Line 393]
if ($temp = file_get_contents($source)) {


 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Language pack installation
 

Hi Tatsuya,

thanks for posting some pointers!

Sadly, my PHP isn't so good yet. I checked my moodle/lib/componentlib.class.php and the lines you pointed out are the same in my install. You said you have solved the problem - have you any code to replace these parts?

Matt

 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
Hi Matt,

you are right. I just only pointed out no-good statements.
I had prepared my moodle/lib/componentlib.class.php, then my system got possible to download selected language pack. But, It's not perfect;

Download selected language pack: OK
Delete selected language pack : OK
Update all language pack : NG

Maybe, there are some bugs yet.

----- if you want, let's try to apply following modification for your system.
Blue : original
Red : Modification (adding)

(1) Line 273
$zipfile= $CFG->dataroot.'/temp/'.$this->zipfilename;
// if ($contents = file_get_contents($source)) {
if ($contents = $this->proxy_file_get_contents($source)) {
(2) Line 460
$availablecomponents = array();
if ($availablecomponents = $this->proxy_url($source)) {
/* if ($fp = fopen($source, 'r')) {
/// Read from URL, each line will be one component
while(!feof ($fp)) {
$availablecomponents[] = split(',', fgets($fp,1024));
}
fclose($fp);
*/
(3) Line 516
function get_extra_md5_field() {
return $this->extramd5info;
}

//returns an array of languages, or false if can not read from source
//uses a socket if proxy is set as a config variable
function proxy_url($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
$i = 0;
while(!feof($proxy_fp)) {
$string = fgets($proxy_fp, 1024);
if ($i > 11) { //12 lines of info skipped
$availablelangs[] = split(',', $string);
}
$i++;
}
fclose($proxy_fp);
} else { //proxy not in use
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
} else { /// fopen failed, return false.
return false;
}
}
return $availablelangs;
}

// based on proxy_url() modified by T.Shirai
function proxy_file_get_contents($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
$i = 0;
$contents = "";
while(!feof($proxy_fp)) {
if ($i <= 11) fgets($proxy_fp, 1024); else {
$contents .= fread($proxy_fp, 8192);
}
$i++;
}
fclose($proxy_fp);
} else { //proxy not in use
if (!$contents = file_get_contents($url)) return false;
}
return $contents;
}
} /// End of component_installer class
-----------------
Following statement does not need to modiy in Line 393
if ($temp = file_get_contents($source)) {
Now, I retry to update language pack automatically, it's finished successfully. Oh!

 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
Sorry, Updateing language pack does not complete successfully.

We must fix following part in both of admin/langimport.php and lib/componentlib.class.php.

In proxy_url() function, final time of getting $string from $proxy_fp, $string contain null strings (=blank, ""), then foreach() in langimport.php occurs error.

//returns an array of languages, or false if can not read from source
//uses a socket if proxy is set as a config variable
function proxy_url($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {
$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");
$i = 0;
while(!feof($proxy_fp)) {
$string = fgets($proxy_fp, 1024);
if (strlen($string) > 0 && $i > 11) { //12 lines of info skipped
$availablelangs[] = split(',', $string);
}
$i++;
}
fclose($proxy_fp);
} else { //proxy not in use
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
} else { /// fopen failed, return false.
return false;
}
}
return $availablelangs;
}
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Language pack installation
 
Hi Tatsuya,

just tried to apply this fix, but although the first set of changes seems ok, the second ones (admin/langimport.php) don't fit as I thinkthe code has changed in 1.8.

Matt
 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators

I guess that the second ones were already fixed in MDL-8653.

----
Now, I don't use download/update language pack functions becase I customize my language pack which does not equal to uploaded one.

I download updated language pack manually, then update different parts between newest language pack and my current language pack by using WinMerge(Windows application).

----
I'm using moodle1.8+ too.
Ok, I try to modify this problem.

 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
comfirmed that language update/download function runs successfully in moodle1.8+ based on just only following modifications.笑顔

New proxy_ulr() function modified by MDL-8653 is correct. Reuse it in this modification (purple colored block).
proxy_file_get_contents() function is changed base on new proxy_url().

-----
Blue : original
Red : Modification (adding)
Purple : Copy from admin/langimport.php (function proxy_url() : line363)

(1) Line 273
$zipfile= $CFG->dataroot.'/temp/'.$this->zipfilename;
// if ($contents = file_get_contents($source)) {
if ($contents = $this->proxy_file_get_contents($source)) {
(2) Line 460
$availablecomponents = array();
if ($availablecomponents = $this->proxy_url($source)) {
/* if ($fp = fopen($source, 'r')) {
/// Read from URL, each line will be one component
while(!feof ($fp)) {
$availablecomponents[] = split(',', fgets($fp,1024));
}
fclose($fp);
*/
(3) Line 516
function get_extra_md5_field() {
return $this->extramd5info;
}

//returns an array of languages, or false if can not read from source
//uses a socket if proxy is set as a config variable
function proxy_url($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {

$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");

$headers_done = false;
while(!feof($proxy_fp)) {
$string = fgets($proxy_fp, 1024);
if(!$headers_done){
// A new line indicates end of HTTP headers
$headers_done = ("\r\n" == $string);
} else {
$availablelangs[] = split(',', $string);
}
}
fclose($proxy_fp);

} else { //proxy not in use
if ($fp = fopen($url, 'r')){ /// attempt to get the list from Moodle.org.
while(!feof ($fp)) {
$availablelangs[] = split(',', fgets($fp,1024));
}
} else { /// fopen failed, return false.
return false;
}
}
return $availablelangs;
}

// based on proxy_url() modified by T.Shirai
function proxy_file_get_contents($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {

$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n");

$headers_done = false;
$contents = '';
while(!feof($proxy_fp)) {
if(!$headers_done){
// A new line indicates end of HTTP headers
$string = fgets($proxy_fp, 1024);
$headers_done = ("\r\n" == $string);
} else {
$contents .= fread($proxy_fp, 8192);
}
}
fclose($proxy_fp);

} else { //proxy not in use
if (!$contents = file_get_contents($url)) return false;
}
return $contents;
}
} /// End of component_installer class
-----------------
 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
I forgot...
The modification is for moodle/lib/componentlib.class.php.

 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Language pack installation
 

It worked!

Thanks a lot smile

Matt

 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
Hi matt.

I have read your comment in MootleTracker. Thanx!.
http://tracker.moodle.org/browse/MDL-8752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_34808

This problem will fix at Moodle2.0, but I guess that you can not wait itウインク.

Attached moodle/lib/componentlib.class.php is for current version (1.8.2+, 2007/09/14). Try this one!

---
//$Id: componentlib.class.php,v 1.6 2006/04/16 15:56:36
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Language pack installation
 
This works perfectly! Thanks a lot smile Lets hope it gets into CVS soon.
 
Average of ratings: -
Picture of Dave McGarry
Re: Language pack installation
 
I'm having a problem with the langimport.php file - where can I find the working version for 1.8+ don't understand how to patch the file.

Thanks for any help!
 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators

If your Moodle server is using a proxy server to connecting for internet, and you are using Moodle1.8.2+, you just only copy a componentlib.class.php which is posted by me, for moodle/lib folder.

I have added coments ("// (T.Shirai)") in posted componentlib.class.php at the points of modifications. You can find out where are changed from original source.

#Sorry, maybe my english is not easy to read...

 
Average of ratings: -
Picture of Dave McGarry
Re: Language pack installation
 
We are using 1.8+

We do have a proxy server, I've replaced componentlib.class.php with your edited file but it I still get this error

Fatal error: Maximum execution time of 30 seconds exceeded in E:\data1\webroot\asfc18\admin\langimport.php on line 374

Your English is fine smile
 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
OK.

You can choose from two ways. One is upgrading Moodle1.8 to Moodle1.8.2+. And the other one is appying modification for langimport.php according to the post in 2007/3/7. This modification is very simple, inserting "strlen($string) > 0 &&" only.

I recommend upgrading to Moodle1.8.2+, however if you do not like to upgrade whole system, you replace old langimportlib.php with newest one.


See also MDL-8653.
 
Average of ratings: -
Picture of Dave McGarry
Re: Language pack installation
 
Well I have two instances of Moodle on my server - one is 1.8 and the other I have just upgraded to 1.8.2

Neither versions load the language packs???? sad
 
Average of ratings: -
1997年頃(結婚前)の写真です...
Re: Language pack installation
Group Translators
> Fatal error: Maximum execution time of 30 seconds exceeded in
> E:\data1\webroot\asfc18\admin\langimport.php
on line 374

function proxy_url($url) {
global $CFG;

if ($CFG->proxyhost && $CFG->proxyport) {

$proxy_fp = fsockopen($CFG->proxyhost, $CFG->proxyport);
if (!$proxy_fp) {
return false; //failed
}
fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n"); <= This Line is 374.

You had already set $CFG->proxyhost and $CFG->proxyport by using "Site Administration -> Server -> HTTPS".
I have suspected that the settings of an address and a port number of proxy server are not right.

For example, my settings are as follows;

Proxy host http-p.srv.cc.suzuka-ct.ac.jp
Proxy port 8080

(But, if your proxy-settings are not right, $proxy_fp = fsockopen() will return false;)

Therefore, you should check that your proxy sever allows your moodle site connecting to internet via proxy server. When the proxy server settings are fine, you can obtain whole list of provided language packs on moodle.org, even though you can not download / upgrade a selected language pack for your moodle site.

 
Average of ratings: -
In Office
Re: Language pack installation
 
Thank you Tatsuya your suggestions help me to resolve my problem related to Language Packs. My proxy server setting were wrong.
Your suggestions helped me very well.
Thank you once again.

Abhijit.
 
Average of ratings: -