Beispiel #1
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/../admin/includes/core-minimal.inc.php';
if (Preferences::fileExists() === false) {
    exit(1);
}
//BEGIN Updating logs cache
$servers = Abstract_Server::load_all();
foreach ($servers as $server) {
    $buf = new Server_Logs($server);
    $buf->process();
}
//END Updating logs cache
//BEGIN UserGroupDBDynamic_cached update
if (Preferences::moduleIsEnabled('UserGroupDBDynamicCached')) {
    $ugdbdc = UserGroupDBDynamicCached::getInstance();
    $groups = $ugdbdc->getList();
    if (!is_array($groups)) {
        Logger::error('main', '(hourly cron) UserGroupDBDynamic_cached->getList() failed');
    } else {
        foreach ($groups as $a_group) {
            $ret = $ugdbdc->updateCache($a_group);
            if ($ret !== true) {
                Logger::error('main', '(hourly cron) UserGroupDBDynamic_cached->updateCache for group \'' . $a_group->getUniqueID() . '\' failed');
            }
        }
Beispiel #2
0
function download_log($where_, $name_, $server_ = NULL)
{
    if ($where_ == 'sm') {
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=sessionmanager_' . $name_);
        $filename = SESSIONMANAGER_LOGS . '/main.log';
        $fp = @fopen($filename, 'r');
        if ($fp !== false) {
            while ($str = fgets($fp, 4096)) {
                echo $str;
            }
        }
        @fclose($fp);
    } elseif ($where_ == 'aps') {
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename=slaveserver_' . $server_ . '.log');
        $server = Abstract_Server::load($server_);
        if (!$server) {
            Logger::error('main', '(admin/logs) download_log() - cannot load Server \'' . $server_ . '\'');
            redirect();
        }
        $buf = new Server_Logs($server);
        $buf->process();
        while ($str = $buf->getContent()) {
            echo $str;
        }
    }
    die;
}
Beispiel #3
0
 public function log_download($log_)
 {
     $this->check_authorized('viewStatus');
     $filename = SESSIONMANAGER_LOGS . '/' . $log_ . '.log';
     if (file_exists($filename)) {
         $fp = @fopen($filename, 'r');
         if ($fp === false) {
             return null;
         }
         $buf = '';
         while ($str = fgets($fp, 4096)) {
             $buf .= $str;
         }
         fclose($fp);
         if (function_exists("iconv")) {
             $buf = iconv("UTF-8", "UTF-8//IGNORE", $buf);
         }
         return $buf;
     }
     $server = Abstract_Server::load($log_);
     if (!$server) {
         return null;
     }
     $l = new Server_Logs($server);
     $l->process();
     $buf = '';
     while ($str = $l->getContent()) {
         $buf .= $str;
     }
     if (function_exists("iconv")) {
         $buf = iconv("UTF-8", "UTF-8//IGNORE", $buf);
     }
     return $buf;
 }