mirror of https://github.com/acanas/swad-core.git
Version 15.70.7
This commit is contained in:
parent
2db2810842
commit
ac3be0464d
|
@ -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');
|
||||||
|
|
|
@ -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,14 +11447,17 @@ 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;
|
||||||
NumFile++)
|
NumFile++)
|
||||||
free ((void *) FileList[NumFile]);
|
free ((void *) FileList[NumFile]);
|
||||||
free ((void *) FileList);
|
free ((void *) FileList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Lay_ShowErrorAndExit ("Error while scanning directory.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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...
|
||||||
|
|
104
swad_zip.c
104
swad_zip.c
|
@ -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,60 +489,64 @@ 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 (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",
|
||||||
|
Path,FileList[NumFile]->d_name);
|
||||||
|
sprintf (PathFileClone,"%s/%s",
|
||||||
|
PathClone,FileList[NumFile]->d_name);
|
||||||
|
|
||||||
/***** List files *****/
|
lstat (PathFile,&FileStatus);
|
||||||
for (NumFileInThisDir = 0;
|
if (S_ISDIR (FileStatus.st_mode)) // It's a directory
|
||||||
NumFileInThisDir < NumFilesInThisDir;
|
FileType = Brw_IS_FOLDER;
|
||||||
NumFileInThisDir++)
|
else if (S_ISREG (FileStatus.st_mode)) // It's a regular file
|
||||||
if (strcmp (DirFileList[NumFileInThisDir]->d_name,".") &&
|
FileType = Str_FileIs (FileList[NumFile]->d_name,"url") ? Brw_IS_LINK : // It's a link (URL inside a .url file)
|
||||||
strcmp (DirFileList[NumFileInThisDir]->d_name,"..")) // Skip directories "." and ".."
|
Brw_IS_FILE; // It's a file
|
||||||
{
|
else
|
||||||
sprintf (PathFileInTree,"%s/%s",PathInTree,DirFileList[NumFileInThisDir]->d_name);
|
FileType = Brw_IS_UNKNOWN;
|
||||||
sprintf (PathFile,"%s/%s",
|
|
||||||
Path,DirFileList[NumFileInThisDir]->d_name);
|
|
||||||
sprintf (PathFileClone,"%s/%s",
|
|
||||||
PathClone,DirFileList[NumFileInThisDir]->d_name);
|
|
||||||
|
|
||||||
lstat (PathFile,&FileStatus);
|
Hidden = (SeeDocsZone || SeeMarks) ? Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (FileType,PathFileInTree) :
|
||||||
if (S_ISDIR (FileStatus.st_mode)) // It's a directory
|
false;
|
||||||
FileType = Brw_IS_FOLDER;
|
|
||||||
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)
|
|
||||||
Brw_IS_FILE; // It's a file
|
|
||||||
else
|
|
||||||
FileType = Brw_IS_UNKNOWN;
|
|
||||||
|
|
||||||
Hidden = (SeeDocsZone || SeeMarks) ? Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (FileType,PathFileInTree) :
|
if (!Hidden) // If file/folder is not hidden
|
||||||
false;
|
|
||||||
|
|
||||||
if (!Hidden) // If file/folder is not hidden
|
|
||||||
{
|
|
||||||
if (FileType == Brw_IS_FOLDER) // It's a directory
|
|
||||||
{
|
{
|
||||||
FullSize += (unsigned long long) FileStatus.st_size;
|
if (FileType == Brw_IS_FOLDER) // It's a directory
|
||||||
|
{
|
||||||
|
FullSize += (unsigned long long) FileStatus.st_size;
|
||||||
|
|
||||||
/***** Create clone of subdirectory *****/
|
/***** Create clone of subdirectory *****/
|
||||||
if (mkdir (PathFileClone,(mode_t) 0xFFF))
|
if (mkdir (PathFileClone,(mode_t) 0xFFF))
|
||||||
Lay_ShowErrorAndExit ("Can not create temporary subfolder for compression.");
|
Lay_ShowErrorAndExit ("Can not create temporary subfolder for compression.");
|
||||||
|
|
||||||
/***** Clone subtree starting at this this directory *****/
|
/***** Clone subtree starting at this this directory *****/
|
||||||
FullSize += ZIP_CloneDir (PathFile,PathFileClone,PathFileInTree);
|
FullSize += ZIP_CloneDir (PathFile,PathFileClone,PathFileInTree);
|
||||||
|
}
|
||||||
|
else if (FileType == Brw_IS_FILE ||
|
||||||
|
FileType == Brw_IS_LINK) // It's a regular file
|
||||||
|
{
|
||||||
|
FullSize += (unsigned long long) FileStatus.st_size;
|
||||||
|
|
||||||
|
/***** Create a symbolic link (clone) to original file *****/
|
||||||
|
if (symlink (PathFile,PathFileClone) != 0)
|
||||||
|
Lay_ShowErrorAndExit ("Can not create temporary link for compression.");
|
||||||
|
|
||||||
|
/***** Update number of my views of this file *****/
|
||||||
|
Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (FileType == Brw_IS_FILE ||
|
}
|
||||||
FileType == Brw_IS_LINK) // It's a regular file
|
}
|
||||||
{
|
else
|
||||||
FullSize += (unsigned long long) FileStatus.st_size;
|
Lay_ShowErrorAndExit ("Error while scanning directory.");
|
||||||
|
|
||||||
/***** Create a symbolic link (clone) to original file *****/
|
|
||||||
if (symlink (PathFile,PathFileClone) != 0)
|
|
||||||
Lay_ShowErrorAndExit ("Can not create temporary link for compression.");
|
|
||||||
|
|
||||||
/***** Update number of my views of this file *****/
|
|
||||||
Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FullSize;
|
return FullSize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue