Konstantin Vlasenko

An engineer is someone who can make for a dollar what any fool could make for two. – Alan Kay

Tag Archives: Apache

#Apache: avoid using .htaccess files completely

.htaccess files are read on every request.

You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.

http://httpd.apache.org/docs/2.4/howto/htaccess.html

Do not log requests for images in the access log

The following lines should be included in httpd.conf to keep requests for images from appearing in the access log. It can be easily modified to prevent logging of particular directories, or to prevent logging of requests coming from particular hosts.

SetEnvIf Request_URI \.gif image-request
SetEnvIf Request_URI \.jpg image-request
SetEnvIf Request_URI \.png image-request
CustomLog logs/access_log env=!image-request

Как получить значение свойства в Deferred Custom Action

English: How to Transfer Properties to Deferred Custom Action
Мы можем найти следующую информацию в MSDN. Где в последнем абзаце находим простое решение. Если его перевести на Wix-код, получим следующее (синим цветом выделено решение):

—–begin of test.wxs

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' >
 <Product Id='{00A86C83-0000-0000-0000-2FDF0595B100}'
  Name='Property to deffered custom action'
  Language='1033'
  Version='1.0.0.0' Manufacturer='Vlasenko'
  UpgradeCode='{00E9017B-0000-0000-0000-DDDF83756800}'>
  <Package Description="Property to a deffered custom action"
   Comments="http://vlasenko.org"
   InstallerVersion="300"
   Compressed="yes"/>
  <Media Id="1"
   Cabinet="_62E9A39FD9CC4E7436F7263EBE6CDCF4"
   EmbedCab="yes" />
  <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
  <Directory Id="TARGETDIR" Name="SourceDir">
   <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLDIR" Name="Property to deffered custom action">
     <Component Id="first" Guid="*">
      <File Id="test" DiskId="1"
       Name="test.wxs" Source="test.wxs" KeyPath="yes" />
     </Component>
    </Directory>
   </Directory>
  </Directory>
  <Feature Id='Main' Title='Property to deffered custom action' Level='1'>
   <ComponentRef Id="first" />
  </Feature>
    
  <CustomAction Id="ShowInstallDir.SetProperty"
   Property="ShowInstallDir" Value="[INSTALLDIR]" />
  <CustomAction Id="ShowInstallDir"
   Script="vbscript" Execute="deferred">
   <![CDATA[
   Dim property
   property = Session.Property("CustomActionData")
   MsgBox property
   ]]>
  </CustomAction>
  <InstallExecuteSequence>
   <Custom Action="ShowInstallDir.SetProperty"
    Before="InstallInitialize">NOT REMOVE="ALL"</Custom>
   <Custom Action="ShowInstallDir"
    Before="InstallFinalize">NOT REMOVE="ALL"</Custom>
  </InstallExecuteSequence>
   </Product>
</Wix>

end of test.wxs—–

To get msi-file:

  1. Download and install Wix.
  2. Save code to test.wxs
  3. Execute command candle test .wxs
  4. Execute command light -out test.msi test.wixobj

В следующий раз выложу код с реальным использованием этого решения (установка Apache httpd сервиса и генерация конфигурационного файла httpd.conf во-время инсталяции).

Follow

Get every new post delivered to your Inbox.