mirror of https://github.com/acanas/swad-core.git
Version 17.21.5
This commit is contained in:
parent
790c46c371
commit
09e1de2273
|
@ -256,13 +256,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 17.21.4 (2017-10-08)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 17.21.5 (2017-10-08)"
|
||||
#define CSS_FILE "swad17.0.css"
|
||||
#define JS_FILE "swad17.17.1.js"
|
||||
|
||||
// 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
|
||||
/*
|
||||
Version 17.21.5: Oct 08, 2017 Code refactoring in removal of files from database when removing course. (233317 lines)
|
||||
Version 17.21.4: Oct 08, 2017 Fixed bug: remove group files from database when removing course.
|
||||
Removed project files from database when removing course.
|
||||
Fixed bug in project documents. (233330 lines)
|
||||
|
|
|
@ -4554,8 +4554,20 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
|||
|
||||
void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
||||
{
|
||||
char SubqueryGrp[256];
|
||||
char SubqueryPrj[128];
|
||||
char Query[1024];
|
||||
|
||||
/***** Build subquery for groups *****/
|
||||
sprintf (SubqueryGrp,"(SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
CrsCod);
|
||||
|
||||
/***** Build subquery for projects *****/
|
||||
sprintf (SubqueryPrj,"(SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
CrsCod);
|
||||
|
||||
/***** Remove format of files of marks *****/
|
||||
sprintf (Query,"DELETE FROM marks_properties USING files,marks_properties"
|
||||
" WHERE files.FileBrowser=%u"
|
||||
|
@ -4583,26 +4595,22 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND files.Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)"
|
||||
" AND files.Cod IN %s"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE FROM file_view USING file_view,files"
|
||||
" WHERE files.FileBrowser IN (%u)"
|
||||
" AND files.Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)"
|
||||
" AND files.Cod IN %s"
|
||||
" AND files.FilCod=file_view.FilCod",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove file views to files of a course");
|
||||
|
||||
/***** Remove from database expanded folders *****/
|
||||
|
@ -4624,24 +4632,20 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE LOW_PRIORITY FROM expanded_folders"
|
||||
" WHERE FileBrowser IN (%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove expanded folders of a course");
|
||||
|
||||
/***** Remove from database the entries that store clipboards *****/
|
||||
|
@ -4663,24 +4667,20 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser IN (%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove clipboards related to files of a course");
|
||||
|
||||
/***** Remove from database the entries that store the last time users visited file zones *****/
|
||||
|
@ -4701,24 +4701,20 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE FROM file_browser_last"
|
||||
" WHERE FileBrowser IN (%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove file last visits to files of a course");
|
||||
|
||||
/***** Remove from database the entries that store the sizes of the file zones *****/
|
||||
|
@ -4738,24 +4734,20 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE FROM file_browser_size"
|
||||
" WHERE FileBrowser IN (%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove sizes of file zones of a course");
|
||||
|
||||
/***** Remove from database the entries that store the data files *****/
|
||||
|
@ -4775,24 +4767,20 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
|||
/* Remove from group file zones */
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN (%u,%u,%u,%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT crs_grp.GrpCod FROM crs_grp_types,crs_grp"
|
||||
" WHERE crs_grp_types.CrsCod=%ld"
|
||||
" AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_GRP,
|
||||
(unsigned) Brw_ADMI_TCH_GRP,
|
||||
(unsigned) Brw_ADMI_SHR_GRP,
|
||||
(unsigned) Brw_ADMI_MRK_GRP,
|
||||
CrsCod);
|
||||
SubqueryGrp);
|
||||
DB_QueryDELETE (Query,"can not remove files of a course");
|
||||
|
||||
/* Remove from project file zones */
|
||||
sprintf (Query,"DELETE FROM files"
|
||||
" WHERE FileBrowser IN (%u)"
|
||||
" AND Cod IN"
|
||||
" (SELECT PrjCod FROM projects WHERE CrsCod=%ld)",
|
||||
" AND Cod IN %s",
|
||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||
CrsCod);
|
||||
SubqueryPrj);
|
||||
DB_QueryDELETE (Query,"can not remove files of a course");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue