[PLUGIN] SVN Plugin

Brilliant! Thanks a lot ditto & smtalk!
I will try it for myself and then update the wiki.
 
Brilliant! Thanks a lot ditto & smtalk!
I will try it for myself and then update the wiki.

Some of the steps might not be necessary. The main thing is the cron job and the replaced addrepository.php file.

But it is working without errors. Also there did not seem to be a issue about suPHP specific, but rather a problem creating the repositories (wich the cron job fix) and some various bugs (fixed in addrepository.php).

I have tested it by creating repositories with plugin, and then using Tortoise SVN to do "Checkout" and "Committ" etc., and it works very well. :)
 
Last edited:
One small thing to know about, is that if your users have WordPress installed and using custom permalinks in WordPress with this .htaccess code in public_html:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Then it will break the domain.com/svn/repository_name url, so that it give a 404 not found error. I have not found a solution to this.

I will advice my customers to add a fully hosted subdomain if they have this problem with WordPress.
 
I have updated by adding a new step (step 4) in this post: http://directadmin.com/forum/showpost.php?p=191619&postcount=40

When users deleted a repository on plugin page, it was never deleted. smtalk found this problem, and fixed it before I even new about it! He is the best! :)

So replace addrepositories.php with the one at step 4, and problem is fixed.
 
Last edited:
Remember that the repository gets uid/gui apache, which makes it vulnerable.

Maybe SMtalk can post a (SVN) tested script here that will change that into username/username
 
We discovered another small bug that is now fixed. The bug was that if a user created or/and deleted more then one repository within the same minute (within the same cron job time), then only the last repository created/deleted, would be created/deleted. To fix this, we changed the following in user/_templates/repositories.php and user/_templates/addrepository.php

Old code in repositories.php and addrepository.php:
Code:
$fh = fopen($myFile, 'w') or die

New code in repositories.php and addrepository.php:
Code:
$fh = fopen($myFile, 'a') or die

I have updated the code in those files in this forum post http://www.directadmin.com/forum/showpost.php?p=191619&postcount=40 , please use the updated files that fix this problem.
 
Last edited:
1. error

