2013-10-22 02:20:47 +02:00
#!/usr/bin/env php
< ? php
/*
* Script for exporting users to file
*
* GForge 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 .
*
* GForge 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 file ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*
*/
require ( '/data/www/projects.blender.org/gforge/www/env.inc.php' );
require_once $gfwww . 'include/squal_pre.php' ;
require_once 'storage.php' ;
// (A)ctive, (P)ending, (S)uspended ,(D)eleted
2013-11-12 14:28:32 +01:00
$res = db_query_params ( 'SELECT user_id,user_pw,unix_pw,user_name,realname,email,add_date,timezone FROM users WHERE status=$1 ORDER BY user_id' , array ( 'A' ));
2013-10-22 02:20:47 +02:00
$user_ids = & util_result_column_to_array ( $res , " user_id " );
2013-11-03 03:12:56 +01:00
$user_pws = & util_result_column_to_array ( $res , " user_pw " );
2013-11-12 14:28:32 +01:00
$unix_pws = & util_result_column_to_array ( $res , " unix_pw " );
2013-10-22 02:20:47 +02:00
$user_names = & util_result_column_to_array ( $res , " user_name " );
$user_realnames = & util_result_column_to_array ( $res , " realname " );
$user_emails = & util_result_column_to_array ( $res , " email " );
$user_dates = & util_result_column_to_array ( $res , " add_date " );
$user_timezones = & util_result_column_to_array ( $res , " timezone " );
$musers = array ();
for ( $i = 0 ; $i < count ( $user_names ); $i ++ )
{
2013-11-02 20:18:13 +01:00
$muser = new MigrateUser ();
$muser -> id = $user_ids [ $i ];
$muser -> password = $user_pws [ $i ];
2013-11-12 14:28:32 +01:00
$muser -> unix_password = $unix_pws [ $i ];
2013-11-02 20:18:13 +01:00
$muser -> name = $user_names [ $i ];
$muser -> realname = trim ( $user_realnames [ $i ]);
$muser -> email = $user_emails [ $i ];
$muser -> date = $user_dates [ $i ];
$muser -> timezone = $user_timezones [ $i ];
$musers [] = $muser ;
2013-10-22 02:20:47 +02:00
}
file_put_contents ( 'dump/users' , serialize ( $musers ));
?>