📄 is_main.pas
字号:
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: 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 infoprocedure 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; // 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;///////////////////////////////////////////////////////////////////////////////// Misc. funtions used by the setup// ****************************************************************************// Name: ComponentList// Purpose: In use for UninsHs when the user wants to uninstall/repair the// installation,function ComponentList(Default: string):string;begin Result := WizardSelectedComponents(False);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;///////////////////////////////////////////////////////////////////////////////// Build in Inno Setup Pascal functions// See Inno help file for usage about this functions.// ****************************************************************************// Name: InitializeSetup// Purpose: Called during Setup's initialization.// Return False to abort Setup, True otherwise.function InitializeSetup(): Boolean;begin //Initialize some global variables g_bMsVcpNotFound := VCRuntimeNotFound; g_bShFolderNotFound := ShFolderDllNotFound; g_bHandleApache:= False; Result := True;end;// ****************************************************************************// Name: CurPageChanged// Purpose: Called after a new wizard page (specified by CurPageID) is shown.procedure CurPageChanged(CurStep: Integer);begin case CurStep of wpReady: // Event after selected tasks if IsTaskSelected('apachehandler') then VerifyApache; wpInstalling: // Event before setup is copying destination files if g_bHandleApache then begin ApacheServiceStop; //ApacheCopyModules; end; end;end;// ****************************************************************************// Name: CurStepChanged// Purpose: Event function to perform pre- and post-install tasks.procedure CurStepChanged(CurStep: TSetupStep);begin if (CurStep = ssPostInstall) and g_bHandleApache then begin; ApacheConfFileHandle; ApacheServiceStart; end;end;// ****************************************************************************// Name: NextButtonClick// Purpose: Called when the user clicks the Next button.// If you return True, the wizard will move to the next page; if you// return False, it will remain on the current page (specified by// CurPageID).function NextButtonClick(CurPage: Integer): Boolean;begin if (CurPage = wpSelectComponents) then if (g_bMsVcpNotFound or g_bShFolderNotFound) then SysFilesDownLoadInfo(); Result := True;end;// ****************************************************************************// Name: ShouldSkipPage// Purpose: Event function to determine whether or not a particular page// (specified by PageID) should be shown at all.function ShouldSkipPage(CurPage: Integer): Boolean;begin // START In use by UninsHs if Pos('/SP-', UpperCase(GetCmdTail)) > 0 then case CurPage of wpWelcome, wpLicense, wpPassword, wpInfoBefore, wpUserInfo, wpSelectDir, wpSelectProgramGroup, wpInfoAfter: Result := True; end; // END In use by UninsHsend;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -