Version 15.70.7

This commit is contained in:
Antonio Cañas Vargas 2015-12-21 14:43:52 +01:00
parent 2db2810842
commit ac3be0464d
4 changed files with 71 additions and 63 deletions

View File

@ -118,12 +118,13 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.70.6 (2015/12/21)" #define Log_PLATFORM_VERSION "SWAD 15.70.7 (2015/12/21)"
#define CSS_FILE "swad15.65.1.css" #define CSS_FILE "swad15.65.1.css"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.70.7: Dec 21, 2015 Code refactoring in file browser. (187614 lines)
Version 15.70.6: Dec 21, 2015 Removing old files in briefcase. Not finished. (187604 lines) Version 15.70.6: Dec 21, 2015 Removing old files in briefcase. Not finished. (187604 lines)
2 changes necessary in database: 2 changes necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1488','es','N','Solicitar eliminar archivos antiguos maletín'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1488','es','N','Solicitar eliminar archivos antiguos maletín');

View File

@ -11428,9 +11428,9 @@ static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path,
else if (S_ISREG (FileStatus.st_mode) && // It's a regular file else if (S_ISREG (FileStatus.st_mode) && // It's a regular file
FileStatus.st_mtime < TimeRemoveFilesOlder) // ..and it's old FileStatus.st_mtime < TimeRemoveFilesOlder) // ..and it's old
{ {
/* Remove file */ /* Remove file / link */
// if (unlink (PathFileRel)) if (unlink (PathFileRel))
// Lay_ShowErrorAndExit ("Can not remove file / link."); Lay_ShowErrorAndExit ("Can not remove file / link.");
if (Str_FileIs (PathFileRel,"url")) if (Str_FileIs (PathFileRel,"url"))
(Removed->NumLinks)++; // It's a link (URL inside a .url file) (Removed->NumLinks)++; // It's a link (URL inside a .url file)
@ -11447,8 +11447,8 @@ static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path,
if (Level > 1) if (Level > 1)
{ {
/* Count number of files in folder */ /* Count number of files in folder */
NumFiles = scandir (Path,&FileList,NULL,alphasort); if ((NumFiles = scandir (Path,&FileList,NULL,alphasort)) >= 0) // No error
{
/* Free list of files */ /* Free list of files */
for (NumFile = 0; for (NumFile = 0;
NumFile < NumFiles; NumFile < NumFiles;
@ -11456,6 +11456,9 @@ static void Brw_ScanDirRemovingOlfFiles (unsigned Level,const char *Path,
free ((void *) FileList[NumFile]); free ((void *) FileList[NumFile]);
free ((void *) FileList); free ((void *) FileList);
} }
else
Lay_ShowErrorAndExit ("Error while scanning directory.");
}
} }
if (Level > 1 && NumFiles <= 2) // It's an empty folder inside root folder if (Level > 1 && NumFiles <= 2) // It's an empty folder inside root folder

View File

@ -91,7 +91,7 @@ cp -f /home/acanas/swad/swad/swad /var/www/cgi-bin/
/*****************************************************************************/ /*****************************************************************************/
// In Eclipse, add to include path /usr/include, /usr/local/include, /usr/include/i386-linux-gnu // In Eclipse, add to include path /usr/include, /usr/local/include, /usr/include/i386-linux-gnu
#include <dirent.h> // For dirent #include <dirent.h> // For scandir, etc.
#include <linux/limits.h> // For PATH_MAX #include <linux/limits.h> // For PATH_MAX
#include <linux/stddef.h> // For NULL #include <linux/stddef.h> // For NULL
#include <locale.h> // For setlocale, LC_NUMERIC... #include <locale.h> // For setlocale, LC_NUMERIC...

View File

@ -470,9 +470,9 @@ static void ZIP_CompressFolderIntoZIP (void)
static unsigned long long ZIP_CloneDir (const char *Path,const char *PathClone,const char *PathInTree) static unsigned long long ZIP_CloneDir (const char *Path,const char *PathClone,const char *PathInTree)
{ {
struct dirent **DirFileList; struct dirent **FileList;
int NumFileInThisDir; int NumFile;
int NumFilesInThisDir; int NumFiles;
char PathFile[PATH_MAX+1]; char PathFile[PATH_MAX+1];
char PathFileClone[PATH_MAX+1]; char PathFileClone[PATH_MAX+1];
char PathFileInTree[PATH_MAX+1]; char PathFileInTree[PATH_MAX+1];
@ -489,26 +489,27 @@ static unsigned long long ZIP_CloneDir (const char *Path,const char *PathClone,c
unsigned long long FullSize = 0; unsigned long long FullSize = 0;
/***** Scan directory *****/ /***** Scan directory *****/
NumFilesInThisDir = scandir (Path,&DirFileList,NULL,alphasort); if ((NumFiles = scandir (Path,&FileList,NULL,alphasort)) >= 0) // No error
/***** List files *****/
for (NumFileInThisDir = 0;
NumFileInThisDir < NumFilesInThisDir;
NumFileInThisDir++)
if (strcmp (DirFileList[NumFileInThisDir]->d_name,".") &&
strcmp (DirFileList[NumFileInThisDir]->d_name,"..")) // Skip directories "." and ".."
{ {
sprintf (PathFileInTree,"%s/%s",PathInTree,DirFileList[NumFileInThisDir]->d_name); /***** List files *****/
for (NumFile = 0;
NumFile < NumFiles;
NumFile++)
if (strcmp (FileList[NumFile]->d_name,".") &&
strcmp (FileList[NumFile]->d_name,"..")) // Skip directories "." and ".."
{
sprintf (PathFileInTree,"%s/%s",
PathInTree,FileList[NumFile]->d_name);
sprintf (PathFile,"%s/%s", sprintf (PathFile,"%s/%s",
Path,DirFileList[NumFileInThisDir]->d_name); Path,FileList[NumFile]->d_name);
sprintf (PathFileClone,"%s/%s", sprintf (PathFileClone,"%s/%s",
PathClone,DirFileList[NumFileInThisDir]->d_name); PathClone,FileList[NumFile]->d_name);
lstat (PathFile,&FileStatus); lstat (PathFile,&FileStatus);
if (S_ISDIR (FileStatus.st_mode)) // It's a directory if (S_ISDIR (FileStatus.st_mode)) // It's a directory
FileType = Brw_IS_FOLDER; FileType = Brw_IS_FOLDER;
else if (S_ISREG (FileStatus.st_mode)) // It's a regular file else if (S_ISREG (FileStatus.st_mode)) // It's a regular file
FileType = Str_FileIs (DirFileList[NumFileInThisDir]->d_name,"url") ? Brw_IS_LINK : // It's a link (URL inside a .url file) FileType = Str_FileIs (FileList[NumFile]->d_name,"url") ? Brw_IS_LINK : // It's a link (URL inside a .url file)
Brw_IS_FILE; // It's a file Brw_IS_FILE; // It's a file
else else
FileType = Brw_IS_UNKNOWN; FileType = Brw_IS_UNKNOWN;
@ -543,6 +544,9 @@ static unsigned long long ZIP_CloneDir (const char *Path,const char *PathClone,c
} }
} }
} }
}
else
Lay_ShowErrorAndExit ("Error while scanning directory.");
return FullSize; return FullSize;
} }