⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 is_main.pas

📁 linux subdivision ying gai ke yi le ba
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    // Check httpd.conf line by line
    for iLineNum := 0 to iArrayLen do
    begin
        sCurrentLine := aHttpdConf[iLineNum];

        // Get module status and file data with help of the modules
        if (Pos('LoadModule ', sCurrentLine) > 0 ) then
        begin
            if (ApacheModuleStatus(sCurrentLine) > 0) then
            begin
                if iPosFileModules = 0 then
                begin
                    iPosFileModules := iLineNum;
                end;

                iPosFileModulesPost := iLineNum + 1;
            end;

            //Decide placements and status of modules --------

            // dav_module: If we (for some reason) don't find dav_module then
            // we'll try to set the placement with help of cgi_module and make
            // sure that we do it _before_ a dav_fs_module.
            if ApacheModuleName(sCurrentLine) = 'dav_module' then
            begin
                iPosModDav := iLineNum;
                iStatusModDav := ApacheModuleStatus(sCurrentLine);
            end;

            if (ApacheModuleName(sCurrentLine) = 'cgi_module') and
               ((iStatusModDav = STATUS_NONE) and (iPosModDav = 0)) then
                   iPosModDav := iLineNum + 1;

            if (ApacheModuleName(sCurrentLine) = 'dav_fs_module') and
              (iStatusModDav = STATUS_NONE) then
                   iPosModDav := iLineNum - 1;

            // dav_svn_module:
            if ApacheModuleName(sCurrentLine) = 'dav_svn_module' then
            begin
                iPosModDavSvn := iLineNum;
                iStatusModDavSvn := ApacheModuleStatus(sCurrentLine);
            end;

            // authz_svn_module:
            if ApacheModuleName(sCurrentLine) = 'authz_svn_module' then
            begin
                iPosModAuthzSvn := iLineNum;
                iStatusModAuthzSvn := ApacheModuleStatus(sCurrentLine);
            end;
        end;
    end;

    // Edit httpd.conf if needed.
    if (iStatusModDav + iStatusModDavSvn + iStatusModAuthzSvn) <>
      (STATUS_ENABLED * 3) then
    begin
        ApacheConfFileEdit (aHttpdConf,
                            iPosFileModules, iPosFileModulesPost,
                            iPosModDav, iStatusModDav,
                            iPosModDavSvn, iStatusModDavSvn,
                            iPosModAuthzSvn, iStatusModAuthzSvn);
    end;
end;

// ****************************************************************************
// Name:    ApacheCopyModules
// Purpose: Extracting Apache's modules and the Berkeley DB from the
//          installation file and copy them to Apache's module directory
procedure ApacheCopyModules();
var
    sTPathTmp: String;
begin
    sTPathTmp := ExpandConstant('{tmp}');
    // extract the files from the setup to the current IS Temp folder
    ExtractTemporaryFile('libdb42.dll');
    ExtractTemporaryFile('mod_dav_svn.so');
    ExtractTemporaryFile('mod_authz_svn.so');
    ExtractTemporaryFile('intl.dll');
	
    //Copy the files from the temp dir to Apache's module foder
    FileCopy (sTPathTmp + '\libdb42.dll', g_sApachePathModules + '\libdb42.dll', False);
    FileCopy (sTPathTmp + '\mod_dav_svn.so', g_sApachePathModules + '\mod_dav_svn.so', False);
    FileCopy (sTPathTmp + '\mod_authz_svn.so', g_sApachePathModules + '\mod_authz_svn.so', False);
	FileCopy (sTPathTmp + '\intl.dll', g_sApachePathModules + '\intl.dll', False);
end;

// ****************************************************************************
// Name:    ApacheVersion
// Purpose: Returns apache.exe's version with the last number stripped.
function ApacheVersion(): String;
var
    sApacheVersion: String;
begin
    GetVersionNumbersString(g_sApachePathBin + '\apache.exe' ,sApacheVersion);
    Delete(sApacheVersion, 7, 2);
    Result := sApacheVersion;
end;

// ****************************************************************************
// Name:    VerifyApache
// Purpose: Finding/Setting Apache paths and version info
procedure VerifyApache();
var
    sMsg: String;
    sApacheVersion: String;
