📜 ⬆️ ⬇️

Configuring WebSVN on Windows for integration into Jira with support for SVN authorization and Delphi source encoding

I post this instruction, because I myself had to look for the necessary information on the grains. The instruction is designed for people with little experience in web technologies and web development. All software systems are configured on a dedicated “server” for programmer needs running Windows 7 Pro 32 bit.
What we have:

What we want to get:


1. Install PHP


  1. download the Thread Safe installer for windows from the official site (the latest version does not appear immediately, so php-5.3.27-Win32-VC9-x86.msi was chosen)
  2. install in C: \ PHP \ (when dealing with something multiplatform, I always avoid spaces in paths and Russian characters)
  3. during installation, select “Apache 2.2.x module”; Apache HTTP Server configuration is in the Visual SVN Server directory, I have this "C: \ Program Files \ VisualSVN Server \ conf"

When installing, the file C: \ Program Files \ VisualSVN Server \ conf \ httpd.conf will be automatically added to the lines
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "C:\PHP\" LoadModule php5_module "C:\PHP\php5apache2_2.dll" #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL 

I read the recommendations on the Internet to install PHP manually from a zip archive, but it didn't work out for me the first time. Just because I did not find the latest php library php5apache2_2.dll in the delivery, and php5apache2_4.dll refused to load on Apache.

2. Installing WebSVN


Here and the installation is difficult to name. Simply create the C: \ Program Files \ VisualSVN Server \ htdocs \ websvn directory and copy the contents of the archive downloaded from the official website into it.

At this stage, you can already check the availability of the WebSVN page. To do this, go to yourserver:8443/websvn/index.php yourserver:8443/websvn/index.php , a welcome page should be displayed asking you to customize the list of repositories.
')

3. Installing Cygwin


The essence of the Cygwin project is to provide Windows users with applications common in Unix systems. Some of these applications are required for WebSVN. The official site provided a fairly clear installer. You must install the following packages:

Installed in C: \ cygwin \, using the principle of avoiding spaces mentioned above.

4. Configure WebSVN


Apache minor configuration

For the convenience of accessing the WebSVN homepage, add the following code to the Apache C: \ Program Files \ VisualSVN Server \ conf \ httpd-custom.conf user settings file:
 <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> 

Configuring config.php

In accordance with the instructions for installing WebSVN, located in the file C: \ Program Files \ VisualSVN Server \ htdocs \ websvn \ doc \ install.html, copy the file \ include \ distconfig.php to \ include \ config.php, and then modify it in accordance with the comments to the parameters. My settings were as follows:
 $config->setSVNCommandPath('C:\\Program Files\\VisualSVN Server\\bin'); $config->setDiffPath('C:\\cygwin\\bin'); $config->setEnscriptPath('C:\\cygwin\\bin'); ... (    'C:\\cygwin\\bin') $config->setTrustServerCert(); $config->parentPath('D:\\SVN\\Repositories'); $config->setIgnoreWhitespacesInDiff(true); $config->setDefaultLanguage('ru'); $config->allowDownload(); $config->setDefaultFolderDlMode('gzip'); $config->useEnscript(); //$config->useGeshi(); $config->setRssEnabled(false); 

Configure authorization used in SVN

Immediately, I’ll make a reservation that due to switching to Visual SVN version 2.6.0, the access system distributed over repositories could not be tied to the same files by authorizing WebSVN. I had to manually create a common authorization file for the repositories that is not used in Visual SVN. At the moment, this problem is insignificant due to the small size of the development team, but I will be happy to hear recommendations for avoiding manual file support for the authorization. So, let's continue:

Now at the entrance to yourserver:8443/websvn/ yourserver:8443/websvn/ authorization used in the Visual SVN Server, and access is configured in general for the repositories authorization file.

Encoding setting

WebSVN is already fully functional, but not enough gloss. For example, comments in the source code of Delphi 7, written in Russian, are displayed as crackers. At the same time, the site itself is already in Russian. What's the catch? On the WebSVN website I found a discussion of this problem: websvn.tigris.org/ds/viewMessage.do?dsMessageId=2968020&dsForumId=1547 websvn.tigris.org/ds/viewMessage.do?dsMessageId=2968020&dsForumId=1547 . In short: the php mb_detect_encoding function used to determine the file encoding is simply lying. Use the crutch suggested by the user yaroslav, for this in the file C: \ Program Files \ VisualSVN Server \ htdocs \ websvn \ include \ command.php replace
 return mb_detect_encoding($str.'a', $list); 
on
 $res = mb_detect_encoding($str.'a',$list); if ($res !== 'ISO-8859-1') return $res; else return 'CP1251'; 
While problems with a crutch did not notice. The problem of determining the file encoding is described in detail in the post of the user m00t : habrahabr.ru/post/107945 habrahabr.ru/post/107945 . It also describes a working method for determining the encoding, the use of which will help avoid crutches and their potential problems.

Customize greeting on the title page

In the files C: \ Program Files \ VisualSVN Server \ htdocs \ websvn \ templates \\ index.tmpl, you can replace the default greeting text with your own. I select this setting in a separate item, because When using Russian text, the file must be written in utf8 encoding.

5. Configuring JIRA Subversion plugin


Enter administration -> plugins -> Subversion Repositories, configure paths in each repository (for example, rep1 repository):
view format: yourserver:8443/websvn/filedetails.php?repname=rep1&path=${path}
changeset format: yourserver:8443/websvn/revision.php?repname=rep1&location=/&rev=${rev}
file added format: yourserver:8443/websvn/filedetails.php?repname=rep1&path=${path}&rev=${rev}
file modified format: yourserver:8443/websvn/diff.php?repname=rep1&path=${path}&rev=${rev}&sc=0
file replaced format: yourserver:8443/websvn/filedetails.php?repname=rep1&path=${path}&rev=${rev-1}&sc=0
file deleted format: yourserver:8443/websvn/filedetails.php?repname=rep1&path=${path}&rev=${rev-1}&sc=0

Source: https://habr.com/ru/post/188104/


All Articles