jmertic         Thu May 21 02:41:06 2009 UTC

  Added files:                 
    /win-installer      PHPInstallerScripts53.vbs 

  Modified files:              
    /win-installer      PHPInstallerBase53.wxs PHPInstallerBase53NTS.wxs 
  Log:
  Bug 47855: Remove references to apache13 sapi in vbs custom actions.
  
http://cvs.php.net/viewvc.cgi/win-installer/PHPInstallerBase53.wxs?r1=1.19&r2=1.20&diff_format=u
Index: win-installer/PHPInstallerBase53.wxs
diff -u win-installer/PHPInstallerBase53.wxs:1.19 
win-installer/PHPInstallerBase53.wxs:1.20
--- win-installer/PHPInstallerBase53.wxs:1.19   Sat Mar 21 01:58:33 2009
+++ win-installer/PHPInstallerBase53.wxs        Thu May 21 02:41:06 2009
@@ -489,7 +489,7 @@
       </Feature>
     </Feature>
 
-    <Binary Id="PHPInstallerScripts" SourceFile="PHPInstallerScripts52.vbs" /> 
+    <Binary Id="PHPInstallerScripts" SourceFile="PHPInstallerScripts53.vbs" /> 
     <Binary Id="WixCA" src="Wix\wixca.dll"/>
 
     <CustomAction Id="netserveCGIInterpretersaddCmd"
http://cvs.php.net/viewvc.cgi/win-installer/PHPInstallerBase53NTS.wxs?r1=1.16&r2=1.17&diff_format=u
Index: win-installer/PHPInstallerBase53NTS.wxs
diff -u win-installer/PHPInstallerBase53NTS.wxs:1.16 
win-installer/PHPInstallerBase53NTS.wxs:1.17
--- win-installer/PHPInstallerBase53NTS.wxs:1.16        Fri Feb 20 15:48:16 2009
+++ win-installer/PHPInstallerBase53NTS.wxs     Thu May 21 02:41:06 2009
@@ -412,7 +412,7 @@
       </Feature>
     </Feature>
 
-    <Binary Id="PHPInstallerScripts" SourceFile="PHPInstallerScripts52.vbs" /> 
+    <Binary Id="PHPInstallerScripts" SourceFile="PHPInstallerScripts53.vbs" /> 
     <Binary Id="WixCA" src="Wix\wixca.dll"/>
 
     <CustomAction Id="iis700FastCGIaddCmd"

http://cvs.php.net/viewvc.cgi/win-installer/PHPInstallerScripts53.vbs?view=markup&rev=1.1
Index: win-installer/PHPInstallerScripts53.vbs
+++ win-installer/PHPInstallerScripts53.vbs
Const ForReading = 1
Const ForWriting = 2

Sub configApache

    Dim objFSO
    Dim objFile

    strDirective = vbCrLf & vbCrLf & "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY 
