automatic version update by autodist [release 1.21.2-1mamba;Tue Sep 17 2013]
This commit is contained in:
parent
232d6dc32a
commit
839769493a
@ -1,2 +1,5 @@
|
|||||||
# mediawiki
|
# mediawiki
|
||||||
|
|
||||||
|
MediaWiki is the collaborative editing software that runs Wikipedia, the free encyclopedia, and other projects.
|
||||||
|
It's designed to handle a large number of users and pages without imposing too rigid a structure or workflow.
|
||||||
|
|
||||||
|
31
mediawiki-1.21.2-DefaultSettings.patch
Normal file
31
mediawiki-1.21.2-DefaultSettings.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
diff -Nru mediawiki-1.21.2.orig/includes/DefaultSettings.php mediawiki-1.21.2/includes/DefaultSettings.php
|
||||||
|
--- mediawiki-1.21.2.orig/includes/DefaultSettings.php 2013-09-03 20:56:39.000000000 +0200
|
||||||
|
+++ mediawiki-1.21.2/includes/DefaultSettings.php 2013-09-16 15:05:04.329722387 +0200
|
||||||
|
@@ -3914,7 +3914,7 @@
|
||||||
|
* Should editors be required to have a validated e-mail
|
||||||
|
* address before being allowed to edit?
|
||||||
|
*/
|
||||||
|
-$wgEmailConfirmToEdit = false;
|
||||||
|
+$wgEmailConfirmToEdit = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permission keys given to users in each group.
|
||||||
|
@@ -3946,14 +3946,14 @@
|
||||||
|
// Implicit group for all visitors
|
||||||
|
$wgGroupPermissions['*']['createaccount'] = true;
|
||||||
|
$wgGroupPermissions['*']['read'] = true;
|
||||||
|
-$wgGroupPermissions['*']['edit'] = true;
|
||||||
|
-$wgGroupPermissions['*']['createpage'] = true;
|
||||||
|
-$wgGroupPermissions['*']['createtalk'] = true;
|
||||||
|
+$wgGroupPermissions['*']['edit'] = false;
|
||||||
|
+$wgGroupPermissions['*']['createpage'] = false;
|
||||||
|
+$wgGroupPermissions['*']['createtalk'] = false;
|
||||||
|
$wgGroupPermissions['*']['writeapi'] = true;
|
||||||
|
#$wgGroupPermissions['*']['patrolmarks'] = false; // let anons see what was patrolled
|
||||||
|
|
||||||
|
// Implicit group for all logged-in accounts
|
||||||
|
-$wgGroupPermissions['user']['move'] = true;
|
||||||
|
+$wgGroupPermissions['user']['move'] = false;
|
||||||
|
$wgGroupPermissions['user']['move-subpages'] = true;
|
||||||
|
$wgGroupPermissions['user']['move-rootuserpages'] = true; // can move root userpages
|
||||||
|
$wgGroupPermissions['user']['movefile'] = true;
|
370
mediawiki-AuthPress.php
Normal file
370
mediawiki-AuthPress.php
Normal file
@ -0,0 +1,370 @@
|
|||||||
|
<?php
|
||||||
|
# AuthPress.php
|
||||||
|
# Copyright (C) 2007-2008 Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
# Version 0.2.1 - December 31, 2007
|
||||||
|
# Version 0.2.2 - Add support for PasswordHash (used by bbpress >= 0.9)
|
||||||
|
#
|
||||||
|
# - disable password modifications
|
||||||
|
# - prepend a " " to table names so primitives won't prepend mediawiki prefix
|
||||||
|
#
|
||||||
|
# Derived from original AuthPress.php
|
||||||
|
# Copyright (C) 2005 Rob Lanphier <robla@robla.net>
|
||||||
|
# Version 0.2.0 - July 26, 2005
|
||||||
|
# Authenticate MediaWiki users against a bbPress (and possibly WordPress)
|
||||||
|
# database
|
||||||
|
#
|
||||||
|
# Usage instructions, release notes, and other stuff:
|
||||||
|
# http://codex.wordpress.org/User:RobLa/AuthPress_for_MediaWiki
|
||||||
|
#
|
||||||
|
# Derived from AuthPlugin.php
|
||||||
|
# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
|
||||||
|
# http://www.mediawiki.org/
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
|
||||||
|
require_once('AuthPlugin.php');
|
||||||
|
require_once('PasswordHash.php');
|
||||||
|
|
||||||
|
class AuthPress extends AuthPlugin {
|
||||||
|
|
||||||
|
var $mAuthPressTablePrefix="wp_";
|
||||||
|
var $mUseSeparateAuthPressDB=false;
|
||||||
|
var $mAuthPressDBServer;
|
||||||
|
var $mAuthPressDBName;
|
||||||
|
var $mAuthPressUser;
|
||||||
|
var $mAuthPressPassword;
|
||||||
|
var $mAuthPressDBconn = -1;
|
||||||
|
|
||||||
|
function AuthPress () {
|
||||||
|
global $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword;
|
||||||
|
|
||||||
|
$this->mAuthPressDBServer=$wgDBserver;
|
||||||
|
$this->mAuthPressDBName=$wgDBname;
|
||||||
|
$this->mAuthPressUser=$wgDBuser;
|
||||||
|
$this->mAuthPressPassword=$wgDBpassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAuthPressTablePrefix ( $prefix ) {
|
||||||
|
$this->mAuthPressTablePrefix=$prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAuthPressUserTableName () {
|
||||||
|
return " ".$this->mAuthPressTablePrefix."users";
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAuthPressDBServer ($server) {
|
||||||
|
$this->mUseSeparateAuthPressDB=true;
|
||||||
|
$this->mAuthPressDBServer=$server;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAuthPressDBName ($dbname) {
|
||||||
|
$this->mUseSeparateAuthPressDB=true;
|
||||||
|
$this->mAuthPressDBName=$dbname;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAuthPressUser ($user) {
|
||||||
|
$this->mUseSeparateAuthPressDB=true;
|
||||||
|
$this->mAuthPressUser=$user;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAuthPressPassword ($password) {
|
||||||
|
$this->mUseSeparateAuthPressDB=true;
|
||||||
|
$this->mAuthPressPassword=$password;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getAuthPressDB () {
|
||||||
|
if( $this->mUseSeparateAuthPressDB ) {
|
||||||
|
//print $this->mAuthPressDBServer;
|
||||||
|
//print $this->mAuthPressUser;
|
||||||
|
//print $this->mAuthPressPassword;
|
||||||
|
//print $this->mAuthPressDBName;
|
||||||
|
if(! is_object($this->mDBconn) ) {
|
||||||
|
$this->mAuthPressDBconn =
|
||||||
|
new Database($this->mAuthPressDBServer,
|
||||||
|
$this->mAuthPressUser,
|
||||||
|
$this->mAuthPressPassword,
|
||||||
|
$this->mAuthPressDBName,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
$mAuthPressTablePrefix);
|
||||||
|
}
|
||||||
|
return $this->mAuthPressDBconn;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return wfGetDB( DB_SLAVE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Interface documentation copied in from AuthPlugin */
|
||||||
|
/**
|
||||||
|
* Check whether there exists a user account with the given name.
|
||||||
|
* The name will be normalized to MediaWiki's requirements, so
|
||||||
|
* you might need to munge it (for instance, for lowercase initial
|
||||||
|
* letters).
|
||||||
|
*
|
||||||
|
* @param string $username
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function userExists( $username ) {
|
||||||
|
$dbr =& $this->getAuthPressDB();
|
||||||
|
|
||||||
|
$res = $dbr->selectRow($this->getAuthPressUserTableName(),
|
||||||
|
"user_login",
|
||||||
|
"user_login=".$dbr->addQuotes($username),
|
||||||
|
"AuthPress::authenticate" );
|
||||||
|
|
||||||
|
if($res) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a username+password pair is a valid login.
|
||||||
|
* The name will be normalized to MediaWiki's requirements, so
|
||||||
|
* you might need to munge it (for instance, for lowercase initial
|
||||||
|
* letters).
|
||||||
|
*
|
||||||
|
* @param string $username
|
||||||
|
* @param string $password
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function authenticate( $username, $password ) {
|
||||||
|
$dbr =& $this->getAuthPressDB();
|
||||||
|
$res = $dbr->selectRow($this->getAuthPressUserTableName(),
|
||||||
|
"user_pass",
|
||||||
|
"user_login=".$dbr->addQuotes($username),
|
||||||
|
"AuthPress::authenticate" );
|
||||||
|
$hasher = new PasswordHash(8, TRUE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For bbpress < 0.9 use MD5 check: $res->user_pass == MD5( $password)
|
||||||
|
*/
|
||||||
|
if( $res && ( $hasher->CheckPassword($password, $res->user_pass))) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify options in the login template.
|
||||||
|
*
|
||||||
|
* @param UserLoginTemplate $template
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function modifyUITemplate( &$template ) {
|
||||||
|
$template->set( 'usedomain', false );
|
||||||
|
$template->set( 'useemail', false );
|
||||||
|
$template->set( 'create', false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the domain this plugin is supposed to use when authenticating.
|
||||||
|
*
|
||||||
|
* @param string $domain
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function setDomain( $domain ) {
|
||||||
|
$this->domain = $domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if the specific domain is a valid domain.
|
||||||
|
*
|
||||||
|
* @param string $domain
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function validDomain( $domain ) {
|
||||||
|
# Override this!
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When a user logs in, optionally fill in preferences and such.
|
||||||
|
* For instance, you might pull the email address or real name from the
|
||||||
|
* external user database.
|
||||||
|
*
|
||||||
|
* The User object is passed by reference so it can be modified; don't
|
||||||
|
* forget the & on your function declaration.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function updateUser( &$user ) {
|
||||||
|
|
||||||
|
$dbr =& $this->getAuthPressDB();
|
||||||
|
|
||||||
|
$res = $dbr->selectRow($this->getAuthPressUserTableName(),
|
||||||
|
array("user_nicename", "user_email"),
|
||||||
|
"user_login=".
|
||||||
|
$dbr->addQuotes($user->mName),
|
||||||
|
"AuthPress::authenticate" );
|
||||||
|
|
||||||
|
if($res) {
|
||||||
|
$user->setEmail( $res->user_email );
|
||||||
|
$user->setRealName( $res->user_nicename );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the wiki should create a new local account automatically
|
||||||
|
* when asked to login a user who doesn't exist locally but does in the
|
||||||
|
* external auth database.
|
||||||
|
*
|
||||||
|
* If you don't automatically create accounts, you must still create
|
||||||
|
* accounts in some way. It's not possible to authenticate without
|
||||||
|
* a local account.
|
||||||
|
*
|
||||||
|
* This is just a question, and shouldn't perform any actions.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function autoCreate() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can users change their passwords?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function allowPasswordChange() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the given password in the authentication database.
|
||||||
|
* Return true if successful.
|
||||||
|
*
|
||||||
|
* @param string $password
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function setPassword( $password ) {
|
||||||
|
# we probably don't want users using MW to change password
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update user information in the external authentication database.
|
||||||
|
* Return true if successful.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function updateExternalDB( $user ) {
|
||||||
|
# we probably don't want users using MW to change other stuff
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if external accounts can be created.
|
||||||
|
* Return true if external accounts can be created.
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function canCreateAccounts() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a user to the external authentication database.
|
||||||
|
* Return true if successful.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param string $password
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function addUser( $user, $password ) {
|
||||||
|
# disabling
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true to prevent logins that don't authenticate here from being
|
||||||
|
* checked against the local database's password fields.
|
||||||
|
*
|
||||||
|
* This is just a question, and shouldn't perform any actions.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function strict() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When creating a user account, optionally fill in preferences and such.
|
||||||
|
* For instance, you might pull the email address or real name from the
|
||||||
|
* external user database.
|
||||||
|
*
|
||||||
|
* The User object is passed by reference so it can be modified; don't
|
||||||
|
* forget the & on your function declaration.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function initUser( &$user ) {
|
||||||
|
/* User's email is already authenticated, because:
|
||||||
|
* A. They have valid bbPress account
|
||||||
|
* B. bbPress emailed them the password
|
||||||
|
* C. They are logged in (presumably using that password
|
||||||
|
* If something changes about the bbPress email verification,
|
||||||
|
* then this function might need changing, too
|
||||||
|
*/
|
||||||
|
$user->mEmailAuthenticated = wfTimestampNow();
|
||||||
|
|
||||||
|
/* Everything else is in updateUser */
|
||||||
|
$this->updateUser( $user );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you want to munge the case of an account name before the final
|
||||||
|
* check, now is your chance.
|
||||||
|
*/
|
||||||
|
function getCanonicalName ( $username ) {
|
||||||
|
// connecting to MediaWiki database for this check
|
||||||
|
$dbr =& wfGetDB( DB_SLAVE );
|
||||||
|
|
||||||
|
$res = $dbr->selectRow('user',
|
||||||
|
array("user_name"),
|
||||||
|
"lower(user_name)=lower(".
|
||||||
|
$dbr->addQuotes($username).")",
|
||||||
|
"AuthPress::getCanonicalName" );
|
||||||
|
|
||||||
|
if($res) {
|
||||||
|
return $res->user_name;
|
||||||
|
} else {
|
||||||
|
return $username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
9
mediawiki-AuthPress_LocalSettings.php
Normal file
9
mediawiki-AuthPress_LocalSettings.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Use bbPress Authentication
|
||||||
|
require_once( 'extensions/AuthPress.php' );
|
||||||
|
$wgAuth = new AuthPress();
|
||||||
|
$wgAuth->setAuthPressTablePrefix('bb_');
|
||||||
|
# Only include the following if you aren't using the same db as MediaWiki
|
||||||
|
#$wgAuth->setAuthPressDBServer ('FIXME');
|
||||||
|
#$wgAuth->setAuthPressDBName('FIXME');
|
||||||
|
#$wgAuth->setAuthPressUser('FIXME');
|
||||||
|
#$wgAuth->setAuthPressPassword('FIXME');
|
248
mediawiki-PasswordHash.php
Normal file
248
mediawiki-PasswordHash.php
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
#
|
||||||
|
# Portable PHP password hashing framework.
|
||||||
|
#
|
||||||
|
# Version 0.1 / genuine.
|
||||||
|
#
|
||||||
|
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
|
||||||
|
# the public domain.
|
||||||
|
#
|
||||||
|
# There's absolutely no warranty.
|
||||||
|
#
|
||||||
|
# The homepage URL for this framework is:
|
||||||
|
#
|
||||||
|
# http://www.openwall.com/phpass/
|
||||||
|
#
|
||||||
|
# Please be sure to update the Version line if you edit this file in any way.
|
||||||
|
# It is suggested that you leave the main version number intact, but indicate
|
||||||
|
# your project name (after the slash) and add your own revision information.
|
||||||
|
#
|
||||||
|
# Please do not change the "private" password hashing method implemented in
|
||||||
|
# here, thereby making your hashes incompatible. However, if you must, please
|
||||||
|
# change the hash type identifier (the "$P$") to something different.
|
||||||
|
#
|
||||||
|
# Obviously, since this code is in the public domain, the above are not
|
||||||
|
# requirements (there can be none), but merely suggestions.
|
||||||
|
#
|
||||||
|
class PasswordHash {
|
||||||
|
var $itoa64;
|
||||||
|
var $iteration_count_log2;
|
||||||
|
var $portable_hashes;
|
||||||
|
var $random_state;
|
||||||
|
|
||||||
|
function PasswordHash($iteration_count_log2, $portable_hashes)
|
||||||
|
{
|
||||||
|
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
|
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
|
||||||
|
$iteration_count_log2 = 8;
|
||||||
|
$this->iteration_count_log2 = $iteration_count_log2;
|
||||||
|
|
||||||
|
$this->portable_hashes = $portable_hashes;
|
||||||
|
|
||||||
|
$this->random_state = microtime() . getmypid();
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_random_bytes($count)
|
||||||
|
{
|
||||||
|
$output = '';
|
||||||
|
if (($fh = @fopen('/dev/urandom', 'rb'))) {
|
||||||
|
$output = fread($fh, $count);
|
||||||
|
fclose($fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($output) < $count) {
|
||||||
|
$output = '';
|
||||||
|
for ($i = 0; $i < $count; $i += 16) {
|
||||||
|
$this->random_state =
|
||||||
|
md5(microtime() . $this->random_state);
|
||||||
|
$output .=
|
||||||
|
pack('H*', md5($this->random_state));
|
||||||
|
}
|
||||||
|
$output = substr($output, 0, $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function encode64($input, $count)
|
||||||
|
{
|
||||||
|
$output = '';
|
||||||
|
$i = 0;
|
||||||
|
do {
|
||||||
|
$value = ord($input[$i++]);
|
||||||
|
$output .= $this->itoa64[$value & 0x3f];
|
||||||
|
if ($i < $count)
|
||||||
|
$value |= ord($input[$i]) << 8;
|
||||||
|
$output .= $this->itoa64[($value >> 6) & 0x3f];
|
||||||
|
if ($i++ >= $count)
|
||||||
|
break;
|
||||||
|
if ($i < $count)
|
||||||
|
$value |= ord($input[$i]) << 16;
|
||||||
|
$output .= $this->itoa64[($value >> 12) & 0x3f];
|
||||||
|
if ($i++ >= $count)
|
||||||
|
break;
|
||||||
|
$output .= $this->itoa64[($value >> 18) & 0x3f];
|
||||||
|
} while ($i < $count);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gensalt_private($input)
|
||||||
|
{
|
||||||
|
$output = '$P$';
|
||||||
|
$output .= $this->itoa64[min($this->iteration_count_log2 +
|
||||||
|
((PHP_VERSION >= '5') ? 5 : 3), 30)];
|
||||||
|
$output .= $this->encode64($input, 6);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function crypt_private($password, $setting)
|
||||||
|
{
|
||||||
|
$output = '*0';
|
||||||
|
if (substr($setting, 0, 2) == $output)
|
||||||
|
$output = '*1';
|
||||||
|
|
||||||
|
if (substr($setting, 0, 3) != '$P$')
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
$count_log2 = strpos($this->itoa64, $setting[3]);
|
||||||
|
if ($count_log2 < 7 || $count_log2 > 30)
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
$count = 1 << $count_log2;
|
||||||
|
|
||||||
|
$salt = substr($setting, 4, 8);
|
||||||
|
if (strlen($salt) != 8)
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
# We're kind of forced to use MD5 here since it's the only
|
||||||
|
# cryptographic primitive available in all versions of PHP
|
||||||
|
# currently in use. To implement our own low-level crypto
|
||||||
|
# in PHP would result in much worse performance and
|
||||||
|
# consequently in lower iteration counts and hashes that are
|
||||||
|
# quicker to crack (by non-PHP code).
|
||||||
|
if (PHP_VERSION >= '5') {
|
||||||
|
$hash = md5($salt . $password, TRUE);
|
||||||
|
do {
|
||||||
|
$hash = md5($hash . $password, TRUE);
|
||||||
|
} while (--$count);
|
||||||
|
} else {
|
||||||
|
$hash = pack('H*', md5($salt . $password));
|
||||||
|
do {
|
||||||
|
$hash = pack('H*', md5($hash . $password));
|
||||||
|
} while (--$count);
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = substr($setting, 0, 12);
|
||||||
|
$output .= $this->encode64($hash, 16);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gensalt_extended($input)
|
||||||
|
{
|
||||||
|
$count_log2 = min($this->iteration_count_log2 + 8, 24);
|
||||||
|
# This should be odd to not reveal weak DES keys, and the
|
||||||
|
# maximum valid value is (2**24 - 1) which is odd anyway.
|
||||||
|
$count = (1 << $count_log2) - 1;
|
||||||
|
|
||||||
|
$output = '_';
|
||||||
|
$output .= $this->itoa64[$count & 0x3f];
|
||||||
|
$output .= $this->itoa64[($count >> 6) & 0x3f];
|
||||||
|
$output .= $this->itoa64[($count >> 12) & 0x3f];
|
||||||
|
$output .= $this->itoa64[($count >> 18) & 0x3f];
|
||||||
|
|
||||||
|
$output .= $this->encode64($input, 3);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gensalt_blowfish($input)
|
||||||
|
{
|
||||||
|
# This one needs to use a different order of characters and a
|
||||||
|
# different encoding scheme from the one in encode64() above.
|
||||||
|
# We care because the last character in our encoded string will
|
||||||
|
# only represent 2 bits. While two known implementations of
|
||||||
|
# bcrypt will happily accept and correct a salt string which
|
||||||
|
# has the 4 unused bits set to non-zero, we do not want to take
|
||||||
|
# chances and we also do not want to waste an additional byte
|
||||||
|
# of entropy.
|
||||||
|
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
|
||||||
|
$output = '$2a$';
|
||||||
|
$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
|
||||||
|
$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
|
||||||
|
$output .= '$';
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
do {
|
||||||
|
$c1 = ord($input[$i++]);
|
||||||
|
$output .= $itoa64[$c1 >> 2];
|
||||||
|
$c1 = ($c1 & 0x03) << 4;
|
||||||
|
if ($i >= 16) {
|
||||||
|
$output .= $itoa64[$c1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$c2 = ord($input[$i++]);
|
||||||
|
$c1 |= $c2 >> 4;
|
||||||
|
$output .= $itoa64[$c1];
|
||||||
|
$c1 = ($c2 & 0x0f) << 2;
|
||||||
|
|
||||||
|
$c2 = ord($input[$i++]);
|
||||||
|
$c1 |= $c2 >> 6;
|
||||||
|
$output .= $itoa64[$c1];
|
||||||
|
$output .= $itoa64[$c2 & 0x3f];
|
||||||
|
} while (1);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
function HashPassword($password)
|
||||||
|
{
|
||||||
|
$random = '';
|
||||||
|
|
||||||
|
if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
|
||||||
|
$random = $this->get_random_bytes(16);
|
||||||
|
$hash =
|
||||||
|
crypt($password, $this->gensalt_blowfish($random));
|
||||||
|
if (strlen($hash) == 60)
|
||||||
|
return $hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
|
||||||
|
if (strlen($random) < 3)
|
||||||
|
$random = $this->get_random_bytes(3);
|
||||||
|
$hash =
|
||||||
|
crypt($password, $this->gensalt_extended($random));
|
||||||
|
if (strlen($hash) == 20)
|
||||||
|
return $hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($random) < 6)
|
||||||
|
$random = $this->get_random_bytes(6);
|
||||||
|
$hash =
|
||||||
|
$this->crypt_private($password,
|
||||||
|
$this->gensalt_private($random));
|
||||||
|
if (strlen($hash) == 34)
|
||||||
|
return $hash;
|
||||||
|
|
||||||
|
# Returning '*' on error is safe here, but would _not_ be safe
|
||||||
|
# in a crypt(3)-like function used _both_ for generating new
|
||||||
|
# hashes and for validating passwords against existing hashes.
|
||||||
|
return '*';
|
||||||
|
}
|
||||||
|
|
||||||
|
function CheckPassword($password, $stored_hash)
|
||||||
|
{
|
||||||
|
$hash = $this->crypt_private($password, $stored_hash);
|
||||||
|
if ($hash[0] == '*')
|
||||||
|
$hash = crypt($password, $stored_hash);
|
||||||
|
|
||||||
|
return $hash == $stored_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
244
mediawiki.spec
Normal file
244
mediawiki.spec
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
%define majversion %(echo %version | cut -d. -f 1-2)
|
||||||
|
%define serverdir %(apxs -q htdocsdir 2>/dev/null)
|
||||||
|
%define openmamba_theme_ver 1.15
|
||||||
|
# To create a customized installation of mediawiki:
|
||||||
|
# autospec -u mediawiki -a5 \
|
||||||
|
# -d "installdir=%serverdir/../wiki.example.com, sitename=example, lang=en"
|
||||||
|
|
||||||
|
%if "%{?installdir}" == ""
|
||||||
|
%define installdir %{serverdir}/wiki
|
||||||
|
%endif
|
||||||
|
|
||||||
|
Name: %{?sitename:%sitename-}mediawiki%{?lang:-%lang}
|
||||||
|
Version: 1.21.2
|
||||||
|
Release: 1mamba
|
||||||
|
Summary: A collaborative editing software that runs Wikipedia and other projects
|
||||||
|
Group: Applications/Web
|
||||||
|
Vendor: openmamba
|
||||||
|
Distribution: openmamba
|
||||||
|
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
URL: http://www.mediawiki.org
|
||||||
|
Source: http://download.wikimedia.org/mediawiki/%{majversion}/mediawiki-%{version}.tar.gz
|
||||||
|
Source1: mediawiki-AuthPress.php
|
||||||
|
Source2: mediawiki-AuthPress_LocalSettings.php
|
||||||
|
Source3: mediawiki-theme-openmamba-%{openmamba_theme_ver}.tar.bz2
|
||||||
|
Source4: mediawiki-PasswordHash.php
|
||||||
|
Source5: http://mediawiki.narod.ru/QPoll_0.7.0.tgz
|
||||||
|
Patch0: mediawiki-1.21.2-DefaultSettings.patch
|
||||||
|
License: GPL
|
||||||
|
Requires: apache-mod_php >= 5
|
||||||
|
Requires: php-apc
|
||||||
|
Requires: mysql >= 4
|
||||||
|
Requires: php-mysql
|
||||||
|
Requires: diffutils
|
||||||
|
Requires: ImageMagick
|
||||||
|
BuildArch: noarch
|
||||||
|
Requires(pre): php
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||||
|
|
||||||
|
%description
|
||||||
|
MediaWiki is the collaborative editing software that runs Wikipedia, the free encyclopedia, and other projects.
|
||||||
|
It's designed to handle a large number of users and pages without imposing too rigid a structure or workflow.
|
||||||
|
|
||||||
|
%package theme-openmamba
|
||||||
|
Summary: openmamba theme for mediawiki
|
||||||
|
Group: Applications/Web
|
||||||
|
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
|
||||||
|
|
||||||
|
%description theme-openmamba
|
||||||
|
MediaWiki is the collaborative editing software that runs Wikipedia, the free encyclopedia, and other projects.
|
||||||
|
It's designed to handle a large number of users and pages without imposing too rigid a structure or workflow.
|
||||||
|
|
||||||
|
This package contains the openmamba theme.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n mediawiki-%{version} -a3
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
# FIXME: ocaml missing
|
||||||
|
#make -C math
|
||||||
|
|
||||||
|
%install
|
||||||
|
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
|
||||||
|
install -d %{buildroot}%{installdir}
|
||||||
|
|
||||||
|
#install -D -m 755 math/texvc \
|
||||||
|
# %{buildroot}%{installdir}/math/texvc
|
||||||
|
#make clean -C math
|
||||||
|
|
||||||
|
cp -a * %{buildroot}%{installdir}
|
||||||
|
rm -fr %{buildroot}%{installdir}/{t,tests}
|
||||||
|
find %{buildroot}%{installdir} -name .svnignore -delete
|
||||||
|
for docfile in COPYING FAQ HISTORY INSTALL README RELEASE-NOTES UPGRADE; do
|
||||||
|
rm -f %{buildroot}%{installdir}/$docfile
|
||||||
|
done
|
||||||
|
|
||||||
|
chmod 770 %{buildroot}%{installdir}/mw-config
|
||||||
|
chmod 775 %{buildroot}%{installdir}/images
|
||||||
|
#chmod 640 %{buildroot}%{installdir}/AdminSettings.sample
|
||||||
|
|
||||||
|
install -d %{buildroot}%{_sysconfdir}/httpd/httpd.d
|
||||||
|
cat > %{buildroot}%{_sysconfdir}/httpd/httpd.d/%{name}.conf << EOF
|
||||||
|
Alias /wiki%{?lang:-%lang} %{installdir}
|
||||||
|
|
||||||
|
<Directory %{installdir}>
|
||||||
|
AllowOverride Options
|
||||||
|
Allow from All
|
||||||
|
</Directory>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
install %{SOURCE1} %{buildroot}%{installdir}/extensions/AuthPress.php
|
||||||
|
install %{SOURCE2} %{buildroot}%{installdir}/mw-config/LocalSettings.php.AuthPress
|
||||||
|
install %{SOURCE4} %{buildroot}%{installdir}/includes/PasswordHash.php
|
||||||
|
|
||||||
|
tar -xzf %{SOURCE5} -C %{buildroot}%{installdir}/extensions
|
||||||
|
|
||||||
|
%clean
|
||||||
|
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
|
||||||
|
|
||||||
|
%post
|
||||||
|
if [ $1 -ge 1 ]; then
|
||||||
|
service httpd condrestart
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update (AdminSettings.php have to contain database password)
|
||||||
|
if [ $1 -gt 1 ] && [ -e %{installdir}/AdminSettings.php ]; then
|
||||||
|
/usr/bin/php %{installdir}/maintenance/update.php --quick || true
|
||||||
|
fi
|
||||||
|
:
|
||||||
|
|
||||||
|
%preun
|
||||||
|
# uninstall
|
||||||
|
if [ $1 -eq 0 ]; then
|
||||||
|
service httpd condrestart
|
||||||
|
fi
|
||||||
|
:
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%config(noreplace) %{_sysconfdir}/httpd/httpd.d/%{name}.conf
|
||||||
|
%dir %{installdir}
|
||||||
|
#%{installdir}/AdminSettings.sample
|
||||||
|
#%{installdir}/Makefile
|
||||||
|
%attr(-,root,nobody) %{installdir}/mw-config
|
||||||
|
%attr(-,root,nobody) %{installdir}/images
|
||||||
|
#%{installdir}/bin
|
||||||
|
%{installdir}/CREDITS
|
||||||
|
%{installdir}/cache/.htaccess
|
||||||
|
%{installdir}/composer.json
|
||||||
|
%{installdir}/docs
|
||||||
|
%{installdir}/extensions
|
||||||
|
%{installdir}/includes
|
||||||
|
%{installdir}/languages
|
||||||
|
#%{installdir}/locale
|
||||||
|
%{installdir}/maintenance
|
||||||
|
#%{installdir}/math
|
||||||
|
%{installdir}/mw-config
|
||||||
|
%{installdir}/resources
|
||||||
|
%{installdir}/skins
|
||||||
|
%{installdir}/serialized
|
||||||
|
#%{installdir}/install-utils.inc
|
||||||
|
%{installdir}/*.php
|
||||||
|
%{installdir}/*.php5
|
||||||
|
%{installdir}/redirect.phtml
|
||||||
|
%{installdir}/StartProfiler.sample
|
||||||
|
%{installdir}/wiki.phtml
|
||||||
|
%{installdir}/README.mediawiki
|
||||||
|
%{installdir}/RELEASE-NOTES*
|
||||||
|
%doc COPYING FAQ HISTORY README UPGRADE
|
||||||
|
%exclude %{installdir}/skins/openmamba*
|
||||||
|
|
||||||
|
%files theme-openmamba
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{installdir}/skins/openmamba.php
|
||||||
|
%dir %{installdir}/skins/openmamba
|
||||||
|
%dir %{installdir}/skins/openmamba/*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Sep 17 2013 Automatic Build System <autodist@mambasoft.it> 1.21.2-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Tue May 28 2013 Automatic Build System <autodist@mambasoft.it> 1.20.6-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Mon May 06 2013 Automatic Build System <autodist@mambasoft.it> 1.20.5-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Mon Apr 22 2013 Automatic Build System <autodist@mambasoft.it> 1.20.4-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Sun Mar 10 2013 Automatic Build System <autodist@mambasoft.it> 1.20.3-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Mon Jan 07 2013 Automatic Build System <autodist@mambasoft.it> 1.20.2-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Thu Nov 08 2012 Automatic Build System <autodist@mambasoft.it> 1.20.0-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Fri Oct 12 2012 Automatic Build System <autodist@mambasoft.it> 1.19.2-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Tue Aug 14 2012 Automatic Build System <autodist@mambasoft.it> 1.19.1-1mamba
|
||||||
|
- automatic version update by autodist
|
||||||
|
|
||||||
|
* Wed Aug 31 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.17.0-1mamba
|
||||||
|
- update to 1.17.0
|
||||||
|
- added Poll extension
|
||||||
|
|
||||||
|
* Thu Jul 29 2010 Automatic Build System <autodist@mambasoft.it> 1.15.5-1mamba
|
||||||
|
- automatic update by autodist
|
||||||
|
|
||||||
|
* Mon Jun 21 2010 Automatic Build System <autodist@mambasoft.it> 1.15.4-1mamba
|
||||||
|
- automatic update by autodist
|
||||||
|
|
||||||
|
* Sun Mar 14 2010 Automatic Build System <autodist@mambasoft.it> 1.15.2-1mamba
|
||||||
|
- automatic update by autodist
|
||||||
|
|
||||||
|
* Thu Jul 16 2009 Automatic Build System <autodist@mambasoft.it> 1.15.1-1mamba
|
||||||
|
- automatic update by autodist
|
||||||
|
|
||||||
|
* Wed Jul 08 2009 Automatic Build System <autodist@mambasoft.it> 1.15.0-1mamba
|
||||||
|
- update to 1.15.0
|
||||||
|
|
||||||
|
* Thu Dec 18 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.13.3-1mamba
|
||||||
|
- update to 1.13.3
|
||||||
|
|
||||||
|
* Mon Jun 16 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.10.4-1mamba
|
||||||
|
- update to 1.10.4
|
||||||
|
- AuthPress.php: update to support use of PasswordHash for bbpress >= 0.9
|
||||||
|
- openmamba theme: update to 1.1.1 (minor fixes)
|
||||||
|
|
||||||
|
* Sat Jan 05 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.10.2-3mamba
|
||||||
|
- openmamba theme updated
|
||||||
|
|
||||||
|
* Wed Jan 02 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.10.2-2mamba
|
||||||
|
- added openmamba theme package
|
||||||
|
|
||||||
|
* Mon Dec 31 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.10.2-1mamba
|
||||||
|
- update to 1.10.2
|
||||||
|
|
||||||
|
* Tue May 29 2007 Stefano Cotta Ramusino <stefano.cotta@openmamba.org> 1.10.0-2mamba
|
||||||
|
- added apache configuration file
|
||||||
|
- added %%installdir, %%sitename and %%lang variables
|
||||||
|
|
||||||
|
* Sun May 20 2007 Stefano Cotta Ramusino <stefano.cotta@openmamba.org> 1.10.0-1mamba
|
||||||
|
- update to 1.10.0
|
||||||
|
- added %%post script
|
||||||
|
|
||||||
|
* Sun Apr 15 2007 Stefano Cotta Ramusino <stefano.cotta@openmamba.org> 1.9.3-1mamba
|
||||||
|
- update to version 1.9.3 by autospec
|
||||||
|
|
||||||
|
* Fri Jul 28 2006 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 1.7.1-1qilnx
|
||||||
|
- update to version 1.7.1 by autospec
|
||||||
|
|
||||||
|
* Wed Jun 21 2006 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 1.6.7-1qilnx
|
||||||
|
- update to version 1.6.7 by autospec
|
||||||
|
- architecture changed to noarch
|
||||||
|
|
||||||
|
* Thu Apr 27 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.3-2qilnx
|
||||||
|
- changed default settings to restrict anonymous and logged user permissions
|
||||||
|
|
||||||
|
* Wed Apr 26 2006 Silvan Calarco <silvan.calarco@mambasoft.it> 1.6.3-1qilnx
|
||||||
|
- package created by autospec
|
Loading…
Reference in New Issue
Block a user