27 if (!defined(
'NOSESSION')) define(
'NOSESSION',
'1');
29 $sapi_type = php_sapi_name();
30 $script_file = basename(__FILE__);
34 if (substr($sapi_type, 0, 3) ==
'cgi') {
35 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
40 define(
'EVEN_IF_ONLY_LOGIN_ALLOWED', 1);
43 require_once $path.
"../../htdocs/master.inc.php";
44 require_once DOL_DOCUMENT_ROOT.
"/user/class/user.class.php";
45 require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
53 $version = DOL_VERSION;
58 dol_syslog($script_file.
" launched with arg ".join(
',', $argv));
60 if (!isset($argv[1]) || $argv[1] !=
'user') {
61 print "Usage: $script_file user\n";
65 print '--- start'.
"\n";
68 if ($argv[1] ==
'user') {
71 $sql =
"SELECT rowid as uid from ".MAIN_DB_PREFIX.
"user";
74 while ($obj = $db->fetch_object(
$resql)) {
76 print " migrating user id=".$u->id.
" ref=".$u->ref.
"\n";
77 migrate_user_filespath($u);
80 print "\n sql error ".$sql;
96 function migrate_user_filespath($u)
101 $dir = $conf->user->dir_output;
102 $origin = $dir.
'/'.
get_exdir($u->id, 2, 0, 0, $u,
'user');
103 $destin = $dir.
'/'.$u->id;
112 $handle = opendir($origin_osencoded);
113 if (is_resource($handle)) {
114 while (($file = readdir($handle)) !==
false) {
115 if ($file !=
'.' && $file !=
'..' && is_dir($origin_osencoded.
'/'.$file)) {
116 $thumbs = opendir($origin_osencoded.
'/'.$file);
117 if (is_resource($thumbs)) {
119 while (($thumb = readdir($thumbs)) !==
false) {
120 dol_move($origin.
'/'.$file.
'/'.$thumb, $destin.
'/'.$file.
'/'.$thumb);
126 dol_move($origin.
'/'.$file, $destin.
'/'.$file);
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
Class to manage Dolibarr users.
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_is_dir($folder)
Test if filename is a directory.
dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=1)
Move a file into another name.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
dol_is_file($pathoffile)
Return if path is a file.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)