added: mount points
(reading /etc/fstab from db not working yet)
core/mount.h
core/mountparser.h
core/mountparser.cpp
core/mounts.h
core/mounts.cpp
content/thread.cpp
content/createthread.cpp
templates/thread.cpp
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@495 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
81
core/mounts.cpp
Executable file
81
core/mounts.cpp
Executable file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2009, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mounts.h"
|
||||
#include "data.h"
|
||||
|
||||
|
||||
void Mounts::ReadMounts()
|
||||
{
|
||||
MountParser mp;
|
||||
|
||||
// !! tymczasowo - bedzie odczyt z bazy z /etc/fstab
|
||||
std::string temp = "thread /forum";
|
||||
|
||||
Error err = mp.Parse(temp, mount_table);
|
||||
|
||||
if( err != Error::ok )
|
||||
{
|
||||
log << log1 << "M: some problems with mountpoints (mountpoints table will be empty)" << logend;
|
||||
mount_table.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Mount Mounts::GetCurrentMountPoint()
|
||||
{
|
||||
return current_dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Mounts::MountCmsForRoot()
|
||||
{
|
||||
current_dir.type = Mount::cms;
|
||||
|
||||
Item * proot = data.dirs.GetRootDir();
|
||||
|
||||
if( proot )
|
||||
current_dir.dir_id = proot->id;
|
||||
else
|
||||
{
|
||||
current_dir.dir_id = -1;
|
||||
log << log1 << "M: there is no a root dir" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Mounts::CalculateCurrentMountType()
|
||||
{
|
||||
std::vector<Item*>::reverse_iterator i;
|
||||
|
||||
|
||||
for(i = request.dir_table.rbegin() ; i!=request.dir_table.rend() ; ++i)
|
||||
{
|
||||
std::map<long, Mount>::iterator m = mount_table.find( (*i)->id );
|
||||
|
||||
if( m != mount_table.end() )
|
||||
{
|
||||
current_dir = m->second;
|
||||
log << log2 << "M: current mount point is: " << current_dir.TypeToStr() << logend;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we assume that 'cms' mount point is used
|
||||
MountCmsForRoot();
|
||||
log << log2 << "M: current mount point is: cms (default)" << logend;
|
||||
}
|
||||
Reference in New Issue
Block a user