protected static function initialize()
 {
     $ini = eZINI::instance('file.ini');
     $h = $ini->variable('ClusteringSettings', 'FileHandler');
     if (in_array($h, array('ezfs', 'eZFSFileHandler', 'eZFS2FileHandler'))) {
         self::$view_groups['cachestats']['disabled'] = false;
         self::$view_groups['cachesearch']['disabled'] = false;
         self::$view_groups['storagestats']['disabled'] = false;
     }
     if (in_array($h, array('eZDFSFileHandler'))) {
         self::$view_groups['cachestats']['disabled'] = false;
         self::$view_groups['storagestats']['disabled'] = false;
         self::$view_groups['clustercachestats']['disabled'] = false;
         self::$view_groups['clusterstoragestats']['disabled'] = false;
         self::$view_groups['cachestats']['name'] = 'Local Cache Stats';
         self::$view_groups['storagestats']['name'] = 'Local Storage Stats';
     } else {
         self::$view_groups['clustercachestats']['hidden'] = true;
         self::$view_groups['clusterstoragestats']['hidden'] = true;
     }
     if (eZSysinfoSCMChecker::hasScmInfo()) {
         self::$view_groups['sourcerevision'] = array('script' => 'genericview.php', 'default_navigation_part' => 'ezsysinfonavigationpart', 'name' => 'SCM Info', 'description' => 'Information about the Source Control System current Revision');
     }
     // a bit hackish...
     if (count(ezSysinfoClusterManager::clusterNodes()) && !ezSysinfoClusterManager::isClusterSlaveRequest()) {
         foreach (self::$view_groups as &$viewDefinition) {
             if (@$viewDefinition['cluster_mode'] != '') {
                 $viewDefinition['script'] = $viewDefinition['cluster_mode'];
             }
         }
     }
 }
Exemplo n.º 2
0
 protected static function initialize()
 {
     // starting with version 4.1, this is available in the Setup|System Info page
     if (version_compare('4.1', eZPublishSDK::version()) <= 0 && !count(ezSysinfoClusterManager::clusterNodes())) {
         self::$view_groups['php']['hidden'] = true;
     }
     /*if ( isset( $GLOBALS['_PHPA'] ) )
       {
          self::$view_groups['PHP']['phpaccelerator'];
       }
       else if ( extension_loaded( 'Turck MMCache' ) )
       {
           $operatorValue = 'mmcache';
       }*/
     if (extension_loaded('eAccelerator')) {
         self::$view_groups['eaccelerator']['disabled'] = false;
     }
     if (extension_loaded('apc')) {
         self::$view_groups['apc']['disabled'] = false;
     }
     if (function_exists('accelerator_get_status') || function_exists('opcache_get_status')) {
         self::$view_groups['acceleratorplus']['disabled'] = false;
     }
     /*else if ( extension_loaded( 'Zend Performance Suite' ) )
       {
           $operatorValue = 'performancesuite';
       }*/
     if (extension_loaded('xcache')) {
         self::$view_groups['xcache']['disabled'] = false;
     }
     if (extension_loaded('wincache')) {
         self::$view_groups['wincache']['disabled'] = false;
     }
     $db = eZDB::instance();
     if ($db->databaseName() == 'mysql') {
         /// @todo is this the correct way to check?
         if (function_exists('mysqli_get_client_stats')) {
             self::$view_groups['mysqli']['disabled'] = false;
         }
     }
     // a bit hackish
     if (count(ezSysinfoClusterManager::clusterNodes()) && !ezSysinfoClusterManager::isClusterSlaveRequest()) {
         foreach (self::$view_groups as &$viewDefinition) {
             if (@$viewDefinition['cluster_mode'] != '') {
                 $viewDefinition['script'] = $viewDefinition['cluster_mode'];
             }
         }
     }
 }
Exemplo n.º 3
0
 */