Repository added successfully!
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/directadmin/plugins/svn/user/_templates/addrepository.php on line 67 Warning: file_get_contents(http://domain.com/01240793040d198950719f04c01c5b06.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/directadmin/plugins/svn/user/_templates/addrepository.php on line 67

2. What this code are doing? Save some hash file on user account and after read id again? why?

3. how to add repo to subdomain? i don't have subdomains on add repo list. only domains.

thanks!
 
Remember that the repository gets uid/gui apache, which makes it vulnerable.

Maybe SMtalk can post a (SVN) tested script here that will change that into username/username

I have created my own repositorie structure without the plugin.

I chown all the repositories for a user to:
chown -R svn:apache (in this case the vhost owner is user svn)
and chmod them into chmod -R 770

I did some test, and files that are committed to the repository are put under the disk quote of the user. But SVN can still manage everything.

I am still wondering if the traffic usage will be fetched with the SVN apache logs. I think so but I am not totally sure?
 
Repository added successfully!
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/directadmin/plugins/svn/user/_templates/addrepository.php on line 67 Warning: file_get_contents(http://domain.com/01240793040d198950719f04c01c5b06.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/directadmin/plugins/svn/user/_templates/addrepository.php on line 67

I have this problem to, is there any solution for?
 
This is a nice plugin and i was able to make a script to insall everything as should be.

Ive just one question, i can connect just using http:// with svn software aswell or i can connect using svn:// in some way? Atm seems svn:// is not working.

If anyone is interested to the script i made feel free to ask.

Regards
 
Hello Andrea,

I'm insterested in the script, can i test it?

Thank you!
 
Here it is:

Code:
yum install -y expat-devel.i386
/usr/local/directadmin/custombuild/build apache
wget -O /usr/local/directadmin/scripts/custom/user_create_post.sh "https://dasvn.googlecode.com/svn/trunk/Custom scripts/user_create_post.sh"
wget -O /usr/local/directadmin/scripts/custom/domain_create_post.sh "https://dasvn.googlecode.com/svn/trunk/Custom scripts/domain_create_post.sh"
wget -O /usr/local/directadmin/scripts/custom/domain_destroy_pre.sh "https://dasvn.googlecode.com/svn/trunk/Custom scripts/domain_destroy_pre.sh"
wget -O /usr/local/directadmin/data/templates/custom/virtual_host2.conf "https://dasvn.googlecode.com/svn/trunk/Custom scripts/virtual_host2.conf"
wget -O /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf "https://dasvn.googlecode.com/svn/trunk/Custom scripts/virtual_host2_secure.conf"
chown diradmin:diradmin /usr/local/directadmin/scripts/custom/*
chmod 700 /usr/local/directadmin/scripts/custom/*.sh
chown diradmin:diradmin /usr/local/directadmin/data/templates/custom/*
cd /root/
mkdir /etc/svn
mkdir /etc/svn/sqlite-amalgamation/
wget -O /root/subversion-1.6.5.tar.gz https://dasvn.googlecode.com/svn/trunk/Files/subversion-1.6.5.tar.gz
tar xzf subversion-1.6.5.tar.gz
mv /root/subversion-1.6.5/* /etc/svn/
wget -O /root/sqlite-amalgamation-3.6.13.tar.gz http://dasvn.googlecode.com/svn/trunk/Files/sqlite-amalgamation-3.6.13.tar.gz
tar zxf /root/sqlite-amalgamation-3.6.13.tar.gz
mv /root/sqlite-3.6.13/sqlite3.c /etc/svn/sqlite-amalgamation/
rm -rf /root/sqlite*
rm -rf /root/subversion-1.6.5*
cd /etc/svn/
/etc/svn/configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-apr=/usr/bin/apr-config
yum install -y expat-devel.x86_64
make
make install
/sbin/ldconfig
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d
/etc/init.d/httpd restart
mkdir /scripts
cd /scripts/
wget -O /scripts/fixcurentusers.sh "http://dasvn.googlecode.com/svn/trunk/Custom scripts/fixcurentusers.sh"
chmod 755 fixcurentusers.sh
/scripts/fixcurentusers.sh
cd /root/
rm -rf /scripts/
rm -rf /root/svn.sh
touch /usr/local/directadmin/plugins/svn/commands.txt
chown -R diradmin:diradmin /usr/local/directadmin/plugins/svn
chmod 766 /usr/local/directadmin/plugins/svn/commands.txt
echo "* * * * * root /root/svn_execute.sh >/dev/null 2>&1" >> /etc/cron.d/svn_plugin
echo '#!/bin/sh' >> /root/svn_execute.sh
echo "echo -n > /usr/local/directadmin/plugins/svn/commands.sh" >> /root/svn_execute.sh
echo ""echo appoggio'#!/bin/sh'appoggio ">> /usr/local/directadmin/plugins/svn/commands.sh""" >> /root/svn_execute.sh
echo "cat /usr/local/directadmin/plugins/svn/commands.txt >> /usr/local/directadmin/plugins/svn/commands.sh" >> /root/svn_execute.sh
echo "echo 'exit 0;' >> /usr/local/directadmin/plugins/svn/commands.sh" >> /root/svn_execute.sh
echo "echo > /usr/local/directadmin/plugins/svn/commands.txt" >> /root/svn_execute.sh
echo "sh /usr/local/directadmin/plugins/svn/commands.sh" >> /root/svn_execute.sh
echo "rm -f /usr/local/directadmin/plugins/svn/commands.sh" >> /root/svn_execute.sh
echo "exit 0;" >> /root/svn_execute.sh
export appoggio=\'
sed -i 's/appoggio/'$appoggio'/' /root/svn_execute.sh
sed -i 's/shappoggio/sh'$appoggio'/' /root/svn_execute.sh
chmod 700 /root/svn_execute.sh
/etc/init.d/crond restart

For the svn_execute.sh suggest in post #4 i had to use a workaround cause im not such a good bash programmer, im pretty sure there is a better way to do this:

Code:
echo ""echo appoggio'#!/bin/sh'appoggio ">> /usr/local/directadmin/plugins/svn/commands.sh""" >> /root/svn_execute.sh
export appoggio=\'
sed -i 's/appoggio/'$appoggio'/' /root/svn_execute.sh
sed -i 's/shappoggio/sh'$appoggio'/' /root/svn_execute.sh

Anyone who is able and want to fix it, feel free to do that :)

On my own script i use to download directly the file from my own repository (same for all file) for be sure and cause i have pretty much cutomizated user_create_post domain_create post virtual_host2 and virtual_host2_secure.

Who have those alraedy customized as me shouldnt use this script cause it gonna OVERWRITE the existin one.

I would so much suggest to do as me, get the file apart, edit your own (or a copy of those in a subfolder like /svn) and make needed edits.

I use to have my own customization file and, if needed, i start svn.sh (this script) that re-download the customized script for svn (from a /svn) subfolder.

Also, this will take orignal file so you must do the edits on post #4, i have my own copy of the edited svn plugin with those edits already done.

Last thing, first install the plugin, then start this script!

Hope this is helpful

Regards
 
i have restore my backup SVN from another system into CentOS 5.6
when i try to commit svn it show error like this

Error: Commit failed (details follow):
Error: Can't write activity db

how can i fix this permission issues ?
 
After you have imported your svn repositories using SSH commands, you need to change owner/group from "root apache" to be "apache apache" on all of the files that have root assigned.
 
Hello All,

I just want to install subversion and the plugin is not really needed, but i want to install the new subersion: Apache Subversion 1.7.2
I see all tutorials pointing to special url's such like: https://dasvn.googlecode.com/svn/trunk/Files/subversion-1.6.5.tar.gz
Is this a special composed archive? or could i just use : http://apache.hippo.nl/subversion/subversion-1.7.2.tar.gz (from the subversion site)

also i see everybody using: http://dasvn.googlecode.com/svn/trunk/Files/sqlite-amalgamation-3.6.13.tar.gz
could i use the newest version from sqlite-amalgamation site: http://www.sqlite.org/download.html (not sure which one to use)

I'm a beginner so i don't really understand..
 
I am stuck on a problem after I upgraded from Apache subversion 1.6.17 to 1.6.19. Previous I had installed two subversion at the same time, one from CentOS using yum, and one from source. When I upgraded, I wanted to fix that, so I removed the CentOS version: yum remove subversion - then I installed Apache Subversion 1.6.19 from source. No problems so far, but the PATH is wrong after this:

Code:
[root@server ~]# which svn
/usr/local/bin/svn

The problem here, is that the plugin can't create new repositories any more, because it is looking in the wrong path. Here is email from cron job:

Code:
Cron <root@server> /root/svn_execute.sh

/usr/local/directadmin/plugins/svn/commands.sh: line 3: /usr/bin/svnadmin: No such file or directory
chown: cannot access `/home/USER/domains/DOMAIN.no/svn_repositories/test2': No such file or directory

So have I installed it wrong? Should I have made change to ./configure command to get it installed in /usr/bin instead of /usr/local/bin ? Or does I need to do something to update so bash understand what the path is?

Because I think when you install subversion using yum, it is placed in /usr/bin - but when I installed from source, it was placed in /usr/local/bin

Have been trying to fix this for 14 hours nonstop.
 
Back
Top