~ubuntu-branches/debian/jessie/suphp/jessie

« back to all changes in this revision

Viewing changes to src/File.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Lacour
  • Date: 2009-08-03 15:15:38 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090803151538-431r96du70316dpk
Tags: 0.7.1-1
* New upstream release (closes: #528379, #520182) 
* debian/NEWS: add information about AddHandler -> AddType change introduced
  in 0.6.2-2 (closes: #517805)
* debian/conf/suphp.conf, debian/patches/01_debian.dpatch: switch from
  application/x-httpd-php to application/x-httpd-suphp to allow
  simultaneous use of mod_suphp and mod_php (closes: #519005, #514725)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
    suPHP - (c)2002-2005 Sebastian Marsching <sebastian@marsching.com>
 
2
    suPHP - (c)2002-2008 Sebastian Marsching <sebastian@marsching.com>
3
3
 
4
4
    This file is part of suPHP.
5
5
 
36
36
    return this->path;
37
37
}
38
38
 
39
 
SmartPtr<std::ifstream> suPHP::File::getInputStream() throw (IOException) {
 
39
SmartPtr<std::ifstream> suPHP::File::getInputStream() const throw (IOException) {
40
40
    std::ifstream* infile = new std::ifstream();
41
41
    infile->open(this->path.c_str());
42
42
    if (infile->bad() || infile->fail()) {
43
 
        throw IOException("Could not open file " + 
44
 
                          this->path + " for reading", __FILE__, __LINE__);
 
43
        throw IOException("Could not open file " + 
 
44
                          this->path + " for reading", __FILE__, __LINE__);
45
45
    }
46
46
    return SmartPtr<std::ifstream>(infile);
47
47
}
57
57
File suPHP::File::getParentDirectory() const {
58
58
    std::string path = this->getPath();
59
59
    path = path.substr(0, path.rfind('/'));
 
60
    if (path.length() == 0) {
 
61
        path = "/";
 
62
    }
60
63
    return File(path);
61
64
}
62
65
 
104
107
GroupInfo suPHP::File::getGroup() const throw (SystemException) {
105
108
    return API_Helper::getSystemAPI().File_getGroup(*this);
106
109
}
 
110
 
 
111
 
 
112
bool suPHP::File::isSymlink() const throw (SystemException) {
 
113
    return API_Helper::getSystemAPI().File_isSymlink(*this);
 
114
}