Parametry:
-szApacheConfigFile - ścieżka z plikiem konfiguracji apache
-svPHPIniDir - parametr referencyjny (zwraca ścieżkę pliku php.ini)
-bLog - plik log
Uwaga: Parametr svPHPIniDir jest wskaźnikiem i musi być wcześniej zadeklarowany
Wartości zwracane: true/false - chyba jasne :)
function BOOL GetApachePHPIniDir(szApacheConfigFile, svPHPIniDir, bLog)
BOOL bResult;
LIST lsApache;
string szLine;
int i;
begin
if (bLog) then WriteLog(0,"* Pobieranie scieżki do php ini z konfiguracji Apache..."); endif;
bResult = FALSE;
if (Is(FILE_EXISTS,szApacheConfigFile)) then
lsApache = ListCreate(STRINGLIST);
ListReadFromFile ( lsApache, szApacheConfigFile ); //Odczyt Apache Conf
if (ListCount(lsApache)>0) then
ListSetIndex(lsApache,LISTFIRST);
for i=0 to ListCount(lsApache)-1
ListCurrentString ( lsApache, szLine );
szLine = StrTrim(szLine);
if (StrFind(szLine, "PHPIniDir")=0) then
StrSub(svPHPIniDir, szLine, 9, StrLength(szLine));
svPHPIniDir = StrTrim(svPHPIniDir);
StrReplace(svPHPIniDir,'"','',0);
StrReplace(svPHPIniDir,"/","\\",0);
if (bLog) then WriteLog(1,"- ścieżka do php.ini: "+svPHPIniDir); endif;
bResult = TRUE;
endif;
ListSetIndex(lsApache,LISTNEXT);
endfor;
endif;
endif;
ListDestroy(lsApache);
return bResult;
end;
Brak komentarzy:
Prześlij komentarz