Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 05:14 am EDT

Staticpage to Access error.log

  • Wednesday, January 18 2006 @ 11:06 am EST
  • Contributed by:
  • Views: 11,040
Geeklog I've often needed access to my error.log from a machine that did not have an SSH client installed. I created this little hack that can live within a static page:
  1. Go to the staticpage admin screen and hit the "Create New" button.
  2. In the PHP drop-down be sure to select "execute PHP"
  3. For the group down-down, be sure to select "Root" and be sure to uncheck teh Read flag for Members and Anonymous (NOTE: this is important for security)
  4. In the "content" textarea add the following:
    global $_CONF;
    require_once $_CONF['path_system'] . 'classes/downloader.class.php';
    $dMgr = new downloader();
    $dMgr->setPath($_CONF['path_log']);
    $dMgr->_setAvailableExtensions(array('log' => 'text/plain'));
    $dMgr->setAllowedExtensions(array('log' => 'text/plain'));
    $dMgr->downloadFile('error.log');
    if ($dMgr->areErrors()) {
        $dMgr->printErrors();
    }
    
  5. Save the page

That's it. Simple, elegant and as secure as Geeklog is.