public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Enrico Weigelt <weigelt@metux.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Problem upgrading mediawiki
Date: Sat, 6 Jan 2007 22:20:21 +0100	[thread overview]
Message-ID: <20070106212021.GD20396@nibiru.local> (raw)
In-Reply-To: <20070105214059.GA31944@nibiru.local>

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]


Okay folks, 

here's a little script for assisting wiki updates. 
It does not yet fix the database permissions, since I'm not yet 
shure how I like to pass the superuser login/passwd.
(suggestions welcomed)

cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service - http://www.metux.de/
---------------------------------------------------------------------
 Please visit the OpenSource QM Taskforce:
 	http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
	http://patches.metux.de/
---------------------------------------------------------------------

[-- Attachment #2: update-wiki --]
[-- Type: text/plain, Size: 1966 bytes --]

#!/usr/bin/php
<?php
//
// Copyright 2006, Enrico Weigelt, metux IT service <weigelt@metux.de>
//
// This script may be redistributed under the terms of the GPL.
//

$WEBAPP="mediawiki";
$DBSUPERUSER_NAME="root";
$DBSUPERUSER_PASSWORD="pemnj92";

if (!$_SERVER{'argv'}[2])
    die ("update-wiki: <hostname> <version>");

$HOSTNAME=$_SERVER{'argv'}[1];
$VERSION=$_SERVER{'argv'}[2];
$WWWROOT="/var/www/$HOSTNAME/htdocs";
$MNTDIR="$WWWROOT/maintenance/";
$LOCALSETTINGS="$WWWROOT/LocalSettings.php";
$ADMINSETTINGS="$WWWROOT/AdminSettings.php";

if (!@fopen($LOCALSETTINGS,"r"))
    die ( "missing LocalSettings.php - you have to configure it first" );

if (!@fopen($ADMINSETTINGS,"r"))
{
    echo "missing AdminSettings.php ... creating it\n";
    define('MEDIAWIKI',1);
    require_once($LOCALSETTINGS);
    $fp_in=fopen($LOCALSETTINGS,"r");
    $fp_out=fopen($ADMINSETTINGS,"w");
    while (!feof($fp_in))
    {
	$line=fgets($fp_in,4096);
	if (trim($line)=='?>')
	{
	    fputs($fp_out,'$wgDBadminuser="'.$wgDBuser."\";\n");
	    fputs($fp_out,'$wgDBadminpassword="'.$wgDBpassword."\";\n");
	    fputs($fp_out,"\n");
	    fputs($fp_out,$line);
	    while (!feof($fp_in))
		fputs($fp_out,fgets($fp_in,4096));
	    $gotend = true;
	}
	else
	    fputs($fp_out,$line);
    }
    if (!$gotend)
    {
	fputs($fp_out,'$wgDBadminuser="'.$wgDBuser."\";\n");
	fputs($fp_out,'$wgDBadminpassword="'.$wgDBpassword."\";\n");
    }
    fclose($fp_in);
    fclose($fp_out);
}    

print "Upgrading the webapp code (->webapp-config)\n";
if (passthru("webapp-config -U -h $HOSTNAME $WEBAPP $VERSION",$ret)||($ret==0))
    print "Okay\n";
else
    die ( "webapp-config failed: $ret\n");

print "Now calling the update script\n";
print "If it cannot do certain structure changes (ie. creating tables),\n";
print "you have to give full db access to the wiki user\n";
print "\n";

if (passthru("cd $MNTDIR && php update.php",$res)||($res==0))
    print "OKAY\n";
else
    die("ERROR\n");

  reply	other threads:[~2007-01-06 22:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-31 17:20 [gentoo-user] Problem upgrading mediawiki Enrico Weigelt
2006-12-31 17:28 ` [gentoo-user] " Enrico Weigelt
2007-01-01  2:24 ` [gentoo-user] " Boyd Stephen Smith Jr.
2007-01-01  8:56 ` Jigme Datse
2007-01-01 17:48   ` Enrico Weigelt
2007-01-02 15:31     ` kashani
2007-01-05 20:35       ` Enrico Weigelt
2007-01-05 21:41         ` Enrico Weigelt
2007-01-06 21:20           ` Enrico Weigelt [this message]
2007-01-05 20:28     ` Enrico Weigelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070106212021.GD20396@nibiru.local \
    --to=weigelt@metux.de \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox