mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-18 06:25:42 +02:00
Version 20.51.35: Mar 24, 2021 Files database tables renamed.
This commit is contained in:
parent
2e7338e096
commit
34224017d2
32
sql/swad.sql
32
sql/swad.sql
|
@ -149,6 +149,14 @@ CREATE TABLE IF NOT EXISTS bld_buildings (
|
||||||
UNIQUE INDEX(BldCod),
|
UNIQUE INDEX(BldCod),
|
||||||
INDEX(CtrCod));
|
INDEX(CtrCod));
|
||||||
--
|
--
|
||||||
|
-- Table brw_caches: stores the media private paths linked from public directories in current session
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS brw_caches (
|
||||||
|
SessionId CHAR(43) NOT NULL,
|
||||||
|
PrivPath TEXT COLLATE latin1_bin NOT NULL,
|
||||||
|
TmpPubDir TEXT COLLATE latin1_bin NOT NULL,
|
||||||
|
INDEX(SessionId));
|
||||||
|
--
|
||||||
-- Table brw_clipboards: clipboard (paths used to copy-paste folders and files)
|
-- Table brw_clipboards: clipboard (paths used to copy-paste folders and files)
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS brw_clipboards (
|
CREATE TABLE IF NOT EXISTS brw_clipboards (
|
||||||
|
@ -176,22 +184,6 @@ CREATE TABLE IF NOT EXISTS brw_expanded (
|
||||||
INDEX(FileBrowser,Cod),
|
INDEX(FileBrowser,Cod),
|
||||||
INDEX(WorksUsrCod));
|
INDEX(WorksUsrCod));
|
||||||
--
|
--
|
||||||
-- Table brw_file_caches: stores the media private paths linked from public directories in current session
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS brw_file_caches (
|
|
||||||
SessionId CHAR(43) NOT NULL,
|
|
||||||
PrivPath TEXT COLLATE latin1_bin NOT NULL,
|
|
||||||
TmpPubDir TEXT COLLATE latin1_bin NOT NULL,
|
|
||||||
INDEX(SessionId));
|
|
||||||
--
|
|
||||||
-- Table brw_file_views: stores the number of times each user has seen each file
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS brw_file_views (
|
|
||||||
FilCod INT NOT NULL,
|
|
||||||
UsrCod INT NOT NULL,
|
|
||||||
NumViews INT NOT NULL DEFAULT 0,
|
|
||||||
UNIQUE INDEX(FilCod,UsrCod),INDEX(UsrCod));
|
|
||||||
--
|
|
||||||
-- Table brw_files: stores metadata about each file
|
-- Table brw_files: stores metadata about each file
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS brw_files (
|
CREATE TABLE IF NOT EXISTS brw_files (
|
||||||
|
@ -232,6 +224,14 @@ CREATE TABLE IF NOT EXISTS brw_sizes (
|
||||||
UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),
|
UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),
|
||||||
INDEX(ZoneUsrCod));
|
INDEX(ZoneUsrCod));
|
||||||
--
|
--
|
||||||
|
-- Table brw_views: stores the number of times each user has seen each file
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS brw_views (
|
||||||
|
FilCod INT NOT NULL,
|
||||||
|
UsrCod INT NOT NULL,
|
||||||
|
NumViews INT NOT NULL DEFAULT 0,
|
||||||
|
UNIQUE INDEX(FilCod,UsrCod),INDEX(UsrCod));
|
||||||
|
--
|
||||||
-- Table cfe_calls_for_exams: stores the calls for examination
|
-- Table cfe_calls_for_exams: stores the calls for examination
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS cfe_calls_for_exams (
|
CREATE TABLE IF NOT EXISTS cfe_calls_for_exams (
|
||||||
|
|
|
@ -607,6 +607,11 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 20.51.35: Mar 24, 2021 Files database tables renamed. (308634 lines)
|
||||||
|
2 changes necessary in database:
|
||||||
|
RENAME TABLE brw_file_caches TO brw_caches;
|
||||||
|
RENAME TABLE brw_file_views TO brw_views;
|
||||||
|
|
||||||
Version 20.51.35: Mar 24, 2021 Expanded folders database table renamed. (308630 lines)
|
Version 20.51.35: Mar 24, 2021 Expanded folders database table renamed. (308630 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
RENAME TABLE brw_expanded_folders TO brw_expanded;
|
RENAME TABLE brw_expanded_folders TO brw_expanded;
|
||||||
|
|
|
@ -381,6 +381,24 @@ mysql> DESCRIBE bld_buildings;
|
||||||
"UNIQUE INDEX(BldCod),"
|
"UNIQUE INDEX(BldCod),"
|
||||||
"INDEX(CtrCod))");
|
"INDEX(CtrCod))");
|
||||||
|
|
||||||
|
/***** Table brw_caches *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE brw_caches;
|
||||||
|
+-----------+----------+------+-----+---------+-------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+-----------+----------+------+-----+---------+-------+
|
||||||
|
| SessionId | char(43) | NO | MUL | NULL | |
|
||||||
|
| PrivPath | text | NO | | NULL | |
|
||||||
|
| TmpPubDir | text | NO | | NULL | |
|
||||||
|
+-----------+----------+------+-----+---------+-------+
|
||||||
|
3 rows in set (0.01 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS brw_caches ("
|
||||||
|
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
||||||
|
"PrivPath VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX
|
||||||
|
"TmpPubDir VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX
|
||||||
|
"UNIQUE INDEX(SessionId))");
|
||||||
|
|
||||||
/***** Table brw_clipboards *****/
|
/***** Table brw_clipboards *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE brw_clipboards;
|
mysql> DESCRIBE brw_clipboards;
|
||||||
|
@ -435,43 +453,6 @@ mysql> DESCRIBE brw_expanded;
|
||||||
"INDEX(FileBrowser,Cod),"
|
"INDEX(FileBrowser,Cod),"
|
||||||
"INDEX(WorksUsrCod))");
|
"INDEX(WorksUsrCod))");
|
||||||
|
|
||||||
/***** Table brw_file_caches *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE brw_file_caches;
|
|
||||||
+-----------+----------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+-----------+----------+------+-----+---------+-------+
|
|
||||||
| SessionId | char(43) | NO | MUL | NULL | |
|
|
||||||
| PrivPath | text | NO | | NULL | |
|
|
||||||
| TmpPubDir | text | NO | | NULL | |
|
|
||||||
+-----------+----------+------+-----+---------+-------+
|
|
||||||
3 rows in set (0.01 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS brw_file_caches ("
|
|
||||||
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
|
||||||
"PrivPath VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX
|
|
||||||
"TmpPubDir VARCHAR(4096) COLLATE latin1_bin NOT NULL," // PATH_MAX
|
|
||||||
"UNIQUE INDEX(SessionId))");
|
|
||||||
|
|
||||||
/***** Table brw_file_views *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE brw_file_views;
|
|
||||||
+----------+---------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+----------+---------+------+-----+---------+-------+
|
|
||||||
| FilCod | int(11) | NO | PRI | NULL | |
|
|
||||||
| UsrCod | int(11) | NO | PRI | NULL | |
|
|
||||||
| NumViews | int(11) | NO | | 0 | |
|
|
||||||
+----------+---------+------+-----+---------+-------+
|
|
||||||
3 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS brw_file_views ("
|
|
||||||
"FilCod INT NOT NULL,"
|
|
||||||
"UsrCod INT NOT NULL,"
|
|
||||||
"NumViews INT NOT NULL DEFAULT 0,"
|
|
||||||
"UNIQUE INDEX(FilCod,UsrCod),"
|
|
||||||
"INDEX(UsrCod))");
|
|
||||||
|
|
||||||
/***** Table brw_files *****/
|
/***** Table brw_files *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE brw_files;
|
mysql> DESCRIBE brw_files;
|
||||||
|
@ -554,6 +535,25 @@ mysql> DESCRIBE brw_sizes;
|
||||||
"UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
"UNIQUE INDEX(FileBrowser,Cod,ZoneUsrCod),"
|
||||||
"INDEX(ZoneUsrCod))");
|
"INDEX(ZoneUsrCod))");
|
||||||
|
|
||||||
|
/***** Table brw_views *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE brw_views;
|
||||||
|
+----------+---------+------+-----+---------+-------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+----------+---------+------+-----+---------+-------+
|
||||||
|
| FilCod | int(11) | NO | PRI | NULL | |
|
||||||
|
| UsrCod | int(11) | NO | PRI | NULL | |
|
||||||
|
| NumViews | int(11) | NO | | 0 | |
|
||||||
|
+----------+---------+------+-----+---------+-------+
|
||||||
|
3 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS brw_views ("
|
||||||
|
"FilCod INT NOT NULL,"
|
||||||
|
"UsrCod INT NOT NULL,"
|
||||||
|
"NumViews INT NOT NULL DEFAULT 0,"
|
||||||
|
"UNIQUE INDEX(FilCod,UsrCod),"
|
||||||
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table cfe_calls_for_exams *****/
|
/***** Table cfe_calls_for_exams *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE cfe_calls_for_exams;
|
mysql> DESCRIBE cfe_calls_for_exams;
|
||||||
|
|
|
@ -4177,12 +4177,12 @@ void Brw_RemoveInsFilesFromDB (long InsCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views to files of an institution",
|
DB_QueryDELETE ("can not remove file views to files of an institution",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_INS,
|
(unsigned) Brw_ADMI_DOC_INS,
|
||||||
(unsigned) Brw_ADMI_SHR_INS,
|
(unsigned) Brw_ADMI_SHR_INS,
|
||||||
InsCod);
|
InsCod);
|
||||||
|
@ -4245,12 +4245,12 @@ void Brw_RemoveCtrFilesFromDB (long CtrCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views to files of a center",
|
DB_QueryDELETE ("can not remove file views to files of a center",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_CTR,
|
(unsigned) Brw_ADMI_DOC_CTR,
|
||||||
(unsigned) Brw_ADMI_SHR_CTR,
|
(unsigned) Brw_ADMI_SHR_CTR,
|
||||||
CtrCod);
|
CtrCod);
|
||||||
|
@ -4309,12 +4309,12 @@ void Brw_RemoveDegFilesFromDB (long DegCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views to files of a degree",
|
DB_QueryDELETE ("can not remove file views to files of a degree",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_DEG,
|
(unsigned) Brw_ADMI_DOC_DEG,
|
||||||
(unsigned) Brw_ADMI_SHR_DEG,
|
(unsigned) Brw_ADMI_SHR_DEG,
|
||||||
DegCod);
|
DegCod);
|
||||||
|
@ -4407,12 +4407,12 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
/* Remove from course file zones */
|
/* Remove from course file zones */
|
||||||
DB_QueryDELETE ("can not remove file views to files of a course",
|
DB_QueryDELETE ("can not remove file views to files of a course",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u,%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u,%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_CRS,
|
(unsigned) Brw_ADMI_DOC_CRS,
|
||||||
(unsigned) Brw_ADMI_TCH_CRS,
|
(unsigned) Brw_ADMI_TCH_CRS,
|
||||||
(unsigned) Brw_ADMI_SHR_CRS,
|
(unsigned) Brw_ADMI_SHR_CRS,
|
||||||
|
@ -4423,12 +4423,12 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
||||||
|
|
||||||
/* Remove from group file zones */
|
/* Remove from group file zones */
|
||||||
DB_QueryDELETE ("can not remove file views to files of a course",
|
DB_QueryDELETE ("can not remove file views to files of a course",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND brw_files.Cod IN %s"
|
" AND brw_files.Cod IN %s"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_GRP,
|
(unsigned) Brw_ADMI_DOC_GRP,
|
||||||
(unsigned) Brw_ADMI_TCH_GRP,
|
(unsigned) Brw_ADMI_TCH_GRP,
|
||||||
(unsigned) Brw_ADMI_SHR_GRP,
|
(unsigned) Brw_ADMI_SHR_GRP,
|
||||||
|
@ -4437,12 +4437,12 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod)
|
||||||
|
|
||||||
/* Remove from project file zones */
|
/* Remove from project file zones */
|
||||||
DB_QueryDELETE ("can not remove file views to files of a course",
|
DB_QueryDELETE ("can not remove file views to files of a course",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod IN %s"
|
" AND brw_files.Cod IN %s"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||||
(unsigned) Brw_ADMI_ASS_PRJ,
|
(unsigned) Brw_ADMI_ASS_PRJ,
|
||||||
SubqueryPrj);
|
SubqueryPrj);
|
||||||
|
@ -4643,12 +4643,12 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod)
|
||||||
|
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views to files of a group",
|
DB_QueryDELETE ("can not remove file views to files of a group",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_GRP,
|
(unsigned) Brw_ADMI_DOC_GRP,
|
||||||
(unsigned) Brw_ADMI_TCH_GRP,
|
(unsigned) Brw_ADMI_TCH_GRP,
|
||||||
(unsigned) Brw_ADMI_SHR_GRP,
|
(unsigned) Brw_ADMI_SHR_GRP,
|
||||||
|
@ -4719,12 +4719,12 @@ void Brw_RemovePrjFilesFromDB (long PrjCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views to files of a project",
|
DB_QueryDELETE ("can not remove file views to files of a project",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_DOC_PRJ,
|
(unsigned) Brw_ADMI_DOC_PRJ,
|
||||||
(unsigned) Brw_ADMI_ASS_PRJ,
|
(unsigned) Brw_ADMI_ASS_PRJ,
|
||||||
PrjCod);
|
PrjCod);
|
||||||
|
@ -4886,13 +4886,13 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views",
|
DB_QueryDELETE ("can not remove file views",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
" WHERE brw_files.FileBrowser IN (%u,%u)"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.ZoneUsrCod=%ld"
|
" AND brw_files.ZoneUsrCod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) Brw_ADMI_ASG_USR,
|
(unsigned) Brw_ADMI_ASG_USR,
|
||||||
(unsigned) Brw_ADMI_WRK_USR,
|
(unsigned) Brw_ADMI_WRK_USR,
|
||||||
CrsCod,UsrCod);
|
CrsCod,UsrCod);
|
||||||
|
@ -4945,14 +4945,14 @@ void Brw_RemoveWrkFilesFromDB (long CrsCod,long UsrCod)
|
||||||
void Brw_RemoveUsrFilesFromDB (long UsrCod)
|
void Brw_RemoveUsrFilesFromDB (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
// User is not removed from brw_file_views table,
|
// User is not removed from brw_views table,
|
||||||
// in order to take into account his/her views
|
// in order to take into account his/her views
|
||||||
DB_QueryDELETE ("can not remove file views to files of a user",
|
DB_QueryDELETE ("can not remove file views to files of a user",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.ZoneUsrCod=%ld"
|
" WHERE brw_files.ZoneUsrCod=%ld"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
|
||||||
/***** Remove from database expanded folders *****/
|
/***** Remove from database expanded folders *****/
|
||||||
|
@ -10784,7 +10784,7 @@ unsigned long Brw_GetNumFileViewsUsr (long UsrCod)
|
||||||
/***** Get number of filw views *****/
|
/***** Get number of filw views *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get number of file views",
|
if (DB_QuerySELECT (&mysql_res,"can not get number of file views",
|
||||||
"SELECT SUM(NumViews)" // row[0]
|
"SELECT SUM(NumViews)" // row[0]
|
||||||
" FROM brw_file_views"
|
" FROM brw_views"
|
||||||
" WHERE UsrCod=%ld",
|
" WHERE UsrCod=%ld",
|
||||||
UsrCod))
|
UsrCod))
|
||||||
{
|
{
|
||||||
|
@ -10825,7 +10825,7 @@ static void Brw_GetFileViewsFromLoggedUsrs (struct FileMetadata *FileMetadata)
|
||||||
" from logged users",
|
" from logged users",
|
||||||
"SELECT COUNT(DISTINCT UsrCod)," // row[0]
|
"SELECT COUNT(DISTINCT UsrCod)," // row[0]
|
||||||
"SUM(NumViews)" // row[1]
|
"SUM(NumViews)" // row[1]
|
||||||
" FROM brw_file_views"
|
" FROM brw_views"
|
||||||
" WHERE FilCod=%ld"
|
" WHERE FilCod=%ld"
|
||||||
" AND UsrCod>0",
|
" AND UsrCod>0",
|
||||||
FileMetadata->FilCod))
|
FileMetadata->FilCod))
|
||||||
|
@ -10868,7 +10868,7 @@ static void Brw_GetFileViewsFromNonLoggedUsrs (struct FileMetadata *FileMetadata
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get number of public views"
|
if (DB_QuerySELECT (&mysql_res,"can not get number of public views"
|
||||||
" of a file",
|
" of a file",
|
||||||
"SELECT SUM(NumViews)" // row[0]
|
"SELECT SUM(NumViews)" // row[0]
|
||||||
" FROM brw_file_views"
|
" FROM brw_views"
|
||||||
" WHERE FilCod=%ld"
|
" WHERE FilCod=%ld"
|
||||||
" AND UsrCod<=0",
|
" AND UsrCod<=0",
|
||||||
FileMetadata->FilCod))
|
FileMetadata->FilCod))
|
||||||
|
@ -10903,7 +10903,7 @@ static unsigned Brw_GetFileViewsFromMe (long FilCod)
|
||||||
/***** Get number of my views *****/
|
/***** Get number of my views *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get your number of views of a file",
|
if (DB_QuerySELECT (&mysql_res,"can not get your number of views of a file",
|
||||||
"SELECT NumViews" // row[0]
|
"SELECT NumViews" // row[0]
|
||||||
" FROM brw_file_views"
|
" FROM brw_views"
|
||||||
" WHERE FilCod=%ld"
|
" WHERE FilCod=%ld"
|
||||||
" AND UsrCod=%ld",
|
" AND UsrCod=%ld",
|
||||||
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
|
@ -10931,7 +10931,7 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
||||||
if (NumViews)
|
if (NumViews)
|
||||||
/* Update number of views in database */
|
/* Update number of views in database */
|
||||||
DB_QueryUPDATE ("can not update number of views of a file",
|
DB_QueryUPDATE ("can not update number of views of a file",
|
||||||
"UPDATE brw_file_views"
|
"UPDATE brw_views"
|
||||||
" SET NumViews=NumViews+1"
|
" SET NumViews=NumViews+1"
|
||||||
" WHERE FilCod=%ld"
|
" WHERE FilCod=%ld"
|
||||||
" AND UsrCod=%ld",
|
" AND UsrCod=%ld",
|
||||||
|
@ -10939,7 +10939,7 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
|
||||||
else // NumViews == 0
|
else // NumViews == 0
|
||||||
/* Insert number of views in database */
|
/* Insert number of views in database */
|
||||||
DB_QueryINSERT ("can not insert number of views of a file",
|
DB_QueryINSERT ("can not insert number of views of a file",
|
||||||
"INSERT INTO brw_file_views"
|
"INSERT INTO brw_views"
|
||||||
" (FilCod,UsrCod,NumViews)"
|
" (FilCod,UsrCod,NumViews)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,1)",
|
" (%ld,%ld,1)",
|
||||||
|
@ -11281,14 +11281,14 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1])
|
||||||
|
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views from database",
|
DB_QueryDELETE ("can not remove file views from database",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser=%u"
|
" WHERE brw_files.FileBrowser=%u"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.ZoneUsrCod=%ld"
|
" AND brw_files.ZoneUsrCod=%ld"
|
||||||
" AND brw_files.Path='%s'"
|
" AND brw_files.Path='%s'"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||||
|
|
||||||
/***** Remove from database the entry that stores the data of a file *****/
|
/***** Remove from database the entry that stores the data of a file *****/
|
||||||
|
@ -11334,14 +11334,14 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1])
|
||||||
|
|
||||||
/***** Remove from database the entries that store the file views *****/
|
/***** Remove from database the entries that store the file views *****/
|
||||||
DB_QueryDELETE ("can not remove file views from database",
|
DB_QueryDELETE ("can not remove file views from database",
|
||||||
"DELETE FROM brw_file_views"
|
"DELETE FROM brw_views"
|
||||||
" USING brw_files,"
|
" USING brw_files,"
|
||||||
"brw_file_views"
|
"brw_views"
|
||||||
" WHERE brw_files.FileBrowser=%u"
|
" WHERE brw_files.FileBrowser=%u"
|
||||||
" AND brw_files.Cod=%ld"
|
" AND brw_files.Cod=%ld"
|
||||||
" AND brw_files.ZoneUsrCod=%ld"
|
" AND brw_files.ZoneUsrCod=%ld"
|
||||||
" AND brw_files.Path LIKE '%s/%%'"
|
" AND brw_files.Path LIKE '%s/%%'"
|
||||||
" AND brw_files.FilCod=brw_file_views.FilCod",
|
" AND brw_files.FilCod=brw_views.FilCod",
|
||||||
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
(unsigned) FileBrowser,Cod,ZoneUsrCod,Path);
|
||||||
|
|
||||||
/***** Remove from database the entries that store the data of files *****/
|
/***** Remove from database the entries that store the data of files *****/
|
||||||
|
|
|
@ -489,7 +489,7 @@ bool Ses_GetPublicDirFromCache (const char *FullPathMediaPriv,
|
||||||
/***** Get temporary directory from cache *****/
|
/***** Get temporary directory from cache *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get check if file is cached",
|
if (DB_QuerySELECT (&mysql_res,"can not get check if file is cached",
|
||||||
"SELECT TmpPubDir"
|
"SELECT TmpPubDir"
|
||||||
" FROM brw_file_caches"
|
" FROM brw_caches"
|
||||||
" WHERE SessionId='%s'"
|
" WHERE SessionId='%s'"
|
||||||
" AND PrivPath='%s'",
|
" AND PrivPath='%s'",
|
||||||
Gbl.Session.Id,FullPathMediaPriv))
|
Gbl.Session.Id,FullPathMediaPriv))
|
||||||
|
@ -528,7 +528,7 @@ static void Ses_DeletePublicDirFromCache (const char *FullPathMediaPriv)
|
||||||
/***** Delete possible entry *****/
|
/***** Delete possible entry *****/
|
||||||
if (Gbl.Session.IsOpen)
|
if (Gbl.Session.IsOpen)
|
||||||
DB_QueryDELETE ("can not remove cached file",
|
DB_QueryDELETE ("can not remove cached file",
|
||||||
"DELETE FROM brw_file_caches"
|
"DELETE FROM brw_caches"
|
||||||
" WHERE SessionId='%s'"
|
" WHERE SessionId='%s'"
|
||||||
" AND PrivPath='%s'",
|
" AND PrivPath='%s'",
|
||||||
Gbl.Session.Id,FullPathMediaPriv);
|
Gbl.Session.Id,FullPathMediaPriv);
|
||||||
|
@ -549,7 +549,7 @@ void Ses_AddPublicDirToCache (const char *FullPathMediaPriv,
|
||||||
|
|
||||||
/* Insert new entry */
|
/* Insert new entry */
|
||||||
DB_QueryINSERT ("can not cache file",
|
DB_QueryINSERT ("can not cache file",
|
||||||
"INSERT INTO brw_file_caches"
|
"INSERT INTO brw_caches"
|
||||||
" (SessionId,PrivPath,TmpPubDir)"
|
" (SessionId,PrivPath,TmpPubDir)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%s','%s','%s')",
|
" ('%s','%s','%s')",
|
||||||
|
@ -566,7 +566,7 @@ void Ses_RemovePublicDirsCache (void)
|
||||||
/***** Insert into cache *****/
|
/***** Insert into cache *****/
|
||||||
if (Gbl.Session.IsOpen)
|
if (Gbl.Session.IsOpen)
|
||||||
DB_QueryDELETE ("can not cache file",
|
DB_QueryDELETE ("can not cache file",
|
||||||
"DELETE FROM brw_file_caches"
|
"DELETE FROM brw_caches"
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ void Ses_RemovePublicDirsFromExpiredSessions (void)
|
||||||
{
|
{
|
||||||
/***** Remove public directories in expired sessions *****/
|
/***** Remove public directories in expired sessions *****/
|
||||||
DB_QueryDELETE ("can not remove public directories in expired sessions",
|
DB_QueryDELETE ("can not remove public directories in expired sessions",
|
||||||
"DELETE FROM brw_file_caches"
|
"DELETE FROM brw_caches"
|
||||||
" WHERE SessionId NOT IN"
|
" WHERE SessionId NOT IN"
|
||||||
" (SELECT SessionId"
|
" (SELECT SessionId"
|
||||||
" FROM ses_sessions)");
|
" FROM ses_sessions)");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user