#!/bin/sh
svcstart /service/mysql || exit 1

chown nobody /var/www/htdocs/syn3/mediawiki/images || exit 1
syn3-mysqlcreate mediawiki /var/www/htdocs/syn3/mediawiki/LocalSettings.php < /var/www/htdocs/syn3/mediawiki/mediawiki.sql || exit 1

#update previous mediawiki:
wgDBadminpassword=`cat /var/www/htdocs/syn3/mediawiki/LocalSettings.php |grep wgDBpassword|grep -o '".*"'`
echo "
<?php
\$wgDBadminuser      = 'mediawiki';
\$wgDBadminpassword  = $wgDBadminpassword;
?>
" > /var/www/htdocs/syn3/mediawiki/AdminSettings.php

cd /var/www/htdocs/syn3/mediawiki/maintenance || exit 1
/usr/php5/bin/php update.php --quick || exit 1
 

svcreset /service/mysql || exit 1