/// @var eZModule $module
$module = $Params['Module'];
$view = $module->currentView();
// rely on system policy instead of creating our own, but allow also PolicyOmitList for single views
// (useful f.e. for system status checks from tools which can not authenticate because they are too simple).
// Also allow the clusterhelper view to do its auth and then run this view.
$ini = eZINI::instance();
if (!in_array("sysinfo/{$view}", $ini->variable('RoleSettings', 'PolicyOmitList')) && ezSysinfoClusterManager::getAuthStatus() !== true) {
    $user = eZUser::currentUser();
    $access = $user->hasAccessTo('setup', 'system_info');
    if ($access['accessWord'] != 'yes') {
        return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
    }
}
$isClusterSlaveRequest = ezSysinfoClusterManager::isClusterSlaveRequest($Params);
$tpl = sysInfoTools::eZTemplateFactory();
if ($isClusterSlaveRequest) {
    // for requests which 'come from cluster', remove titles
    $tpl->setVariable('title', '');
    $tpl->setVariable('description', '');
    $tpl->setVariable('cluster_request', true);
} else {
    $tpl->setVariable('title', ezSysinfoModule::viewTitle($view));
    $tpl->setVariable('description', ezSysinfoModule::viewDescription($view));
    $tpl->setVariable('cluster_request', false);
}
// value to these vars can be set by the view code to alter response
$extra_path = '';
$response_type = '';
$response_data = null;
Exemplo n.º 4
0
 /**
  * @todo set up soap and webdav tests
  */
 public static function runTests()
 {
     $status_tests = array('db' => '0', 'cluster db' => '0', 'ldap server' => '0', 'web access' => '0', 'ezfind' => '0', 'mail' => '0');
     $db = eZDB::instance();
     if ($db->isConnected() === true) {
         $status_tests['db'] = '1';
     }
     $clusterDBHandler = ezSysinfoClusterManager::clusterDBHandler();
     if ($clusterDBHandler instanceof eZDBFileHandler) {
         // warning - we dig into the private parts of the cluster file handler,
         // as no real API are provided for it (yet)
         if (is_resource($clusterDBHandler->backend->db)) {
             $status_tests['cluster db'] = '1';
         }
     } else {
         if (is_object($clusterDBHandler)) {
             // This is even worse: we have no right to know if db connection is ok.
             // So we replicate some code here...
             try {
                 $clusterDBHandler->_connect();
                 $status_tests['cluster db'] = '1';
             } catch (exception $e) {
             }
         } else {
             $status_tests['cluster db'] = 'X';
         }
     }
     if (in_array('ezfind', eZExtension::activeExtensions())) {
         $ini = eZINI::instance('solr.ini');
         $ezfinpingurl = $ini->variable('SolrBase', 'SearchServerURI') . "/admin/ping";
         $data = eZHTTPTool::getDataByURL($ezfinpingurl, false);
         $pos2 = stripos($data, '<str name="status">OK</str>');
         if ($pos2 !== false) {
             $status_tests['ezfind'] = '1';
         } else {
             $status_tests['ezfind'] = '0';
         }
     } else {
         $status_tests['ezfind'] = 'X';
     }
     $ini = eZINI::instance('ldap.ini');
     if ($ini->variable('LDAPSettings', 'LDAPEnabled') == 'true' && $ini->variable('LDAPSettings', 'LDAPServer') != '') {
         if (function_exists('ldap_connect')) {
             // code copied over ezldapuser class...
             $LDAPVersion = $ini->variable('LDAPSettings', 'LDAPVersion');
             $LDAPServer = $ini->variable('LDAPSettings', 'LDAPServer');
             $LDAPPort = $ini->variable('LDAPSettings', 'LDAPPort');
             $LDAPBindUser = $ini->variable('LDAPSettings', 'LDAPBindUser');
             $LDAPBindPassword = $ini->variable('LDAPSettings', 'LDAPBindPassword');
             $ds = ldap_connect($LDAPServer, $LDAPPort);
             if ($ds) {
                 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $LDAPVersion);
                 if ($LDAPBindUser == '') {
                     $r = ldap_bind($ds);
                 } else {
                     $r = ldap_bind($ds, $LDAPBindUser, $LDAPBindPassword);
                 }
                 if ($r) {
                     $status_tests['ldap server'] = '1';
                 }
             }
         }
     } else {
         $status_tests['ldap server'] = 'X';
     }
     $ini = eZINI::instance('sysinfo.ini');
     $websites = $ini->variable('SystemStatus', 'WebBeacons');
     if (is_string($websites)) {
         $websites = array($websites);
     }
     foreach ($websites as $key => $site) {
         if (trim($site) == '') {
             unset($websites[$key]);
         }
     }
     if (count($websites)) {
         foreach ($websites as $site) {
             // current eZ code is broken if no curl is installed, as it does not check for 404 or such.
             // besides, it does not even support proxies...
             if (extension_loaded('curl')) {
                 if (eZHTTPTool::getDataByURL($site, true)) {
                     $status_tests['web access'] = '1';
                     break;
                 }
             } else {
                 $data = eZHTTPTool::getDataByURL($site, false);
                 if ($data !== false && sysInfoTools::isHTTP200($data)) {
                     $status_tests['web access'] = '1';
                     break;
                 }
             }
         }
     } else {
         $status_tests['web access'] = 'X';
     }
     $ini = eZINI::instance('sysinfo.ini');
     $recipient = $ini->variable('SystemStatus', 'MailReceiver');
     $mail = new eZMail();
     if (trim($recipient) != '' && $mail->validate($recipient)) {
         $mail->setReceiver($recipient);
         $ini = eZINI::instance();
         $sender = $ini->variable('MailSettings', 'EmailSender');
         $mail->setSender($sender);
         $mail->setSubject("Test email");
         $mail->setBody("This email was automatically sent while testing eZ Publish connectivity to the mail server. Please do not reply.");
         $mailResult = eZMailTransport::send($mail);
         if ($mailResult) {
             $status_tests['mail'] = '1';
         }
     } else {
         $status_tests['mail'] = 'X';
     }
     /*
     $ini = eZINI::instance( 'soap.ini' );
     if ( $ini->variable( 'GeneralSettings', 'EnableSOAP' ) == 'true' )
     {
         /// @todo...
     }
     else
     {
         $status_tests['ez soap'] = 'X';
     }
     
     $ini = eZINI::instance( 'webdav.ini' );
     if ( $ini->variable( 'GeneralSettings', 'EnableWebDAV' ) == 'true' )
     {
         /// @todo...
     }
     else
     {
         $status_tests['ez webdav'] = 'X';
     }
     */
     return $status_tests;
 }