ON UNINSTALL" & vbCrLf
    strApacheDir = Session.Property("APACHEDIR")
    strPHPPath = Replace(Session.TargetPath("INSTALLDIR"),"\","/")
    If ( right(strApacheDir,1) <> "\" ) then 
        strApacheDir = strApacheDir & "\"
    End If
    
    If ( Session.FeatureRequestState("apacheCGI") = 3 ) Then
        strDirective = strDirective & "ScriptAlias /php/ """ & strPHPPath & 
"""" & vbCrLf
        strDirective = strDirective & "Action application/x-httpd-php """ & 
strPHPPath & "php-cgi.exe""" & vbCrLf
    End If
    
    If ( Session.FeatureRequestState("apache22") = 3 ) Then
        strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & 
vbCrLf
        strDirective = strDirective & "LoadModule php5_module """ & strPHPPath 
& "php5apache2_2.dll""" & vbCrLf
    End If
    
    'If ( Session.FeatureRequestState("apache20") = 3 ) Then
    '    strDirective = strDirective & "PHPIniDir """ & strPHPPath & """" & 
vbCrLf
    '    strDirective = strDirective & "LoadModule php5_module """ & strPHPPath 
& "php5apache2.dll""" & vbCrLf
    'End If
    
    strDirective = strDirective &  "#END PHP INSTALLER EDITS - REMOVE ONLY ON 
UNINSTALL" & vbCrLf
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFileName = strApacheDir & "httpd.conf"
    If objFSO.FileExists(strFileName) Then
        Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
    Else
        strFileName = strApacheDir & "conf\httpd.conf"
        If objFSO.FileExists(strFileName) Then
            Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
        Else
            FatalError ("Error trying access httpd.conf file.")
            Exit Sub
        End If    
    End If        
    strText = objFile.ReadAll
    objFile.Close
    
    ' try and comment out old directives if they exist
    strText = Replace(strText,"ScriptAlias /php/","#ScriptAlias /php/")
    strText = Replace(strText,"Action application/x-httpd-php","#Action 
application/x-httpd-php")
    strText = Replace(strText,"PHPIniDir","#PHPIniDir")
    strText = Replace(strText,"LoadModule php5_module","#LoadModule 
php5_module")
    strText  = strText & strDirective
    
    ' backup old file
    strBackupFileName = strFileName & ".bak"
    objFSO.CopyFile strFileName, strBackupFileName 
    
    Set objFile = objFSO.OpenTextFile( strFileName, ForWriting)
    objFile.WriteLine strText
    objFile.Close
    
    strFileName = strApacheDir & "mime.types"
    If objFSO.FileExists(strFileName) Then
        Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
    Else
        strFileName = strApacheDir & "conf\mime.types"
        If objFSO.FileExists(strFileName) Then
            Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
        Else
            FatalError ("Error trying access mime.types file.")
            Exit Sub
        End If    
    End If
    
    strText = objFile.ReadAll
    objFile.Close
    
    If ( InStr(strText,"application/x-httpd-php") = 0 ) Then
        strText = strText & "application/x-httpd-php" & vbTab & "php" & vbCrLf
    End If
    
    If ( InStr(strText,"application/x-httpd-php-source") = 0 ) Then
        strText = strText & "application/x-httpd-php-source" & vbTab & "phps" & 
vbCrLf
    End If
    
    ' backup old file
    strBackupFileName = strFileName & ".bak"
    objFSO.CopyFile strFileName, strBackupFileName
    
    Set objFile = objFSO.OpenTextFile( strFileName, ForWriting)
    objFile.WriteLine strText
    objFile.Close
    
End Sub

Sub unconfigApache

    Dim objFSO
    Dim objFile

    strApacheDir = Session.Property("APACHEREGDIR")
    If ( right(strApacheDir,1) <> "\" ) then 
        strApacheDir = strApacheDir & "\"
    End If

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFileName = strApacheDir & "httpd.conf"
    If objFSO.FileExists(strFileName) Then
        Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
    Else
        strFileName = strApacheDir & "conf\httpd.conf"
        If objFSO.FileExists(strFileName) Then
            Set objFile = objFSO.OpenTextFile( strFileName, ForReading)
        Else
            FatalError ("Error trying access httpd.conf file.")
            Exit Sub
        End If    
    End If
    
    do while objFile.AtEndOfStream = false
        strText = objFile.ReadLine
        
        If ( strText = "#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL" 
) Then
            strEndText = objFile.ReadLine
            do while strEndText <> "#END PHP INSTALLER EDITS - REMOVE ONLY ON 
UNINSTALL"
                strEndText = objFile.ReadLine
            loop    
        Else
            strNewText = strNewText & vbCrLf & strText
        End If
    loop
    
    objFile.Close
    
    Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
    objFile.WriteLine strNewText
    objFile.Close

End Sub

Sub configIIS4

    Dim WebService
    Dim WebService1
    Dim Paths
    Dim Nodes()
    Dim NumExtensions
    Dim PHPExecutable
    Dim NodeCount
    Dim FullPath
    Dim Args, Arg, ArgCount
    Dim I
    Dim J
    Dim K
    Dim MapNode, ScriptMaps, OutMaps(), Map, MapBits
    Dim fAddScriptMap
    Dim DefaultDocuments

    fAddScriptMap = TRUE
    strPHPPath = Session.TargetPath("INSTALLDIR")
    If ( right(strPHPPath,1) <> "\" ) then 
        strPHPPath = strPHPPath & "\"
    End If
    If ( Session.FeatureRequestState("iis4CGI") = 3 ) Then
        PHPExecutable = strPHPPath & "php-cgi.exe"
    End If
    If ( Session.FeatureRequestState("iis4ISAPI") = 3 ) Then
        PHPExecutable = strPHPPath & "php5isapi.dll"
    End If
    If ( Session.FeatureRequestState("iis4FastCGI") = 3 ) Then
        fAddScriptMap = FALSE
    End If
    
    'it could all go dreadfully wrong - so set error handler for graceful exits
    On Error Resume Next
 
    Set WebService = GetObject("IIS://LocalHost/W3SVC")
    If (Err.Number <> 0) Then
        FatalError ("Error trying access the local web service: GetObject 
Failed.")
        Exit Sub
    End If

    ' Add index.php to default documents list at server level
    DefaultDocuments = WebService.DefaultDoc
    If ( InStr(DefaultDocuments,"index.php") = 0 ) Then
        DefaultDocuments = DefaultDocuments & ",index.php"
        WebService.DefaultDoc = DefaultDocuments
        WebService.SetInfo
    End If

    ' Add index.php to default documents list of SiteId 1
    Set WebService1 = GetObject("IIS://LocalHost/W3SVC/1")
    If (Err.Number = 0) Then
        DefaultDocuments = WebService1.DefaultDoc
        If ( InStr(DefaultDocuments,"index.php") = 0 ) Then
            DefaultDocuments = DefaultDocuments & ",index.php"
            WebService1.DefaultDoc = DefaultDocuments
            WebService1.SetInfo
        End If
    End If

    If ( fAddScriptMap = TRUE ) Then
        If ( FormatNumber(GetWindowsVersion) < FormatNumber("5.2") ) Then
            'use short path syntax here
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            Set objFile = objFSO.GetFile(PHPExecutable)
            PHPExecutable = objFile.ShortPath
        Else
            'use quotes and long name syntax
            PHPExecutable = """" & PHPExecutable & """"
        End If
    
        'I may be doing the wrong thing with inheritance here - it seems to 
work, however!
        Paths = WebService.GetDataPaths("scriptmaps", IIS_DATA_INHERIT)
        If Err.Number <> 0 Then Paths = WebService.GetDataPaths("scriptmaps", 
IIS_DATA_NO_INHERIT)
        If (Err.Number <> 0) Then
            FatalError ("Error trying to find the nodes containing scriptmaps 
:GetDataPaths Failed.")
            Exit Sub
        End If
        For Each FullPath In Paths
            Set MapNode = GetObject(FullPath)
            ReDim OutMaps(0)
            J = 0
            For Each Map In MapNode.ScriptMaps
                'split the extension from the scriptmap entry
                MapBits = Split(Map, ",")
                If MapBits(0) <> ".php" Then
                    'if the extension doesn't match any of our php ones, 
preserve it
                    ReDim Preserve OutMaps(J)
                    OutMaps(J) = Map
                    J = J + 1
                End If
            Next

            ReDim Preserve OutMaps(J + 1 - 1)

            'add our php extensions to OutMaps
            OutMaps(J) = ".php" & "," & PHPExecutable & ",1"
   
            'write the Outmap to the current node
            MapNode.Put "ScriptMaps", (OutMaps)
            'setinfo to make it so
            MapNode.SetInfo
        Next
    End If
    
End Sub

Sub unconfigIIS4

    Dim WebService
    Dim Paths
    Dim Nodes()
    Dim NumExtensions
    Dim PHPExecutable
    Dim NodeCount
    Dim FullPath
    Dim Args, Arg, ArgCount
    Dim I
    Dim J
    Dim K
    Dim MapNode, ScriptMaps, OutMaps(), Map, MapBits
    Dim fRemoveScriptMap
 
    fRemoveScriptMap = TRUE

    'it could all go dreadfully wrong - so set error handler for graceful exits
    On Error Resume Next

    If ( Session.FeatureRequestState("iis4FastCGI") = 2 ) Then
        fRemoveScriptMap = FALSE
    End If
 
    Set WebService = GetObject("IIS://LocalHost/W3SVC")
    If (Err.Number <> 0) Then
        FatalError ("Error trying access the local web service: GetObject 
Failed.")
        Exit Sub
    End If

    If ( fRemoveScriptMap = TRUE ) Then
        'I may be doing the wrong thing with inheritance here - it seems to 
work, however!
        Paths = WebService.GetDataPaths("scriptmaps", IIS_DATA_INHERIT)
        If Err.Number <> 0 Then Paths = WebService.GetDataPaths("scriptmaps", 
IIS_DATA_NO_INHERIT)
        If (Err.Number <> 0) Then
            FatalError ("Error trying to find the nodes containing scriptmaps 
:GetDataPaths Failed.")
            Exit Sub
        End If
        For Each FullPath In Paths
            Set MapNode = GetObject(FullPath)
            ReDim OutMaps(0)
            J = 0
            For Each Map In MapNode.ScriptMaps
                'split the extension from the scriptmap entry
                MapBits = Split(Map, ",")
                If MapBits(0) <> ".php" Then
                    'if the extension doesn't match any of our php ones, 
preserve it
                    ReDim Preserve OutMaps(J)
                    OutMaps(J) = Map
                    J = J + 1
                End If
            Next

            'write the Outmap to the current node
            MapNode.Put "ScriptMaps", (OutMaps)
            'setinfo to make it so
            MapNode.SetInfo
        Next
    End If

End Sub

Sub FatalError(Message)
    MsgBox Message & " You will need to manually configure the web server.", 
vbExclamation, "Error"
End Sub

Function GetWindowsVersion
    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from 
Win32_OperatingSystem",,48)
    For Each objItem in colItems
        ver=objItem.Version
    Next
    GetWindowsVersion = Left(ver,3)
End Function

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to