May 9

MediaWiki: Resetting passwords

==Methods==

===Use Special:UserLogin===
If you know the username for an account, you can use the “Email new password” feature on the [[Special:UserLogin]] page. To use the feature, visit the Special:UserLogin page for the relevant wiki, fill in the Username field of the form and press the ‘Email new password’ button. A temporary password, along with instructions on how to reset the account’s password, will be sent to the email address associated with the username.

===Finding the username for a given email address===
If you know the email address for a user, but not their username, query the <code>[[Manual:User_table|user]]</code> table of the MediaWiki database to find the associated username. For example, to find the username for <tt>[email protected]</tt>, run the following query:

<source lang=”sql”>
SELECT user_name FROM user WHERE user_email = ‘[email protected]’;
</source>

===Use the changePassword.php maintenance script===
The [[Manual:ChangePassword.php|changePassword.php]] [[Manual:Maintenance_scripts|maintenance script]] allows system administrators to change the password for an account from the command line of the server that MediaWiki is installed on. For complete usage details, review [[Manual:ChangePassword.php|changePassword.php]]. If you are already familiar with maintenance scripts, then simply run the following command:

<source lang=”bash”>
# set the password for username ‘example’ to ‘newpassword’
php changePassword.php –user=example –password=newpassword
</source>

{{caution}} System administrators should not know the unencrypted password for user accounts. A user may use the same password over many different sites. If one of their accounts that uses the same password is compromised, then suspicion can be thrown on the administrator. It is better to use [[#Use Special:UserLogin|use “Email new password”]] to force the user to reset the password for their own account.

===Use Special:PasswordReset===
[[Special:PasswordReset]] allows accounts with the ‘passwordreset’ permission to reset account passwords for the local installation of MediaWiki.

To use:

* Type username you want to reset in box provided and click “Reset password”
* An automatically generated password will be emailed to the user

For automatically inserting the username in links, use <code>Special:PasswordReset?wpUsername=Foo</code>

===Direct database modification===
To reset a password you can change the value of <code>user_password</code> field, in <code>user</code> table. However, it’s generally far easier and safer to [[#Use Special:UserLogin|use “Email new password”]] or [[#Use the changePassword.php maintenance script | use the changePassword.php script]].

==== For MediaWiki Version 1.13 and above ====
You should choose the salted or unsalted method depending on the value of [[Manual:$wgPasswordSalt|$wgPasswordSalt]] in [[Manual:LocalSettings.php|LocalSettings.php]]

; MySQL unsalted:
<source lang=”sql”>
UPDATE user SET user_password = CONCAT(‘:A:’, MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

; MySQL salted (make sure both instances of “somesalt” are the same):
<source lang=”sql”>
UPDATE user SET user_password = CONCAT(‘:B:somesalt:’, MD5(CONCAT(‘somesalt-‘, MD5(‘somepass’)))) WHERE user_name = ‘someuser’;
</source>

;PostgreSQL unsalted:
<source lang=”sql”>
update mwuser SET user_password = text(‘:A:’) || MD5(‘somepass’) WHERE user_name = ‘someuser’;
</source>

;PostgreSQL salted (make sure both instances of “somesalt” are the same):
<source lang=”sql”>
update mwuser SET user_password = text(‘:B:somesalt:’) || MD5(text(‘somesalt-‘) || MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

==== For MediaWiki Version 1.12 and below ====
MySQL:
<source lang=”sql”>
UPDATE user SET user_password = MD5(CONCAT(user_id, ‘-‘, MD5(‘somepass’))) WHERE user_name = ‘someuser’;
</sour==Overview==
There are any number of situations where a user may need to reset their password. Typically, people either forget their password or experience some kind of security breach that may have disclosed their password. For most situations, they can reset their own password [[#Use Special:UserLogin|using “Email new password”]].

In situations that are complicated by the user forgetting their account name or losing access to their email, additional measures may need to be taken by an administrator or system administrator.

==Methods==

===Use Special:UserLogin===
If you know the username for an account, you can use the “Email new password” feature on the [[Special:UserLogin]] page. To use the feature, visit the Special:UserLogin page for the relevant wiki, fill in the Username field of the form and press the ‘Email new password’ button. A temporary password, along with instructions on how to reset the account’s password, will be sent to the email address associated with the username.

===Finding the username for a given email address===
If you know the email address for a user, but not their username, query the <code>[[Manual:User_table|user]]</code> table of the MediaWiki database to find the associated username. For example, to find the username for <tt>[email protected]</tt>, run the following query:

<source lang=”sql”>
SELECT user_name FROM user WHERE user_email = ‘[email protected]’;
</source>

===Use the changePassword.php maintenance script===
The [[Manual:ChangePassword.php|changePassword.php]] [[Manual:Maintenance_scripts|maintenance script]] allows system administrators to change the password for an account from the command line of the server that MediaWiki is installed on. For complete usage details, review [[Manual:ChangePassword.php|changePassword.php]]. If you are already familiar with maintenance scripts, then simply run the following command:

<source lang=”bash”>
# set the password for username ‘example’ to ‘newpassword’
php changePassword.php –user=example –password=newpassword
</source>

{{caution}} System administrators should not know the unencrypted password for user accounts. A user may use the same password over many different sites. If one of their accounts that uses the same password is compromised, then suspicion can be thrown on the administrator. It is better to use [[#Use Special:UserLogin|use “Email new password”]] to force the user to reset the password for their own account.

===Use Special:PasswordReset===
[[Special:PasswordReset]] allows accounts with the ‘passwordreset’ permission to reset account passwords for the local installation of MediaWiki.

To use:

* Type username you want to reset in box provided and click “Reset password”
* An automatically generated password will be emailed to the user

For automatically inserting the username in links, use <code>Special:PasswordReset?wpUsername=Foo</code>

===Direct database modification===
To reset a password you can change the value of <code>user_password</code> field, in <code>user</code> table. However, it’s generally far easier and safer to [[#Use Special:UserLogin|use “Email new password”]] or [[#Use the changePassword.php maintenance script | use the changePassword.php script]].

==== For MediaWiki Version 1.13 and above ====
You should choose the salted or unsalted method depending on the value of [[Manual:$wgPasswordSalt|$wgPasswordSalt]] in [[Manual:LocalSettings.php|LocalSettings.php]]

; MySQL unsalted:
<source lang=”sql”>
UPDATE user SET user_password = CONCAT(‘:A:’, MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

; MySQL salted (make sure both instances of “somesalt” are the same):
<source lang=”sql”>
UPDATE user SET user_password = CONCAT(‘:B:somesalt:’, MD5(CONCAT(‘somesalt-‘, MD5(‘somepass’)))) WHERE user_name = ‘someuser’;
</source>

;PostgreSQL unsalted:
<source lang=”sql”>
update mwuser SET user_password = text(‘:A:’) || MD5(‘somepass’) WHERE user_name = ‘someuser’;
</source>

;PostgreSQL salted (make sure both instances of “somesalt” are the same):
<source lang=”sql”>
update mwuser SET user_password = text(‘:B:somesalt:’) || MD5(text(‘somesalt-‘) || MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

==== For MediaWiki Version 1.12 and below ====
MySQL:
<source lang=”sql”>
UPDATE user SET user_password = MD5(CONCAT(user_id, ‘-‘, MD5(‘somepass’))) WHERE user_name = ‘someuser’;
</source>

PostgreSQL:
<source lang=”sql”>
UPDATE mwuser SET user_password = MD5(text(“user_id”) || text(‘-‘) || MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

==Notes==
Also restarting Apache and clearing your browser cache might help. <!– This seems to be spurious. If so, it’s relatively harmless. –>ce>

PostgreSQL:
<source lang=”sql”>
UPDATE mwuser SET user_password = MD5(text(“user_id”) || text(‘-‘) || MD5(‘somepass’)) WHERE user_name = ‘someuser’;
</source>

==Notes==
Also restarting Apache and clearing your browser cache might help. <!– This seems to be spurious. If so, it’s relatively harmless. –>

Category: Websites | Comments Off on MediaWiki: Resetting passwords
April 12

MediaWiki: Fix Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING Namespace.php

The following information will fix the NAMESPACE errors when upgrading to a newer version of MediaWiki
Backup your wiki file first.
Access your webserver and go to the MediaWiki/includes directory.
For example:

cd /usr/local/www/apache22/data/wiki/includes

Edit Namespace.php

nano Namespace.php

Go to line 44 or whichever line your error referenced, change the following from:

class Namespace {

to:

class MWNamespace {

Save the file.
Now, let’s create a script (do this in the “includes” directory):

nano wikifix.sh

Copy and paste the following (You may need to correct the ‘ manually):

for fl in *.php; do
mv $fl $fl.old
sed ‘s/Namespace::/MWNamespace::/g’ $fl.old > $fl
done

Save the file.

Change the file to executable by:

chmod u+x wikifix.sh

Search the keyword Namespace:: and replace it by MWNamespace:::

./wikifix.sh

Warning: Don’t run the script twice!
Delete the script.

rm wikifix.sh

rm *.old

Try to access the MediaWiki again and the problem should be gone.

By: Derrick
Modified By: nighthawk

Category: Websites | Comments Off on MediaWiki: Fix Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING Namespace.php
October 27

MediaWiki: How to reset my admin password?

 

In order to reset the password for MediaWiki’s admin, there are a couple of options:

 

1. The first and easiest one is to use the option ‘E-mail new password’ next to MediaWiki’s login. In this case the password will be sent to the email address assigned to the administrative user for the MediaWiki installation;

 

If this does not work for you, there is a another way to reset MediaWiki’s admin password.

 

2. Go to your cPanel > phpMyAdmin and select the MediaWiki database from the menu on the left. The page will refresh and the database tables will be displayed on it. Open the SQL tab (located at the top navigation bar).

In the text field write the following SQL query:

 

UPDATE user SET user_password = MD5( CONCAT( user_id, ‘-‘, MD5( ‘NEWPASS‘ ) ) ) WHERE user_id =1

 

Then click on the GO button to submit the query. If everything goes fine without errors, you should be able to login to MediaWiki with the new password.

 

Category: Websites | Comments Off on MediaWiki: How to reset my admin password?
August 22

WordPress: How to turn off the comments option

Turning off the comments option

1. First you need to log into your phpMyAdmin control applet

2. Now locate and select your WordPress database on the left from the database dropdown list

3. Now select the SQL tab from the navigation tabs at the top

4. Within the Run SQL Query box add the following code and click go:

UPDATE wp_posts p SET comment_status = ‘closed’, ping_status = ‘closed’ WHERE comment_status = ‘open’;

5. If you get an error, check your wp_post prefix from the database list and change the code to match accordingly

If successful, you should have disabled the ability to comment on your posts across your entire blog.

To globally enable or re-enable comments, simply use the following code:

UPDATE wp_posts p SET comment_status = ‘open’, ping_status = ‘open’ WHERE comment_status = ‘closed’;

From: lancelhoff.com

Category: Websites | Comments Off on WordPress: How to turn off the comments option