Exemplo n.º 5
0
<?php

/**
 * @author G. Giunta
 * @copyright (C) G. Giunta 2014-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 * A view which is used to do alternative permission checking, then execute one of the std views
 */
$module = $Params['Module'];
$targetView = array_shift($Params['Parameters']);
$token = $Params['authToken'];
// check intra-cluster token-based auth
if (!ezSysinfoClusterManager::verifyAuthToken($targetView, $token)) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
// signal to genericview.php that auth is ok
ezSysinfoClusterManager::setAuthStatus(true);
// nb: we have to take care not execute clustermaster.php again, which makes view definition too complex to be good
$Result = $module->run($targetView, array_merge($Params['Parameters'], $Params['UserParameters']));
Exemplo n.º 6
0
 /**
  * A helper to allow views communicate auth status between each other when doing internal redirects
  * @param bool $status
  */
 public static function setAuthStatus($status)
 {
     self::$authStatus = $status;
 }
Exemplo n.º 7
0
<?php

/**
 *
 * @author G. Giunta
 * @copyright (C) G. Giunta 2008-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 * @todo add more details, such as dates of first/last files
 * @todo add possibility to zoom in to file list going to cachesearch view
 * @todo add support for db-clustered configs - hard currently, since there is no recursive search in api...
 * @todo in ezdfs mode allow user to only show clustered data
 */
$cacheFilesList = array();
$cacheList = eZCache::fetchList();
$clusterStorageDir = ezSysinfoClusterManager::clusterFileStorageDir();
if ($clusterStorageDir != '') {
    $storageDir = $clusterStorageDir;
    foreach ($cacheList as $cacheItem) {
        if ($cacheItem['path'] != false && $cacheItem['enabled']) {
            $cacheName = 'DFS://' . $cacheItem['name'];
            // take care: this is hardcoded from knowledge of cache structure...
            if ($cacheItem['path'] == 'var/cache/ini') {
                //$cachedir = $storageDir . '/' . eZSys::siteDir() . '/' . $cacheItem['path'];
                // no var/cache/ini in dfs nfs storage
                continue;
            } else {
                $cachedir = $storageDir . '/' . eZSys::cacheDirectory() . '/' . $cacheItem['path'];
            }
            $cacheFilesList[$cacheName] = array('path' => $cachedir);
            $count = sysInfoTools::countFilesInDir($cachedir);
Exemplo n.º 8
0
        }
        echo $buffer;
        /*eZClusterURLFilter::setUrlParameters( '/(targetnode)/' . $clusterProxyRequestTarget );
          stream_filter_register( 'urlFilter', 'eZClusterURLFilter' );
          stream_filter_append( $fp, 'urlFilter', STREAM_FILTER_READ );
          fpassthru( $fp );*/
    } else {
        eZDebug::writeWarning("Could not connect to {$url}");
    }
    eZExecution::cleanExit();
}
//$isClusterMasterRequest = count( ezSysinfoClusterManager::clusterNodes() ) && ezSysinfoModule::viewClusterMode( $view ) == 'split';
$tpl = sysInfoTools::eZTemplateFactory();
$tpl->setVariable('title', ezSysinfoModule::viewTitle($view));
$tpl->setVariable('description', ezSysinfoModule::viewDescription($view));
$tpl->setVariable('cluster_nodes', ezSysinfoClusterManager::clusterDataRetrievalUrls('proxy', $module->currentRedirectionURI()));
// note that we do not execute any php sub-view
// value to these vars can be set by the view code to alter response
$extra_path = '';
// fetch template to render results
$Result = array();
$Result['content'] = $tpl->fetch("design:sysinfo/clustermasterview.tpl");
// build nav menu & left-hand menu
$Result['left_menu'] = 'design:parts/sysinfo/menu.tpl';
$url1stlevel = array(array('url' => 'sysinfo/index', 'text' => sysInfoTools::ezpI18ntr('SysInfo', 'System information')));
if ($view == 'index') {
    $url1stlevel[0]['url'] = false;
    $url2ndlevel = array();
} else {
    $url2ndlevel = array(array('url' => false, 'text' => sysInfoTools::ezpI18ntr('SysInfo', ezSysinfoModule::viewName($view))));
}