diff options
author | nobody <nobody@localhost> | 2004-02-28 08:47:46 +0000 |
---|---|---|
committer | nobody <nobody@localhost> | 2004-02-28 08:47:46 +0000 |
commit | 49e334bf5146d847666497daa2f5dae19c01b533 (patch) | |
tree | 9f6c4579f747adc0bcc1299977019bb92ea5b79f | |
parent | 89e1e30e14916bef58341c0785e48bf9bafd0419 (diff) | |
parent | f20e419c44091ca0ef378cd22f2fc8e447a9f29b (diff) |
This commit was manufactured by cvs2svn to create tag 'REL1_2_0rc1'.1.2.0rc1
-rw-r--r-- | RELEASE-NOTES | 3 | ||||
-rw-r--r-- | install.php | 4 | ||||
-rw-r--r-- | irc/rc2irc.php | 192 | ||||
-rw-r--r-- | irc/rcdumper.php | 102 |
4 files changed, 6 insertions, 295 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ef93b6300e3a..ad1ce1ddbc3e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -21,6 +21,9 @@ New features in 1.2: * Editing toolbar to demonstrate wiki syntax to newbies (off by default in user preferences) * Support for authenticated SMTP outgoing e-mail (experimental) +* It's now possible to assign sysop accounts from within the wiki. + An account with this ability must be labeled with the "bureaucrat" + privilege, such as the 'Developer' account created by the install. Fixes and tweaks: * Should work out of the box on MySQL 3.2.x again. On 4.x set diff --git a/install.php b/install.php index 9c7163eee9f4..bee1935afb79 100644 --- a/install.php +++ b/install.php @@ -208,7 +208,8 @@ function populatedata() { } print "Do you want to create a sysop+developer account? A developer\n"; print "can switch the database to read-only mode and run any type of\n"; - print "query through a web interface. [Y/n] "; + print "query through a web interface. This account can also assign\n"; + print "sysop access to other accounts. [Y/n] "; $response=readconsole(); if(strtolower($response)!="n") { print "Enter the username [Developer]: "; @@ -224,6 +225,7 @@ function populatedata() { $u->setPassword( $developer_password ); $u->addRight( "sysop" ); $u->addRight( "developer" ); + $u->addRight( "bureaucrat" ); $u->saveSettings(); } else { print "Could not create user - already exists!\n"; diff --git a/irc/rc2irc.php b/irc/rc2irc.php deleted file mode 100644 index 41d6b155ed57..000000000000 --- a/irc/rc2irc.php +++ /dev/null @@ -1,192 +0,0 @@ -<? - -$ircNick = "wikipedia_rc"; -$rooms = array("en" => 1, "fr" => 1, "de" => 1); -$ircServer = "irc.freenode.net" -$ircSockName = "tcp://$ircServer"; -$ircPort = 6667; -$minDelay = 0.5; -$ircReadTimeout = 200000; # us -$ircWriteTimeout = 30; # s -$fmB = chr(2); -$fmU = chr(31); -$queueId = 337055475; -$maxMessageSize = 16384; - -#----------------------------------------------------------------------------- - -# Get queue - -$ircPassword = mt_rand(0xffffffff); -$hostname = getenv('SERVER_NAME'); - -$queue = msg_get_queue($queueId); - -if ( !$queue ) { - print "Could not open RC message queue\n"; - exit; -} -emptyQueue( $queue ); - -# Initialise the IRC connection -$sockIRC = fsockopen( $ircSockName, $ircPort ); -if ( !$sockIRC ) { - print "Could not open IRC connection\n"; - exit; -} -stream_set_timeout($sockIRC, 0, $ircWriteTimeout); - -fwrite( $sockIRC, - "PASS $ircPassword\r\n" . - "NICK $ircNick\r\n" . - "USER recentchanges $hostname $ircServer Wikipedia RC->IRC bot\r\n" -); - -foreach ( $rooms as $room => $v ) { - joinRoom( $sockIRC, $room ); -} - -$readObjs = array( $sockIRC, $queue ); - -# Main input loop -$die = false; -while ( !$die ) { - # RC input - $msgType = 0; - $entry = false; - if (!msg_receive($queue, 0, $msgType, $maxMessageSize, $entry, true, MSG_IPC_NOWAIT)) { - $entry = false; - } - if (is_array( $entry )) { - $out = getIrcOutput( $sockIRC, $entry ); - fwrite( $sockIRC, $out ); - } - - # IRC input - stream_set_timeout($sockIRC, 0, $ircReadTimeout); - $line = rtrim(fgets( $sockIRC )); - stream_set_timeout($sockIRC, 0, $ircWriteTimeout); - if ( $line ) { - $die = processIrcInput( $sockIRC, $line ); - } -} -exit(); - -#-------------------------------------------------------------- -function delayMin() -{ - static $lastTime = 0; - global $minDelay; - if ( !$lastTime ) { - $lastTime = getMicroTime(); - } - $curTime = getMicroTime(); - $timeDifference = $curTime - $lastTime; - if ( $timeDifference < $minDelay ) { - usleep( ($minDelay - $timeDifference) *1000000 ); - } - $lastTime = $curTime; -} - -function getMicroTime() -{ - list($usec, $sec) = explode(" ",microtime()); - return ((float)$usec + (float)$sec); -} - -function getIrcOutput( $socket, $in ) -{ - global $rooms; - - delayMin(); - $bad = array("\n", "\r"); - $empty = array("", ""); - $comment = $in['comment']; - $title = $in['prefixedDBkey']; - $user = $in['userText']; - $lastid = IntVal($in['lastOldid']); - $flag = ($in['minor'] ? "M" : "") . ($in['new'] ? "N" : ""); - $lang = $in['lang']; - if ( $lang == "w" ) { - $lang = "en"; - } - - if ( !array_key_exists( $rooms, $lang ) ) { - return ""; - } - $room = "#{$lang}rc.wikipedia"; - - if ( $in['new'] ) { - $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title); - } else { - $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) . - "&diff=0&oldid=$lastid"; - } - $spaceTitle = str_replace("_", " ", $title); - - $beep = ""; - if ( $patterns ) { - foreach ( $patterns as $pattern ) { - if ( preg_match( $pattern, $comment ) ) { - $beep = chr(7); - break; - } - } - } - if ( $comment !== "" ) { - $comment = "($comment)"; - } - - $fullString = str_replace($bad, $empty, - "$beep$fmB$spaceTitle$fmB $flag $url $user $comment"); - $fullString = "PRIVMSG $room :$fullString\r\n"; - return $fullString; -} - -function joinRoom( $sock, $room ) -{ - global $rooms; - $rooms[$room] = 1; - fwrite( $sock, "JOIN #{$room}rc.wikipedia\r\n" ); -} - -function partRoom( $sock, $room ) -{ - global $rooms; - unset( $rooms[$room] ); - fwrite( $sock, "PART #{$room}rc.wikipedia\r\n" ); -} - -function processIrcInput( $sock, $line ) -{ - global $rooms; - - $die = false; - $args = explode( " ", $line ); - - if ( $args[0] == "PING" ) { - fwrite( $sock, "PONG {$args[1]}\r\n" ); - } elseif ( $args[0]{0} == ":" ) { - $name = array_shift( $args ); - $name = substr($name, 1); - $cmd = array_shift( $args ); - if ( $cmd == "PRIVMSG" ) { - $msgRoom = array_shift( $args ); - if ( $args[0] == "die" ) { - $die = true; - } elseif ( $args[0] == "join" ) { - joinRoom( $args[1] ); - } elseif ( $args[0] == "part" ) { - partRoom( $args[1] ); - } - } - } -} - -function emptyQueue( $id ) -{ - while ( msg_receive($queue, 0, $msgType, $maxMessageSize, $entry, true, MSG_IPC_NOWAIT)); -} - -?> - diff --git a/irc/rcdumper.php b/irc/rcdumper.php deleted file mode 100644 index 0ba026cd799a..000000000000 --- a/irc/rcdumper.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php - -$wgCommandLineMode = true; -$fmB = chr(2); -$fmU = chr(31); - -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; -if ( $argv[1] ) { - $lang = $argv[1]; - putenv( "wikilang=$lang"); - $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php"; - $newpath = "/apache/common/php$sep"; -} else { - $settingsFile = "../LocalSettings.php"; - $newpath = ""; -} - -if ( $argv[2] ) { - $patterns = explode( ",", $argv[2]); -} else { - $patterns = false; -} - -if ( ! is_readable( $settingsFile ) ) { - print "A copy of your installation's LocalSettings.php\n" . - "must exist in the source directory.\n"; - exit(); -} - -ini_set( "include_path", "$newpath$IP$sep$include_path" ); - -$wgCommandLineMode = true; -$DP = "../includes"; -include_once( $settingsFile ); -include_once( "Setup.php" ); -$wgTitle = Title::newFromText( "RC dumper" ); -$wgCommandLineMode = true; -set_time_limit(0); - -sleep(30); - -$res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ ); -$row = wfFetchObject( $res ); -$oldTimestamp = $row->rc_timestamp; - -while (1) { - $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ ); - $rowIndex = 0; - while ( $row = wfFetchObject( $res ) ) { - $ns = $wgLang->getNsText( $row->rc_namespace ) ; - if ( $ns ) { - $title = "$ns:{$row->rc_title}"; - } else { - $title = $row->rc_title; - } - /*if ( strlen( $row->rc_comment ) > 50 ) { - $comment = substr( $row->rc_comment, 0, 50 ); - } else {*/ - $comment = $row->rc_comment; -// } - $bad = array("\n", "\r"); - $empty = array("", ""); - $comment = str_replace($bad, $empty, $comment); - $title = str_replace($bad, $empty, $title); - $user = str_replace($bad, $empty, $row->rc_user_text); - $lastid = IntVal($row->rc_last_oldid); - $flag = ($row->rc_minor ? "M" : "") . ($row->rc_new ? "N" : ""); - if ( $row->rc_new ) { - $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title); - } else { - $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) . - "&diff=0&oldid=$lastid"; - } - $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB; - - if ( $patterns ) { - foreach ( $patterns as $pattern ) { - if ( preg_match( $pattern, $comment ) ) { - print chr(7); - break; - } - } - } - if ( $comment !== "" ) { - $comment = "($comment)"; - } - - $fullString = "$boldTitle $flag $url $user $comment\n"; - - if ( $fullString{0} == "/" ) { - $fullString = " $fullString"; - } - print( $fullString ); - $oldTimestamp = $row->rc_timestamp; - sleep(2); - } - sleep(5); -} - -exit(); - -?> |