begin
    g_bHandleApache := True;

    // Set/check the Apache paths
    g_sApachePath := ApachePathParent;

    // apache.exe
    if g_sApachePathBin = '' then
        g_sApachePathBin := g_sApachePath + '\bin';

    if not FileExists(g_sApachePathBin + '\apache.exe') then
    begin
        sMsg := 'Could not find ''apache.exe'' in the system. Please, browse' +
                ' to the folder where the Apache binary is.';
        BrowseForFolder(sMsg , g_sApachePathBin, false);
    end;

    // httpd.conf
    if g_sApachePathConf = '' then
        g_sApachePathConf := g_sApachePath + '\conf';

    if not FileExists(g_sApachePathConf + '\httpd.conf') then
    begin
        sMsg := 'Could not find ''httpd.conf'' in the system. Please, browse' +
                ' to the folder where configuration file is.';
        BrowseForFolder(sMsg, g_sApachePathConf, false);
    end;

    // Modules folder
    if g_sApachePathModules = '' then
        g_sApachePathModules := g_sApachePath + '\modules';

    if not DirExists(g_sApachePathModules) then
    begin
        sMsg := 'Could not find the ''modules'' folder in the system. Please,' +
                ' browse to the folder where the Apache modules is.';
        BrowseForFolder(sMsg, g_sApachePathModules, false);
    end;

    // Check that we have the required Apache version and warn the user if
    // needed
    sApacheVersion := ApacheVersion;

    if CompareStr(sApacheVersion, APACHE_VER_MIN) < 0 then
    begin
        sMsg :=
            'WARNING: Apache http server version ' + sApacheVersion  + ' is detected and the'    + #13#10 +
            'Subversion modules are built for the ' + APACHE_VER_MIN + ' version of the server.' + #13#10#13#10 +
            'You are strongly encouraged to quit this setup and upgrade your'                    + #13#10 +
            'apache server first, or go back to this setup''s ''Additional Tasks'''              + #13#10 +
            'dialog box and uncheck the task of installing the Apache modules.'                  + #13#10;

            MsgBox(sMsg, mbError, MB_OK);
    end;
end;

// ****************************************************************************
// Name:    ShFolderDllNotFound
// Purpose: Checks if FILE_SHFOLDERDLL does not exist.
//          Returns True if missing and False if present.
function ShFolderDllNotFound(): Boolean;
var
    sSysDir: String;
begin
    sSysDir := ExpandConstant('{sys}');

    if FileExists(sSysDir + '\' + FILE_SHFOLDERDLL) then
    begin
        g_bShFolderNotFound := False;
    end else begin
        g_bShFolderNotFound := True;
    end;

    Result:= g_bShFolderNotFound;
end;

// ****************************************************************************
// Name:    SysFilesDownLoadInfo
// Purpose: Informs the user about missing Windows system file(s).
Procedure SysFilesDownLoadInfo;
var
    sSysFiles: String;
    sItThem: String;
    sFile: string;
    sDocument: string;
    sMsg: String;
begin
    sItThem := ' it';
    sFile := ' file';
    sDocument := ' document';

    if (g_bMsVcpNotFound and g_bShFolderNotFound) then
    begin
        sSysfiles := FILE_MSVCPDLL +  ' and ' + FILE_SHFOLDERDLL;
        sItThem := ' them';
        sFile := ' files';
        sDocument := ' documents';
    end;

    if (g_bMsVcpNotFound and not g_bShFolderNotFound) then
        sSysfiles := FILE_MSVCPDLL;

    if (g_bShFolderNotFound and not g_bMsVcpNotFound) then
        sSysfiles := FILE_SHFOLDERDLL;

    sMsg :='The' + sFile + ' ' + sSysFiles + ' was not found in the system.'                 + #13#10#13#10 +
           'Please, go to the Subversion entry in the Start Menu after the installation and' + #13#10 +
           'read the ''Download and install''' + sDocument + ' for ' + sSysfiles + '.'       + #13#10#13#10 +
           'Subversion will not work without this' + sFile + '.'                             + #13#10#13#10;

    MsgBox(sMsg, mbInformation, MB_OK);
end;

// ****************************************************************************
// Name:    VCRuntimeNotFound
// Purpose: Checks if FILE_MSVCPDLL does not exist.
//          Returns True if missing and False if present.
function VCRuntimeNotFound(): Boolean;
var
    sSysDir: String;
begin
    sSysDir := ExpandConstant('{sys}');

    if FileExists(sSysDir + '\' + FILE_MSVCPDLL) then
    begin
        g_bMsVcpNotFound := False;
    end else begin
        g_bMsVcpNotFound := True;
    end;

    Result:= g_bMsVcpNotFound;
end;

// ****************************************************************************
// The rest is build-in functions/events. (See Inno help file for  info about
// function/event names).
function InitializeSetup(): Boolean;
begin
    //Initialize some global variables
    g_bMsVcpNotFound := VCRuntimeNotFound;
    g_bShFolderNotFound := ShFolderDllNotFound;
    g_bHandleApache:= False;
    Result := True;
end;

procedure CurPageChanged(CurStep: Integer);
begin
    case CurStep of
        wpReady:      // Event after selected tasks
            if (ShouldProcessEntry('', 'apachehandler') = srYes) then
                VerifyApache;

        wpInstalling: // Event before setup is copying destination files
            if g_bHandleApache then
            begin
                ApacheServiceUninstall;
                ApacheCopyModules;
            end;
    end;
end;

procedure CurStepChanged(CurStep: Integer);
begin
    // Event after setup has copyed destination files
    if (CurStep = wpInfoBefore) and g_bHandleApache then
    begin;
        ApacheConfFileHandle;
        ApacheServiceInstall;
    end;
end;

function NextButtonClick(CurPage: Integer): Boolean;
begin
    if (CurPage = wpSelectComponents) then
        if (g_bMsVcpNotFound or g_bShFolderNotFound) then
            SysFilesDownLoadInfo();

    Result := True;
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -