ikiwiki/doc/tips/inside_dot_ikiwiki/discussion.mdwn

63 lines
2.9 KiB
Plaintext
Raw Normal View History

My database appears corrupted:
$ perl -le 'use Storable; my $index=Storable::retrieve("indexdb"); use Data::Dumper; print Dumper $index'
Out of memory!
No idea how this happened. I've blown it away and recreated it but, for future reference, is there any less violent way to recover from this situation? I miss having the correct created and last edited times. --[[sabr]]
> update: fixed ctimes and mtimes using [these instructions](http://u32.net/Mediawiki_Conversion/Git_Import/#Correct%20Creation%20and%20Last%20Edited%20time) --[[sabr]]
2008-06-15 19:56:08 +02:00
> That's overly complex. Just run `ikiwiki -setup your.setup -getctime`.
> BTW, I'd be interested in examining such a corrupt storable file to try
> to see what happened to it. --[[Joey]]
>> --getctime appears to only set the last edited date. It's not supposed to set the creation date, is it? The only place that info is stored is in the git repo.
2008-06-21 01:42:09 +02:00
>>> Pulling the page creation date out of the git history is exactly what
>>> --getctime does. --[[Joey]]
>> Alas, I seem to have lost the bad index file to periodic /tmp wiping; I'll send it to you if it happens again. --[[sabr]]
2008-12-02 14:21:02 +01:00
<!-- Add by Blanko -->
## Lost password for an user
This morning, a person has lost its password. I was able to do something to make another password. This is the way I take :
### Locate the user database
As tips show us, the user database is in the source file, for an example :
src/.ikiwiki/userdb
### See which user to modify
Because I don't know the real login of the user, I have to read all the database :
perl -le 'use Storable; my $index=Storable::retrieve("userdb"); use Data::Dumper; print Dumper $index'
Then I was able to find this :
'Utilisateur' => {
'email' => 'user@pl.fr',
'cryptresettoken' => '$2a$10$cfVeOoVbFw9VzMlgEbPMsu34pwHIFP84mWlkrs2RCKknZYPZkPffm',
'password' => '',
'resettoken' => '',
'cryptpassword' => '$2a$10$H8bYq.dlb68wpnfJgVZQhOdsF9JQ06cteRfhPQPB5eHKnD5Y3u7au',
'regdate' => '1226574052'
},
Let's have a look to modify lines.
### Modify the line
When you have found the line to modify, take the user name, and change its password to **sc** (for an example) :
perl -le 'use Storable; my $userinfo=Storable::retrieve("userdb"); $userinfo->{"Utilisateur"}->{cryptpassword}=q{$2a$10$7viOHCrUkdAVL135Kr6one1mpZQ/FWYC773G1yZ0EtQciI11sSDRS}; Storable::lock_nstore($userinfo, "userdb")'
perl -le 'use Storable; my $userinfo=Storable::retrieve("userdb"); $userinfo->{"Utilisateur"}->{cryptresettoken}=q{}; Storable::lock_nstore($userinfo, "userdb")'
Because I don't know how suppress cryptresettoken and resettoken fields, I change their content with *null*.
After all these modifications, the user *Utilisateur* could connect to its account with the password **sc**, and go to Preferences, then change its password.
<!-- End of Blanko's modifications -->